Topic Content:
- Binary Arithmetic Operations – Subtraction
This operation is similar to the basic arithmetic subtraction performed on decimal numbers in Maths. Hence, when we subtract 1 from 0, we need to borrow 1 from the next higher-order digit, to reduce the digit by 1 and the remainder left here is also 1.
The subtraction of binary numbers is given by:
Binary Number | Subtraction Value |
0 – 0 | 0 |
1 – 0 | 1 |
0 – 1 | 1 (Borrow 1 from next high order digit) |
1 – 1 | 0 |
When you borrow a number during subtraction, it becomes the number of the base you are subtracting from.
For example, in Base 2 if you borrow a number the number you borrow becomes 2.
Worked Example 2.2.1:
Subtract the following:
i. 1001two from 11001two
ii. 11011two from 111010two
iii. 1101two – 111two
iv. 10001two – 1110two
v. 1111two – 101two
Solution
i. 1001two from 11001two
Explanation
1st Column (from right to left): 1 – 1 = 0. Write 0.
2nd Column: 0 – 0 = 0. Write 0.
3rd Column: 0 – 0 = 0. Write 0.
4th Column: 1 – 1 = 0. Write 0.
5th Column: 1 – 0 = 1. Write 1.
ii. 11011two from 111010two
1st Column (from right to left): 0 is smaller than 1 so we will have to borrow from the 2nd column. Since it is in base 2 any number borrowed is 2. So borrowing two from the second column will give (2 + 0) – 1 = 1
2nd Column: This reduces 1 to 0 in the second column. 0 is smaller than 1 so we have to borrow again from the third column. We now have 2 – 1 = 1
3rd Column: This reduces 0 to -1 in the third column. This too is smaller than 1 so have to borrow from the 4th column. = 2 – 1 – 0 = 1
4th Column: This reduces 1 to 0 in the fourth column. We have to borrow from the 5th column. Remember that since we are subtracting in base 2 the number we borrow is 2. so we have 2 + 0 – 1 = 1
5th Column: This reduces 1 to 0 in the fifth column. We have to borrow from the 5th column.
So we have 2 + 0 – 1 = 1
6th Column: 1 is reduced to 0. The number in the 6th column is 0 so we can ignore it.
Answer = 111112
iii. 1101 – 111
1st Column (from right to left) = 1 – 1 = 0. Write 0.
2nd Column: 0 is smaller than 1 so we have to borrow from the third column. We are subtracting in base 2 so the number we borrow is 2. We therefore have 2 + 0 – 1 = 0
3rd Column: This reduces 1 to 0 in the third column. This too is smaller than 1 so have to borrow from the 4th column. We now have 2 + 0 – 1 = 1
4th Column: This reduces 1 to 0 in the fourth column. We don’t have to write anything down since what we have is 0.
Answer = 1102
iv. 10001two – 1110two
v. 1111two – 101two