How to do Binary Subtraction

Subtracting two binary numbers is just like subtracting two decimal numbers the way you learned in elementary school. We'll start by setting up the long subtraction then use the borrowing method to move from right to left. Binary subtraction is made even easier by the fact that there's only 1s and 0s to work with, so there's even less to think about.
fact
The three facts we need to complete binary subtraction are: $$\begin{align} 0 - 0 & = 0 \\ 1 - 0 & = 1 \\ 10 - 1 & = 1 \\ \end{align}$$ The last one is for when we "borrow" a 1 from the next digit to the left because we have a \(0 - 1\) situation.
example

Find \(110_2 - 10_2\)

Start by setting up our long subtraction. $$\begin{align} 110 & \\ -\quad 10 & \\ \overline{\hphantom{-\quad 11}} & \\ \end{align}$$ Now as with normal long subtraction we'll start with the column on the right and do our subtraction column-by-column. Our right-most column is \(0 - 0 = 0\) so we write a 0 for our first answer digit. $$\begin{align} 110 & \\ -\quad 11 & \\ \overline{\hphantom{-\quad 11}} & \\ 0 & \\ \end{align}$$ Our next column to the left is \(1 - 1 = 0\) so we again write a 0. $$\begin{align} 110 & \\ -\quad 11 & \\ \overline{\hphantom{-\quad 11}} & \\ 00 & \\ \end{align}$$ And finally the last column is \(1-0 = 1\) so we write a 1. $$\begin{align} 110 & \\ -\quad 11 & \\ \overline{\hphantom{-\quad 11}} & \\ 100 & \\ \end{align}$$ And we're done. Our answer is: $$110_2 - 10_2 = 100_2$$ Which, if we convert everything to decimal we get: $$6 - 2 = 4$$ So we're right!
example

Find \(110_2 - 11_2\)

First set up our long subtraction: $$\begin{align} 110 & \\ -\quad 11 & \\ \overline{\hphantom{-\quad 11}} & \\ \end{align}$$ Now we start on the right with \(0-1\) so we have to borrom from the next digit in the top row: $$\begin{align} 1\cancel{1}^0\, ^10 & \\ -\quad 1\phantom{^0\, ^1}1 & \\ \overline{\phantom{-\quad 11}} & \\ \end{align}$$ Now we have \(10 - 1 = 1\) so we write that into our answer: $$\begin{align} 1\cancel{1}^0\, ^10 & \\ -\quad 1\phantom{^0\, ^1}1 & \\ \overline{\hphantom{-\quad 11}} & \\ 1 & \\ \end{align}$$ Now our next column has the same problem we so again borrow, this time from the left-most column. $$\begin{align} \cancel{1}^0\cancel{1}^{10}\, ^10 & \\ -\quad 1\phantom{^{10}\, ^1}1 & \\ \overline{\hphantom{-\quad 11}} & \\ 1\phantom{^{10}\, ^1}1 & \\ \end{align}$$ And now the left-most column is just \(0 - 0\) and we're done. So our answer is: $$110_2 - 11_2 = 11_2$$ Which we can check by converting everything to decimal and we see that: $$6 - 3 = 3$$ Which is of course correct, so we did everything right!
Do you remember during the signed complements topic when I said that we could do binary subtraction using two's complement form and addition? And I said that that's the whole reason two's complement form is so popular? Well it's true, in fact doing binary subtraction using the two's complement form is crazy easy and much faster to do. See we know that \(20 - 7 = 20 + -7\) So if we wanted to do this in binary we'd just add the binary of 20 to the binary of -7 in two's complement form.
fact
Binary subtraction \(X - Y\) can be done by converting \(Y\) to its two's complement and then computing \(X + Y\text{(two's complement)}\)
fact
The addition when using two's complement form subtraction might give an answer with one more bit than the two original numbers have, if that's the case just ignore it.
example

Find \(110_2 - 11_2\) using two's complement form.

Start out by finding the two's complement of \(11_2\) (always use the same number of digits as the larger number in the subtraction). $$\text{(two's complement)}\,\,011_2 = 101_2$$ Now we just do the addition \(110_2 + 101_2\): $$\begin{align} 110 & \\ +\quad 101 & \\ \overline{\hphantom{-\quad 101}} & \\ 1011 & \\ \end{align}$$ Now our answer has four bits but our two original numbers only have three so we'll discard the carry bit to get: $$110_2 - 11_2 = 011_2$$ Just like we found above, but without having to do any borrowing and keeping track of it all.
practice problems