Search code examples
binarydigital-design

Can somebody explain the reasoning behind decimal to binary conversion?


I know the concept of division by 2 & then taking the remainder but I want to know how this method actually works. I want a mathematical derivation for this.


Solution

  • The mathematical derivation you are asking for is based on the remainder theorem, which states that: Dividend = Divisor*Quotient + Remainder

    Now consider a decimal number X. We can express X in binary form as follows: X= a*2^0 + b*2^1 + c*2^2 + d*2^3 .........................

    Our aim is to find the values of coefficients a,b,c,d... to express the number in binary form.

    Now if you divide X by 2, you will get 'a' as the remainder & the corresponding quotient would be (b*2^0 + c*2^1 + d*2^2 ........)

    Now if we divide the above quotient again by 2 we will get 'b' as the remainder & this cycle will go on until we get all coefficients which will give us the final binary form.