We can subtract the 5-bit binary numbers 011012 (1310) and 010012 (910) by converting 010012 to its negative equivalent in 1's complement and adding this value to 011012.

  1. First, we need to convert 010012 to its negative equivalent in 1's complement.
    01101   (13)
  - 01001  - (9)
  1. To do this we change all the 1's to 0's and 0's to 1's. Notice that the most-significant digit is now 1 since the number is negative.
  01001 -> 10110
  1. Next, we add the negative value we computed to 011012. This gives us a result of 1000112.
    01101   (13)
  + 10110  +(-9)
   100011    (?)
  1. Notice that our addition caused an overflow bit. Whenever we have an overflow bit in 1's complement, we add this bit to our sum to get the correct answer. This gives us a final answer of 001002 (or 410).
  +     1
    00100    (4)

Animated version

Let's review the steps for subtracting x from y with an n-bit 1's complement representation.

  1. Negate x using 1's complement.
    1. Reverse all the bits in x to form -x.
  2. Add -x and y.
  3. If the sum exceeds n bits, add the extra bit to the result.
  4. If the sum does not exceed n bits, leave the result as it is.