Binary Addition and Subtraction
The binary addition & subtraction is similar to the decimal number system. But the main difference between these two is, binary number system uses two digits like 0 & 1 whereas the decimal number system uses digits from 0 to 9 and the base of this is 10. There are some specific rules for the binary system. Like when we add & subtract binary numbers then we must be very careful while carrying otherwise borrowing digits because these will occur more frequently. This article discusses an overview of the addition & subtraction of binary numbers in detail below.
What is Binary Addition & Subtraction?
If a computer is accomplished in handling 5-bit numbers like -1101 where the minus is a sign bit and remaining digits are magnitude bits then this 5-bit number can be represented like 11101. Here in this digit, the first digit ‘1’ specifies the negative sign as well as remaining 4 digits are the magnitude of the numbers.
In the same way, 01101 denotes the +1101 binary numbers.
A negative (-) number is also denoted using the concept of the magnitude of the number’s 1’s complement.
So the binary number – 1101 may be denoted as 10010 where the first digit is a most significant bit or MSB. It means the negative number as well as and 0010 is the 1’s complement of the magnitude.
In the same way, 11011 specify the number like 0100.
Similarly, the 2’s complement method is also used for representing a –ve binary number.
The binary addition & subtraction methods using sign bit which represents negative numbers are used easily in the design of the computer for calculating sums as well as differences of binary numbers through the addition process only.
Binary Addition
Binary addition technique is similar to normal addition of decimal numbers excluding that as an alternative value of 10 digits, it carries on a 2 value.
For example, as we compute 7+9 manually, then the answer is 16. So we know that the result has to write like two digits 1 and 6. The main reason to write down the result like 1 6 is, the addition of 7 + 9 is greater than the single digit. So the result cannot be denoted through a single digit because the largest single digit is ‘9’.
Similarly, whenever we would like to sum two binary numbers, only we will have a carry if the product is bigger than 1 because, in binary numbers, 1 is the highest number. The binary addition rules are given in the following truth table of subtraction.
A |
B | A+B | Carry |
0 |
0 | 0 |
0 |
0 | 1 | 1 |
0 |
1 |
0 | 1 |
0 |
1 |
1 | 0 |
1 |
In the above tabular form, the initial three equations are the same for the binary digit number. The addition of binary numbers step by step is explained in detail. For binary addition take an example of 11011 & 10101.
1 1 1 1 (Carry)
1 1 0 1 1 (27)
(+) 1 0 1 0 1 (21)
_ _ _ _ _ _ _ _ _ _ _ _
1 1 0 0 0 0 (48)
Here the step by step binary addition rules is explained below
1 + 1 => 1 0, so 0 with a carry 1
1 + 1 + 0 => 1 0. So 0 with carry 1
1+0+1 => 10 => 0. So 0 with carry-1
1+1+0 => 10 => 10 = 0 with carry-1
1+1+1=> 10+1 => 11= 1 with carry-1
1 +1 +1 = 11
Carefully note that 10 + 1 => 11 and this is equal to 2 + 1= 3. Therefore the necessary outcome is 111000.
Examples
The binary addition examples are shown in the following figure.
Binary Subtraction: First Method
In subtraction, this is the primary technique. In this method, ensure that the subtracting number must be from larger number to smaller, or else this technique won’t work appropriately.
If the minuend is smaller than the subtrahend, then this method is used by just switch their positions and memorize that the effect will be a -ve number. The binary subtraction rules are given in the following truth table of subtraction.
A | B | A-B |
Borrow |
0 |
0 | 0 | 0 |
0 | 1 | 1 |
1 |
1 |
0 | 1 | 0 |
1 | 1 | 0 |
0 |
For example, in the binary subtraction, subtract the subtrahend from minuend. Take an example of subtrahend (110112) and minuend (11011012). For subtraction, arrange these two like the subtrahend should be below the minuend. The example of this is given below.
1101101
– 11011
To get the same number of digits in subtrahend, add zeros where it requires.
1101101
– 0011011
_ _ _ _ _ _ _ _
1010010
In the above binary subtraction example, the subtraction was achieved from the right side to the left side with the help of tabular form which is shown in the above. Here the step by step binary subtraction rules is explained below.
If the input 1 1 = 0, then borrow to the next step is 0.
If the input 0 1 = 1 & borrow is 0. So 1 0 = 1 then borrow to the next step is 1.
If the input 1 0 = 0 & borrow is. So 1 1 = 0 then borrow to the next step is 0.
If the input 1 1 = 0 & borrow is 0. So 0 0 = 0 then borrow to the next step is 0.
If the input 0 1 = 1 & borrow is 0. So 1 0 = 1 then borrow to the next step is 1.
If the input 1 0 =1 & borrow is 1. So 1 1 = 0, then borrow to the next step is 0.
Final step, If the input 1 0 = 0 & borrow is 0. So 10 = 1, then borrow to the next step is 0.
So the final result will be 1010010
Second Method: Two’s Complement
First, confirm that the digits in the subtrahend and minuends should be equal. In the above example, the digits in the minuends have 7 whereas in subtrahend the digits are 5. So we need to extend the digits in subtrahend by adding zeros. A 2’s complement of a number can be achieved by complementing each digit of the number like zero’s to ones and ones to zeros. Finally, add one to one’s complement. An example of this two’s complement is shown below.
0011011
1’s complement can be achieved by converting 0’s to 1’s and 1’s to 0’s. So the result will be like the following.
0011011 – – – -> 1100100 (1’s complement)
2’s complement can be achieved by adding 1 to 1’s complement. So the result will be like the following.
1100100
+ 0000001
_ _ _ _ _ _ _ _ _
= 1100101
Now add the subtrahend‘s 2’s complement & minuend.
1101101 (subtrahend)
+ 1100101 (2’s complement)
_ _ _ _ _ _ _ _
(MSB) (1)1010010
In the above result, ignore the MSB (most significant bit) of the outcome. If there is no additional bit, you did a mistake while adding the digits.
Examples
The binary subtraction examples are shown in the following figure.
Thus, this is all about an overview of Binary Addition and Subtraction, which includes what is binary addition, binary addition rules, binary addition examples, and binary subtraction, binary subtraction rules, binary subtraction examples. Here is a question for you, what is the only difference between binary addition and subtraction?