# Subtraction using 1's Complement & 2's Complement

Posted by Sreejith Hrishikesan ~ on ~ 1 comments

Subtraction Using 1’s Complement (Indirect Subtraction)

We can perform subtraction by adding minuend to the complement of subtrahend and doing some further manipulations in the sum so obtained. The steps involved in this procedure are:

1. Find the 1’s complement of subtrahend. For this, in the decimal system, subtract the   subtrahend from 9 if it is a single-digit number, 99 if it is a double-digit number, and so on. In binary system, complementary number can be obtained by changing 0s to 1s and 1s to 0s.
2. Next, add minuend and complement of subtrahend. This is called as 9’s complement addition in decimal system and 1’s complement in binary system.
3. Finally, add the most significant digit (or, bit) in the sum to the least significant digit (or, bit) in the remaining portion of the number from which the MSD is removed to obtain the resulting subtracted number.

Example 30: Subtract decimal number 4 from decimal number 7.

Solution: Following step 1, we find the 9’s complement of 4, which is 9 ‒ 4 = 5. Next, add 7 and 5 to yield 12. Finally, add MSD 1 to LSD 2 to get 3. We find that this is the desired result.

Example 31: Subtract binary number 100 from binary number 111.

Solution: To solve this problem, we use the steps given in Section 1.17.2.
1. 1’s complement of 100  =  011
2. 111 + 011 = 1010
3. Removing MSB 1 and adding it to the remaining portion of 010 in 1010, we get

Desired sum = 010 + 1= 011
We find that 011 is the desired result.

Subtraction using 2’s Complement

Step 3 of Section (Subtraction using 1's Complement) requires that for binary subtraction using 1’s complement, shifting and addition of MSB with LSB has to be performed. Binary subtraction can also be performed using 2’s complement.

2’s complement of a given number is obtained by adding binary 1 to its 1’s complement. For example, we know that 1’s complement of 101 is 010. Adding 1 to 010 yields the 2’s complement of 101 as 010 + 1= 011. The steps involved in binary subtraction using 2’s complement are:

1. Find the 1’s complement of subtrahend.
2. Add 1 to the 1’s complement to get the 2’s complement of subtrahend.
3. Add minuend and 2’s complement of subtrahend.
4. Discard the MSB to get the desired difference.

Example 32: Subtract (100)2 from (111)2 using 2’s complement.

Solution:  To solve this problem, we use the steps given in Section 'Subtraction using 2's Complement'.
1. 1’s complement of 100 = 011.
2. 1 + 011 = 100.
3. 111 + 100 = 1011
4. Discard the MSD 1 from 1011. We the get
Difference = 011

This is the desired result.