Number Representation, Addition and Multiplication In Any Base
York College (CUNY)
Jamaica, New York 11451
Email: email@example.com (for additions, suggestions, and corrections)
web page: http://www.york.cuny.edu/~malk
The decimal system gets its name from using ten digit symbols together with a place notation system to represent numbers. Thus, 32 and 23 represent different numbers. The number 321 is short for 3(10)2 + 2(10)1 + 1(10)0. Recall that any non-zero number to the 0 power is 1. Thus, 321 is three hundred plus twenty plus one. The symbol "0" plays a role both as a number and as a place keeper. For example, 2003 and 203 are not the same number.
To do arithmetic in decimal we have to learn two tables, one for addition and one for multiplication. These tables are usually known as "addition and multiplication facts." Each of the table has size one hundred, which is ten times 10. Typical addition facts are : 2 + 4 = 6 and 7 + 9 = 17. Typical multiplication faces are 6 x 7 = 42 and 3 x 3 = 9.
One can also represent numbers using a notation system of b symbols, rather than ten symbols. When one does this one is said to be working in base b. To represent numbers in base b we use as digit symbols 0, 1, ..., b-1 and then do everything in exact analogy to what we do in decimal, which is the base 10 case.
To distinguish between numbers which are represented different bases we will us the following notation: (321)4 or (321)10. Note that without using some notation one could not tell that these two expressions have different values.
What is the value of (321)4 in base 10? The answer being 3(4)2 + 2(4)1 + 1(4)0. Thus, we have 3(16) + 2(4) + 1(4) = 48 + 8 + 1 = (57)10.
What is the value of (1101)2? The answer is 1(2)3 + 1(2)2 + 0(2)1 + 1(2)0 = 8 + 4 + 0 + 1 =(13)10.
To take a number in x base 10 and convert it to base b, we can divide x by b to get a quotient of q1 and a remainder r1 which lies between 0 and b-1. If we now take q1 and divide it be b we get a new quotient q2 and remainder r2 which is again between 0 and b-1. When do we stop? When we obtain 0 as the quotient and some remainder rn. If we now form the string rnrn-1...r1 we will have converted the original number to base b.
Now that we know have to change a base b number to a base 10 number how do we do addition and multiplication in base b? Rather than do this by first converting to base 10, computing the answer, and then converting back to base b, we will work directly in base b.
Let us see how things work in base 4, where the digit symbols are 0, 1, 2, 3. The table below shows how addition facts work in base four. Because there are symbols the addition fact table is 4x4.
How does one interpret this table? In decimal the addition fact for 9+9 is to "write down" an 8 and carry a 1. In base four the addition fact for 3 + 3 is to "write down" a 2 and carry a 1. Note that since three plus three is six, when we write down six in base four we would write it (12)4. The other entries work in a similar way!
Here is the table of multiplication facts base four:
In base four the multiplication fact for 3 x 3 is to "write" down a 1 can carry a 2. This is because 3 x 3 is nine and when one writes down nine in base four one gets (21)4.
Can one use a base with more than ten symbols. Yes. In fact, the Mayan culture did precisely this, using a positional number system based on base 20. One base that is commonly used today that has more than ten symbols is hexadecimal which uses sixteen symbols. The reason for this is that a number such as a million requires many digits to represent it binary. Since sixteen is a power of two, there are some nice relationships between representing numbers in hexadecimal and binary. The sixteen symbols that are used in hexadecimal are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F. Thus, A represents the number 10, B the number eleven, ...., and F the number 15. In hexadecimal, the number (2E3)16 represents 2(256) + 14(16) + 3. =(739)10.
Here is a nifty connection between hexadecimal and binary representations of numbers. What is the binary representation of (2E3)16? Take each digit in this hexadecimal representation and convert it to binary. 2 is usually written 10 but we will write 0010; E is written 1110; and 3 is written 0011. Note that we have to be certain to use the lead 0's for what we are doing. Now juxtapose these three strings: 1011100011, and treat this as (1011100011)2. If one converts this to decimal one can verify that the answer will be 739, as we determined earlier! (A similar trick works in converting between octal (base 8) representations of numbers and binary.