Table of Contents
Last modified on October 30th, 2023
Binary subtraction is one of the 4 binary operations performed using the 2 binary numbers 0 and 1; the other 3 are addition, multiplication, and division.
It is similar to decimal addition in mathematics. However, we follow some rules while doing subtraction involving binary numbers.
The subtraction involving 2 binary numbers follows the 4 rules:
We can summarize it as:
A + B | Subtraction | Borrow |
0 – 0 | 0 | 0 |
0 – 1 | 1 | 0 |
1 – 0 | 1 | 1 |
1 – 1 | 0 | 0 |
Let us subtract 1102 from 10102 using the rules.
Step 1: Aligning the numbers based on their place values
Step 2: We will consider the first column and subtract the first column, which gives the result 1 (0 – 1 = 1) with a borrow of 1 from the 10’s place. The value 1 in the 10’s column is converted to 0 after being borrowed from the 10’s column as 1.
Step 3: Subtracting the value in the 10’s place, (0 – 0) = 0
Step 4: Now, for subtracting the values in 100’s place, we will borrow 1 from the 1000’s place (0 – 1) = 1
Thus, subtracting 1102 from 10102, we get 01012
Let us subtract 102 from 1112 to understand binary subtraction involving borrow.
Step 1: Aligning the numbers based on their place values
Step 2: There is no borrow in this case, as there is no instance of subtraction of 1 from 0. Thus, the result is:
Thus, subtracting 102 from 1112, we get 01012
It is similar to binary addition using 1’s complement, where:
The basic steps to be followed while performing subtraction using 1’s complement are:
Let us subtract 1001012 from 1101012
Step 1: Aligning the numbers based on their place values
Step 2: Finding the 1’s complement of the subtrahend and adding it to the minuend
Step 3:
1 1 0 1 0 1
+1 0 0 1 0 1
_________
0 0 1 1 1 1
+ 1
_________
0 1 0 0 0 0
_________
Thus, the required result is + 010000
Similar to 1’s complement, we can find 2’s complement of a number by adding a 1 to the 1’s complement of a number.
The method involves adding one integer to the 2’s complement of another number. It involves the following steps:
Using this method, let us subtract (1010)2 from (1111)2.
Step 1: Finding the 2’s complement of the smaller number, we get
(1010)2 → (0110)2
Step 2: Adding (0110)2 to (1111)2, we get
Step 3: Omitting this carry, we get
Thus, the required result is +0101
Last modified on October 30th, 2023