Mark As Completed Discussion

Why Does It Work?

The process of converting a decimal number to binary using division and recording the remainders works mathematically because of the way binary and decimal numbers are structured. Here is an explanation:

Binary numbers use only two digits - 0 and 1. Each binary digit represents a power of 2. Starting from the right, the first digit is 2^0, the next is 2^1, then 2^2, and so on.

Decimal numbers represent sums of powers of 10. The rightmost digit is 10^0, the next 10^1, then 10^2, etc.

When we divide a decimal number by 2 repeatedly, recording the remainder each time, we are essentially finding out how many 2s need to be summed to get the original decimal number.

For example, if we start with the decimal 172, visualize each step below as one digit in the final result.

  • 172 / 2 = 86 remainder 0 (2^0 = 1)
  • 86 / 2 = 43 remainder 0 (2^1 = 2)
  • 43 / 2 = 21 remainder 1 (2^2 = 4)
  • 21 / 2 = 10 remainder 1 (2^3 = 8)
  • 10 / 2 = 5 remainder 0 (2^4 = 16)
  • 5 / 2 = 2 remainder 1 (2^5 = 32)
  • 2 / 2 = 1 remainder 0 (2^6 = 64)
  • 1 / 2 = 0 remainder 1 (2^7 = 128)

So 172 in binary is 10101100 because:

  • 1 x (2^7) = 128
  • 0 x (2^6) = 0
  • 1 x (2^5) = 32
  • 0 x (2^4) = 0
  • 1 x (2^3) = 8
  • 1 x (2^2) = 4
  • 0 x (2^1) = 0
  • 0 x (2^0) = 0

Which sums to 172.

The division algorithm allows us to repeatedly divide out the largest power of 2 possible to recreate the original decimal number as a sum of powers of 2 - which results in the binary representation.