Addition and Subtraction of Base 2 Numbers

Just like we do for decimal numbers, we can also add and subtract binary numbers.

Binary numbers are digits in base 2.

Since base 2 has only two digits (0 and 1), the result of the addition and subtraction of binary numbers must be in 0 and 1.

Addition of Binary Numbers

To add binary numbers, you should note the following:

  1. Always start at the rightmost column when adding binary numbers.
  2. When adding in binary, you should note the following also:
    • 1+0=1
    • 1+1=10
    • 0+1=1
    • 0+0=0
    • 10+1=11
  3. The result of adding two binary numbers should be the binary equivalent of what you would obtain by converting the binary numbers to decimal numbers and adding them in decimal form.

Example 1

Add \(111_2\) and \(101_2\)

Solution:

\begin{align}111& \\\underline{+\quad 101}& \\\underline{1100}&\end{align}

Explanation:

  1. Starting from the rightmost digit, we add 1+1 which gives us 10. Just like we usually do in the decimal system, we write 0 and carry one to the next column.
  2. In the column second to the rightmost column, we add 0+1, which gives us 1. We then add the 1 carried from step 1, so that 1+1 gives 10. Once again, we wrote 0 and then moved 1 to the next column.
  3. In the leftmost column, when we add 1+1, we get 10. We then add the 1 carried from step 2, so that 1+1 gives us 11. This time, we do not need to carry over because the number is the last digit on the left.
  4. As a result, the sum of \(111_2\) and \(101_2\) is \(1100_2\)

Note: 111 in base 10 is 7 and 101 in base 10 is 5, and the result of adding 7+5 in base 10 is 12, which is the decimal equivalent of the base 2 number 1100.

So, the statement “the result of adding two binary numbers should be the binary equivalent of what you would obtain by converting the two binary numbers to decimal numbers and adding them in decimal form.” is correct.

Example 2

What is the sum of \(1000_2\) and \(1010_2\).

Solution:

\begin{align}1000& \\\underline{+\quad 1010}& \\\underline{10010}&\end{align}

Explanation:

  1. Starting from the rightmost column, the result of adding 0 and 0 is 0.
  2. In the second column next to the rightmost column, the sum of 0 and 1 is 1.
  3. We also get 0 when we add the 0 and 0 in the third column to the rightmost digit.
  4. In the leftmost column, we add 1 and 1, which gives us 10.
  5. Therefore, the sum of 1000 and 1010 in base 2 is 10010.

Example 3

Add \(1111_2\) and \(1011_2\).

Solution:

\begin{align}1111& \\\underline{+\quad 1011}& \\\underline{11010}&\end{align}

Explanation:

  1. When we add the numbers in the rightmost column (1 and 1), we get 10. However, we will write 0 and carry 1 over.
  2. To the second rightmost column, 1+1=10. Now, we will add the 1 we carried over from step 1. So, We add 10 +1 which gives us 11. We will write 1 and carry 1 over to the next column.
  3. In the next column, 1+0 gives us 1. If we add the 1 carried over from step 2, the result will be 1+1 or 10. As usual, we will write 0 and carry 1 over again.
  4. In the leftmost column, the sum of 1 and 1 is 10. We then add the 1 carried over from step 3, so that 10 +1 gives us 11.
  5. As a result, the result of adding 1111 and 1011 in base 2 is 11010.

Subtraction of Binary Numbers

To subtract binary numbers, you should note the following:

  1. Just like you always do when adding binary numbers, start from the rightmost column when subtracting binary numbers.
  2. When you are faced with a 0 minus 1 situation in any column, you have to borrow 1 from the next column so that the column becomes 10 and the column from which you borrowed 1 becomes 0.
  3. Also, note the following rules of subtraction:
    • 1-0=1
    • 0-0=0
    • 1-1=0
    • 10-1=1
  4. The result of subtracting two binary numbers should be the binary equivalent of what you would obtain by converting all the binary numbers to decimal numbers and subtracting them in decimal form.

Example 4

Subtract \(1000_2\) from \(1101_2\)

Solution:

\begin{align}1101& \\\underline{-\quad 1000}& \\\underline{0101}&\end{align}

Explanation:

  1. Starting from the rightmost column, 1 minus 0 gives us 1.
  2. In the column second to the rightmost column, 0 minus 0 gives 0.
  3. In the third column from the right, the difference between 1 and 0 is 1.
  4. In the leftmost column, 1 minus 1 is zero.
  5. Therefore, the difference between the numbers 1101 and 1000 in base 2 is 101.

Example 5

Subtract \(110_2\) from \(101_2\)

Solution:

\begin{align}110& \\\underline{- \quad 101}& \\\underline{001}&\end{align}

Explanation:

  1. In the right column, 0 minus 1 will not work. So, we will borrow 1 from the next column so that the digit in the rightmost column becomes 10 and the digit in the second rightmost column becomes 0. So, when we subtract 1 from 10, we get 1.
  2. In the column second to the right column, since we have removed 1 from it, it becomes 0 minus 0 which is 0.
  3. For the leftmost column, 1 minus 1 gives 0.
  4. Therefore, we will get 1 when we subtract 110 from 101.

Example 6

Subtract 1001 and 100 in binary

Solution:

\begin{align}1001& \\\underline{- \quad 100}& \\\underline{0101}&\end{align}

Explanation:

  1. Starting from the rightmost column, 1 minus 0 will give 1.
  2. To the second column next to the rightmost column, 0 minus 0 gives 0.
  3. In the next column, 0 minus 1 will not work. As a result, we will borrow 1 from the leftmost digit and the third column to the rightmost column will be 10 minus 1, which equals 1.
  4. In the left column, since, we have already removed 1, it becomes 0 so that 0 minus 0 gives 0.
  5. Therefore, the result o subtracting 100 from 1001 in binary is 101.