Binary Subtraction

Binary subtraction can be performed by adding the 2's complement of the subtrahend to the minuend. If a final carry is generated, discard the carry and the answer is given by the remaining bits which is positive. If the final carry is zero, the answer is negative and is in 2's complement form.

Lets try to subtract 5 from 7 using 2's complement method.
Since we are performing subtraction with 2's complement method, we will say lets add (+7) and (-5), and will represent (-5) in 2's complement format.

```               0 1 1 1
+   1 0 1 1  ( -5 in 2's complement format)
--------------
1 0 0 1 0
-------------- ```

Here we got a carry the summation is 5 bits. So according to rule we will discard carry, and take remaining value 0010 as result i.e (2)10. Since the last carry was generated, the result is positive.

Lets take one more example and try to subtract 7 from 5.
Again we will say lets add (+5) and (-7), where -7 is represented in 2's complement format.

```               0 1 0 1
+    1 0 0 1 ( -7 in 2's complement format)
--------------
1 1 1 0
-------------- ```

No carry is generated and the summation is still 4 bits, so the answer is negative and its value is in 2's complement form.

2's complement of 1110 is 0010, hence the answer is (-2)10. Again note, that Since the last carry was not generated, the result is negative.