ENOTES

1s and 2s complement subtraction

access_time Aug 29, 2021 remove_red_eye 26391

1's and 2's Complement
1's Complement can be obtained by simply altering 1s to 0s and 0s to 1s. For eg, 1's Complement of (1001) is (0110). Similarly 2's Complement can be obtained by Adding 1 to the 1's complement of a given binary number. For eg, if (1001) is a given number then, its 1's complement is (0110) and 2's complement is (0110) +(1) = (0111)

Rules in 1s and 2s complement subtraction

Rule using 1s Complement
Step 1: Given numbers must be in the form X-Y with same digits. Extra 0 can be added at the beginning to make same digits.
Step 2: Calculate 1's complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that extra bit and add on its remaining bit.
             If there is no extra bit, find 1's Complement of result in step 3 and add (-)ve sign.

Rule using 2s Complement
Step 1: Given numbers must be in the form X-Y with same digits. Extra 0 can be added at the beginning to make same digits.
Step 2: Calculate 2’s complement of ‘Y’
Step 3: Add result of step 2 with ‘X’
Step 4: If there is extra bit, remove that and remaining bit will be the answer.
             If there is no extra bit, find 2’s Complement of result in step 3 and add (-)ve sign.

Q1) Subtract (1010) from (1111) using 1's and 2's complement.
Ans. Given question is (1111) - (1010)

A) Using 1's Complement, 
First calculating 1's complement of (1010) is (0101)
Adding (0101) with (1111)  we get
(0101) + (1111) = (10100)
Since,  there is  extra bit i.e. 4 digits added with 4 digits and gives 5 digits result
Removing that extra bit and adding on it
(0100) + (1) = (0101)
Hence, result is (0101)

B) Using 2's Complement, 
First calculating 2's complement of (1010) is (0101) + (1) = (0110)
Adding (0111) with (1101)  we get
(0110) + (1111) = (10101)
Since,  there is  extra bit i.e. 4 digits added with 4 digits and gives 5 digits result
Removing that extra bit, we get (0101)
Hence, result is (0101)


Q2) Subtract (100) from (11) using 1's and 2's complement.
Ans. Given question is (11) - (100), making same digits we have (011) - (100)

A) Using 1's Complement, 
First calculating 1's complement of (100) is (011)
Adding (011) with (011)  we get
(011) + (011) = (110)
Since,  there is no extra bit i.e. 3 digits added with 3 digits and gives 3 digits result
Calculating 1's complement of (110) we get (001) and putting (-)ve sign
Hence, result is -(001)

B) Using 2's Complement, 
First calculating 2's complement of (100) is (011) + (1) = (100)
Adding (100) with (011)  we get
(100) + (011) = (111)
Since,  there is no extra bit i.e. 3 digits added with 3 digits and gives 3 digits result
Calculating 2's complement of (111) we get (000) + (1) = (0001) and putting (-)ve sign
Hence, result is -(001)

Q3) Subtract (1001) from (1101) using 1's and 2's complement.
Ans. Given question is (1101) - (1001)

A) Using 1's Complement, 
First calculating 1's complement of (1001) is (0110)
Adding (0110) with (1101)  we get
(0110) + (1101) = (10011)
Since,  there is  extra bit i.e. 4 digits added with 4 digits and gives 5 digits result
Removing that extra bit and adding on it
(0011) + (1) = (0100)
Hence, result is (0100)

B) Using 2's Complement, 
First calculating 2's complement of (1001) is (0110) + (1) = (0111)
Adding (0111) with (1101)  we get
(0111) + (1101) = (10100)
Since,  there is  extra bit i.e. 4 digits added with 4 digits and gives 5 digits result
Removing that extra bit, we get (0100)
Hence, result is (0100)

Q4) Perform (111100) - (1011) using 1's and 2's complement.
Ans.Given question is (111100) - (1011), making same digits we have (111100) - (001011)

A) Using 1's Complement, 
First calculating 1's complement of (001011) is (110100)
Adding (110100) with (111100)  we get
(110100) + (111100) = (1110000)
Since,  there is  extra bit i.e. 6 digits added with 6 digits and gives 7 digits result
Removing that extra bit and adding on it
(110000) + (1) = (110001)
Hence, result is (110001)

B) Using 2's Complement, 
First calculating 2's complement of (001011) is (110100) + (1) = (110101)
Adding (110101) with (111100)  we get
(110101) + (111100) = (1110001)
Since,  there is  extra bit i.e. 6 digits added with 6 digits and gives 7 digits result
Removing that extra bit, we get (110001)
Hence, result is (110001)

Q5) Perform (1010) - (101111) using 1's and 2's complement.
Ans. Given question is (1010) - (101111), making same digits we have (001010) - (101111)

A) Using 1's Complement, 
First calculating 1's complement of (101111) is (010000)
Adding (010000) with (001010)  we get
(010000) + (001010) = (011010)
Since,  there is  no extra bit i.e. 6 digits added with 6 digits and gives 6 digits result
Calculating 1's complement of (011010) we get (100101) and putting (-)ve sign
Hence, result is -(100101)

B) Using 2's Complement, 
First calculating 2's complement of (101111) is (010000) + (1) = (010001)
Adding (010001) with (001010)  we get
(010001) + (001010) = (011011)
Since,  there is  no extra bit i.e. 6 digits added with 6 digits and gives 6 digits result
Calculating 2’s complement of (011011) we get (100100) + (1) = (100101) and putting (-)ve sign
Hence, result is -(100101)