Last modified on October 30th, 2023

chapter outline

 

Binary Subtraction

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. 

Rules

The subtraction involving 2 binary numbers follows the 4 rules:

  1. 0 – 0 = 0
  2. 0 – 1 = 1
  3. 1 – 0 = 1 (Borrow 1 from the next high-order digit)
  4. 1 – 1 = 0

We can summarize it as:

A + BSubtractionBorrow
0 – 000
0 – 110
1 – 011
1 – 100

Binary Subtraction with Borrowing

Let us subtract 1102 from 10102 using the rules.

Step 1: Aligning the numbers based on their place values

1010
110

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.

1010
110
1

Step 3: Subtracting the value in the 10’s place, (0 – 0) = 0

1010
110
01

Step 4: Now, for subtracting the values in 100’s place, we will borrow 1 from the 1000’s place (0 – 1) = 1

1010
110
0101

Thus, subtracting 1102 from 10102, we get 01012

Binary Subtraction without Borrowing

Let us subtract 102 from 1112 to understand binary subtraction involving borrow.

Step 1: Aligning the numbers based on their place values

111
10

Step 2: There is no borrow in this case, as there is no instance of subtraction of 1 from 0. Thus, the result is:

111
10
0101

Thus, subtracting 102 from 1112, we get 01012

Subtraction Using 1’s Complement

It is similar to binary addition using 1’s complement, where:

  • 0 represents the positive sign
  • 1 represents the negative sign

The basic steps to be followed while performing subtraction using 1’s complement are:

  1. Finding the 1’s complement of the subtrahend
  2. Adding it with the minuend or the first number
  3. If there is a carry, then we add it to the Step 2 result
  4. If there is no carry, the result from step 2 is the difference of the two numbers using 1’s complement

Let us subtract 1001012 from 1101012

Step 1: Aligning the numbers based on their place values

110101
100101

Step 2: Finding the 1’s complement of the subtrahend and adding it to the minuend

110101
100101
001111

Step 3:

110101
100101
001111
+1
010000

     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

Subtraction Using 2’s Complement

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:

  1. Finding the 2’s complement of the smaller number
  2. Adding the result to the larger number
  3. Omitting the carry forward

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

1111
+0110
10101

Step 3: Omitting this carry, we get

1111
+0110
0101

Thus, the required result is +0101