# Converting from decimal to any number base.

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?

• what do you mean by reverse order? – user164550 Apr 12 '16 at 17:32
• say 6, when converting to binary, we divide it by two and the remainder is 0 then again we divide by two and get the remainder 1, and at last we get the remainder 1. Now we represent decimal 6 in binary as 110 taking the remainders but not in the order that we found them. We found them as 011. I hope I am clear – Redwanul Sourav Apr 12 '16 at 17:39
• Keep in mind after first step you divided by $2$ and had $0$, then you divided by another $2$ which means that you have divided by $2^2$ and had $1$, and another $2$ which is $2^3$ in total and had $1$, and so on. This why the lease significant bit is the first number you obtained. This is because the remainder from $2^1$ goes under $2^0$, the remainder from $2^2$ goes under $2^1$ ans so on. – user164550 Apr 12 '16 at 17:43
• Well because the first remainder is in the one's place because we divide by 2 The second remainder is the 2s place and the next the 4s place and so on. If you think about it is the same reason when we add or multiply we start in the one position and work our way up to higher powers of 10 rather than from the high powers to the ones. It's arbitrary that we write our numbers with the higher power digits to the left and the lower power digits to the right and in some ways it'd make sense to go the other way (although in other ways it does). – fleablood Apr 12 '16 at 20:20
• The answer of your question is at proof for the general rule of conversion from base 10 to other bases (the answer of the user A.P.) – tbt Oct 20 '16 at 21:40

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$.

• Nice: very clear. (+1) – Brian M. Scott Apr 12 '16 at 21:35

Example: Convert $30$ (base ten) to base $4$:

$30=4(7)+2+4(4(1)+3)+2=4^2(1)+4(3)+2$.

So the answer is $132_{\rm{four}}$.

But note that the first remainder ($2$) is the least significant digit--i.e., it goes in the ones place. And basically we are acquiring digits right to left.