Adding the decimal numbers 274 and 352 is shown below. The algorithm starts with the least significant digit and works from right to left. For each place position, the digit from the top and bottom number is summed. If the result is a single digit, it is written in the final sum in the same place value position. If the result is two digits, then the least significant is written in that place value position in the sum, and the most significant is carried to the next, more significant place value position, where it is added with those digits.
Binary addition works in the same way. Here is an example of adding '0111' with '0101'.
Binary subtraction can also be performed using the same algorithm most of us have learned for decimal substraction. Consider this example in which '154' is subtracted from '603'. Subtraction proceeds right to left. The bottom digit is subtracted from the top digit, and the result written in the place value position in the result. If the top digit is less than the bottom digit, then we must 'borrow' from the next place value position. That means decrementing the top digit in the next significant position and adding the base to the top digit of this position before performing the subtraction. This gets even more complicated if the position we wish to borrow from has a '0' in it! In this case, we must cascade the borrow to the next significant position. This happens in our example when we subtract the '4' from the '3'. We must borrow, but the next position has a '0', so we move on to the '6'.
This algorithm can get very complicated, and the amount of time it takes to perform the subtraction can vary greatly. Wouldn't it be nice if we had a subtraction algorithm as simple and predictable as addition? Well, we already have that algorithm. It is the addition algorithm itself. Think about it. How can you use addition to compute "A - B"? Of course! Convert 'B' to 'negative B' and add them, like this: A+(-B). This way, you could use your addition algorithm to perform subtraction.
The only problem is, we have yet to see how negative numbers are represented in binary. That's a topic for the next section.