Base numbers/Conversion
Contents
Converting from base b to base 10
The next natural question is: how do we convert a number from another base into base 10? For example, what does mean? Just like base 10, the first digit to the left of the decimal place tells us how many
's we have, the second tells us how many
's we have, and so forth. Therefore:
![$\displaystyle 4201_5 = (4\cdot 5^3 + 2\cdot 5^2 + 0\cdot 5^1 + 1\cdot 5^0)_{10}$](http://latex.artofproblemsolving.com/b/7/0/b70df42b259bc91ede586338de6d7073c214cee0.png)
![$=4\cdot 125 + 2\cdot 25 + 1$](http://latex.artofproblemsolving.com/f/1/8/f18e136572a0bff538baa585c3d0b02b6ddcc4b4.png)
![$= 551_{10}$](http://latex.artofproblemsolving.com/8/0/d/80d357aa82d0f1669e530b722d769363cc03f303.png)
From here, we can generalize. Let be an
-digit number in base
. In our example (
)
and
. We convert this to base 10 as follows:
![$x = (a_na_{n-1}\cdots a_1a_0)_b$](http://latex.artofproblemsolving.com/4/3/1/431f67c6d05f7b64d7350e7af48110cb262b0993.png)
![$= (b^n\cdot a_n + b^{n-1}\cdot a_{n-1}+\cdots + b\cdot a_1 + a_0)_{10}$](http://latex.artofproblemsolving.com/5/e/c/5ec6e4f2ebb6a409cbb1b4ec34aa9d6b5219d3d3.png)
Converting from base 10 to base b
It turns out that converting from base 10 to other bases is far harder for us than converting from other bases to base 10. This shouldn't be a suprise, though. We work in base 10 all the time so we are naturally less comfortable with other bases. Nonetheless, it is important to understand how to convert from base 10 into other bases.
We'll look at two methods for converting from base 10 to other bases.
Method 1
Let's try converting 1000 base 10 into base 7. Basically, we are trying to find the solution to the equation
![$1000 = a_0 + 7a_1 + 49a_2 + 343a_3+3401a_4+\cdots$](http://latex.artofproblemsolving.com/6/2/8/6282c86e28335d6c53d797e9a8062eb6f2709fb3.png)
where all the are digits from 0 to 6. Obviously, all the
from
and up are 0 since otherwise they will add in a number greater than 1000, and all the terms in the sum are nonnegative. Then, we wish to find the largest
such that
does not exceed 1000. Thus,
since
and
. This leaves us with
![$1000 = a_0 + 7a_1 + 49 a_2 + 343(2)\Leftrightarrow 314 = a_0 + 7a_1 + 49 a_2.$](http://latex.artofproblemsolving.com/e/4/f/e4ffe7d0c84eb8ba38db1ba9d93ca836c264d635.png)
Using similar reasoning, we find that , leaving us with
![$20 = a_0 + 7a_1.$](http://latex.artofproblemsolving.com/c/2/0/c20c3cf2079c02f5f0e21f0ec8c6fcbc27c84088.png)
We use the same procedure twice more to get that and
.
Finally, we have that .
An alternative version of method 1 is to find the "digits" starting with
. Note that
is just the remainder of division of
by
. So, to find it, all we need to do is to carry out one division with remainder. We have
. How do we find
, now? It turns out that all we need to do is to find the remainder of the division of the quotient
by
:
, so
. Now,
, so
. Finally,
, so
. We may continue to divide beyond this point, of course, but it is clear that we will just get
during each step.
Note that both versions of this method use computations in base .
It's often a good idea to double check by converting your answer back into base 10, since this conversion is easier to do. We know that , so we can rest assured we got the right answer.
Method 2
We'll exhibit the second method with the same problem used to exhibit the first method.
The second method is just like how we converted from other bases into base 10. To do this, we pretend that our standard number system is base 7. In base 7, however, there is no digit 7. So 7 is actually represented as 10! Also, the multiplication rules we know do not hold. For example, (in base 7). For one, there is no 9 in base 7. Second, we need to go back to the definition of multiplication to fully understand what's happening. Multiplication is a shorthand for repeated addition. So,
.
In base 7, we have that 10 (the decimal number 10) is 13. Thus, if we view everything from base 7, we are actually converting to base 10. So, this is just
. Remember that we aren't doing this in our regular decimal system, so
. Instead, we have to compute
as
.
This method can be very confusing unless you have a very firm grasp on the notion of number systems.
Resources
Books
- The AoPS Introduction to Number Theory by Mathew Crawford.
- The Art of Problem Solving Volume 1: the BASICS, pgs. 52-54 by Sandor Lehoczky and Richard Rusczyk.
Classes