This article describes the complement arithmetic using 2’s complement binary subtraction. Complement arithmetic is a mathematical operation used to perform subtraction. It involves two types of complements, namely, 1’s complement and 2’s complement. Complement arithmetic is important for subtracting numbers using digital devices like computers and calculators. The primary purpose of complement arithmetic is to convert the subtraction operation to addition.
In this article, we will learn 2’s complement subtraction and their use to perform subtraction of numbers.
What is 2’s Complement?
2’s complement is a complement arithmetic operation used to find the complement of a given number.
The 2’s complement of a binary number is determined by taking 1’s complement of the given number and then adding a 1 to the least significant bit of the 1’s complement. 1’s complement is an arithmetic operation that performs the inversion of bits of a binary number. The 1’s complement of a binary number is determined by changing all the bits to 0 and 0 bits to 1 of the number.
Therefore, the following formula can be used to find the 2’s complement of a number.
2’s complement = 1’s complement + 1
For example, consider the binary number (100110111)2. We have to find the 2’s complement of this number.
Firstly, we find the 1’s complement of this number below.
1’s Complement = (011001000)2
Now, as follows, add 1 to the LSB of 1’s complement to determine the 2’s complement of the number.
2’s Complement = (011001000)2 + (1)2
2’s Complement = (011001001)2
Hence, the 2’s complement of the given number is (011001001)2.
Let us now learn to perform subtraction using 1’s complement and 2’s complement.
Binary number subtraction using 2’s complement
The following steps are involved in subtraction using the 2’s complement arithmetic.
- Find the 2’s complement of the subtrahend.
- Add the 2’s complement of the subtrahend to the minuend.
- If there is an end around carry produce, the result is positive. Obtain the final result by omitting the end around carry.
- If there is no end-around carry produced, the result is negative. The final result is obtained by taking 2’s complement of the intermediate result and putting a minus sign.
The following example explains these steps practically.
Example – Subtract (1110101)2 – (1000101)2 using 2’s complement arithmetic.
Solution –
Minuend = (1110101)2
Subtrahend = (1000101)2
1’s complement of subtrahend = (0111010)2
Therefore, 2’s complement of subtrahend = (0111010)2 + (1)2 = (0111011)2
Adding 2’s complement of the subtrahend to minuend to obtain to perform their subtraction.
(1110101)2 + (0111011)2 = (1 0110000)2
Since there is an end around carry, hence the result is positive. The final result is obtained by discarding the end around the carry marked in red.
Hence,
(1110101)2 – (1000101)2 = (0110000)2
This is how we can perform subtraction using 2’s complement arithmetic.
Solved Problems
Example 1: Subtract (1011)2 from (1110)2 using 2’s complement method
In this example, Subtrahend (1011)2 is the smaller than Minuend number (1110)2.
Step 1– 1’s complement of subtrahend (1011)2
Step 2– 2’s complement of number (step 1)
Step 3– Add (1110)2 and (0101)2
Example 2: Subtract (1110)2 from (1011)2 using 2’s complement method
Subtrahend (1110)2 is larger than Minuend number (1011)2 in this example.
Step 1– 2’s complement of number (1110)2
Step 2– Add minuend (1011)2 and 2’s complement of subtrahend (0010)2
Step 3– Take 2’s complement of the number obtained in Step 2
Conclusion
In this article, we have discussed the 2’s complements subtraction. The 2’s complements help subtract numbers using the addition operation.