[Math] Converting from decimal to any number base.

educationnumber-systems

I know that this can a silly question. But I can not find the answer.
When converting number bases (from decimal to any other number bases), we divide the decimal number by that base, and write down the remainder. Now, to find the converted number, we write the remainders in reverse order. Why do we do that? I mean why it does not work when we write in normal order?

Best Answer

One thing that we must be very clear about: if you have a certain number, it is the same number no matter what base you write it in. If you have $x$ and divide it by $b$ using integer arithmetic only, with integer quotient $q$ and remainder $r$, you will have the same four numbers no matter whether $x$, $b$, $q$, and $r$ are written in base ten, in base two, or in base seven.

Now you are probably aware that if you write a number in decimal notation and you want to divide it by ten, you can simply remove the rightmost digit of the number, and what is left is the quotient; whereas the original rightmost digit (the one that is removed) is the remainder.

This trick works in other bases as well, as long as you divide by the same number that forms the base of your numeric representation. Take the base-eight number $346215_{\text{eight}}$, for example; if we perform integer division of this number by eight, the quotient is $34621_{\text{eight}}$ and the remainder is $5$.

But the remainder of $x$ divided by $b$ is simply a property of those numbers, regardless of the base in which they might happen to be written.

In other words, given any number $x$, the rightmost digit of $x$ (written in base $b$) is the remainder $r$ that you get when you divide $x$ by $b$ using integers only. For example, suppose we start with the number $x = 117901_{\text{ten}}$ (written in base ten), and we divide by $8$, using integers only. The quotient is $q = 14737_{\text{ten}}$ and the remainder is $r = 5$. Therefore, even if we had written $x$ originally in base eight instead, after dividing by eight the remainder would still be $r = 5$.

Further, because of the method explained above for division by eight of a number written in base eight, the last digit of $x$ in base eight is also the remainder after division by eight, that is, the last digit is $5$.

And that is why we always obtain the last digit of the number by taking the remainder after division. It's because that's how division by $b$ works in base $b$.

Related Question