Skip to content
Topos Uranos

Summary

This lesson studies positional notation, in which the value of each digit depends on the place it occupies. It proves that every natural number is written in exactly one way in any base b≥2b \geq 2, by a procedure that consists in dividing repeatedly by the base, and teaches how to convert numbers between base 1010 and bases 22, 88 and 1616, and between the latter by grouping binary digits. It shows that addition and multiplication are carried out in any base by the same rules as in base 1010, explains why the divisibility tests work and extends them to other bases, and closes with a note on the history of numeration and on the use of base 22 in computers.

Learning objectives

  1. Interpret positional notation and compute the value of a number written in any base.
  2. Prove the existence and uniqueness of the representation in base bb, and obtain it by successive divisions.
  3. Convert numbers between bases 22, 88, 1010 and 1616, and add and multiply in base 22.
  4. Justify the divisibility tests for b−1b - 1 and for b+1b + 1 in base bb, and apply them in base 1010 and in other bases.

Positional notation

When we write 20252025 we do not add up four digits: each one is multiplied by a power of 1010 that depends on its place. The first 22 is worth two thousands; the second, two tens. The digit 00 indicates that there are no hundreds and, by occupying its place, keeps the others in the places that belong to them.

2025=2⋅103+0⋅102+2⋅10+52025 = 2 \cdot 10^3 + 0 \cdot 10^2 + 2 \cdot 10 + 5

This principle, called positional notation, does not depend on the number 1010. If b≥2b \geq 2 is a natural number, called the base, the digits in base bb are the numbers 0,1,…,b−10, 1, \ldots, b - 1, and a sequence of digits ak,ak−1,…,a1,a0a_k, a_{k-1}, \ldots, a_1, a_0, with ak≠0a_k \neq 0, represents the number

n=akbk+ak−1bk−1+⋯+a1b+a0n = a_k b^k + a_{k-1} b^{k-1} + \cdots + a_1 b + a_0

The digits are written side by side, from left to right, and the base is indicated as a subscript: for example, 341253412_5 is the number that in base 55 is written with the digits 33, 44, 11 and 22, and it is read “34123412 in base 55”. The digit aia_i is said to occupy place ii, counted from the right starting at 00. Without a subscript, a number is written in base 1010. In base 22 there are only two digits, 00 and 11, which are called bits; in base 1616 sixteen are needed, and the letters A, B, C, D, E and F, worth 1010, 1111, 1212, 1313, 1414 and 1515, are added to the usual ten digits.

Now, the value of a number written in base bb can be computed by factoring out bb again and again, which avoids computing powers: this is Horner’s rule.

LemmaHorner’s rule

For every kk and all numbers a0,a1,…,aka_0, a_1, \ldots, a_k, the sum of the products aibia_i b^i is obtained by starting from aka_k and repeating kk times the operation of multiplying by bb and adding the next coefficient.

akbk+ak−1bk−1+⋯+a1b+a0=(⋯((akb+ak−1)b+ak−2)⋯ )b+a0a_k b^k + a_{k-1} b^{k-1} + \cdots + a_1 b + a_0 = (\cdots((a_k b + a_{k-1}) b + a_{k-2}) \cdots) b + a_0

The proof is an induction on kk that uses only distributivity. The expression is the value at x=bx = b of the polynomial akxk+⋯+a1x+a0a_k x^k + \cdots + a_1 x + a_0, and the lesson on the algebra of polynomials will return to it.

Proof

  1. a0=a0a_0 = a_0

    Base step: for k=0k = 0, both sides reduce to a0a_0, because the rule performs no operation.

  2. ckbk+⋯+c1b+c0=(⋯(ckb+ck−1)⋯ )b+c0\dato{h}{c_k b^k + \cdots + c_1 b + c_0 = (\cdots(c_k b + c_{k-1}) \cdots) b + c_0}

    Induction hypothesis: the rule holds for every sum of k+1k + 1 terms, with arbitrary coefficients, that goes up to the power bkb^k.

  3. ak+1bk+1+⋯+a1b+a0=(ak+1bk+⋯+a2b+a1) b+a0a_{k+1} b^{k+1} + \cdots + a_1 b + a_0 = \resaltar{(a_{k+1} b^k + \cdots + a_2 b + a_1)} \, b + a_0

    Consider a sum that goes up to bk+1b^{k+1}. By distributivity, bb is factored out of all the terms except the last.

  4. ak+1bk+1+⋯+a1b+a0=((⋯(ak+1b+ak)⋯ )b+a1) b+a0a_{k+1} b^{k+1} + \cdots + a_1 b + a_0 = \resaltar{((\cdots(a_{k+1} b + a_k) \cdots) b + a_1)} \, b + a_0

    The parenthesis has the form of the induction hypothesis, with the coefficients ci=ai+1c_i = a_{i+1}; it is written with the rule, and multiplying it by bb and adding a0a_0 gives the rule for k+1k + 1. By the principle of induction, it holds for every kk.

ExampleThe value of a number written in base 5

Compute the number that in base 55 is written 341253412_5, in two ways: by adding the values of the places and with Horner’s rule.

Proof

  1. 34125=3⋅53+4⋅52+1⋅5+23412_5 = \resaltar{3} \cdot 5^3 + \resaltar{4} \cdot 5^2 + \resaltar{1} \cdot 5 + \resaltar{2}

    Each digit is multiplied by the power of 55 that corresponds to its place: 535^3, 525^2, 55 and 11.

  2. 3⋅125+4⋅25+1⋅5+2=375+100+5+2=4823 \cdot \resaltar{125} + 4 \cdot \resaltar{25} + 1 \cdot 5 + 2 = \resaltar{375} + \resaltar{100} + 5 + 2 = \dato{v}{482}

    We compute the powers and the products, and add.

  3. 34125=((3⋅5+4)⋅5+1)⋅5+23412_5 = \resaltar{((3 \cdot 5 + 4) \cdot 5 + 1)} \cdot 5 + 2

    With Horner’s rule we factor 55 out of the first three terms, and then out of the first two inside the parenthesis.

  4. 3⋅5+4=19,19⋅5+1=96,96⋅5+2=482\resaltar{3 \cdot 5 + 4} = 19, \quad \resaltar{19 \cdot 5 + 1} = 96, \quad \resaltar{96 \cdot 5 + 2} = \resaltar{482}

    The computation goes from the inside out: each result is multiplied by the base and the next digit is added to it. The same value is obtained, without any power.