Complementary Subtraction

If you do any work with computers, you will soon find out that most digital systems
cannot subtract - they can only add. You are going to need a method of adding that gives
the results of subtraction. Does that sound confusing? Really, it is quite simple. A
COMPLEMENT is used for our subtractions. A complement is something used to complete
something else.

In most number systems you will find two types of complements. The first is the amount
necessary to complete a number up to the highest number in the number system. In the
decimal system, this would be the difference between a given number and all 9s. This is
called the nines complement or the radix-1 or R's-1 complement. As an example, the nines
complement of 254 is 999 minus 254, or 745.

The second type of complement is the difference between a number and the next higher
power of the number base. As an example, the next higher power of 10 above 999 is 1,000.
The difference between 1,000 and 254 is 746. This is called the tens complement in the
decimal number system. It is also called the radix or R's complement. We will use
complements to subtract. Let's look at the *magic* of this process. There are three
important points we should mention before we start: (1) Never complement the minuend in a
problem, (2) always disregard any carry beyond the number of positions of the largest of
the original numbers, and (3) add the R's complement of the original subtrahend to the
original minuend. This will have the same effect as subtracting the original number. Let's
look at a base ten example in which we subtract 38 from 59:

Now let's look at the number system that most computers use, the binary system. Just as
the decimal system, had the nines (R's-1) and tens (R's) complement, the binary system has
two types of complement methods. These two types are the ones (R's-1) complement and the
twos (R's) complement. The binary system R's-1 complement is the difference between the
binary number and all 1s. The R's complement is the difference between the binary number
and the next higher power of 2.

Let's look at a quick and easy way to form the R's-1 complement. To do this, change
each 1 in the original number to 0 and each 0 in the original number to 1 as has been done
in the example below.

1011011_{2}

0100100_{2} R's-1 complement

There are two methods of achieving the R's complement. In the first method we perform
the R's-1 complement and then add 1. This is much easier than subtracting the original
number from the next higher power of 2. If you had subtracted, you would have had to
borrow.

Saying it another way, to reach the R's complement of any binary number, change all 1s
to 0s and all 0s to 1s, and then add 1.

As an example let's determine the R's complement of 10101101_{2}: _{}

The second method of obtaining the R's complement will be demonstrated on the binary
number 00101101100_{2}.

Step 1 - Start with the LSD, working to the MSD, writing the digits as they are up to
and including the first *one*.

Step 2-Now R's-1 complement the remaining digits:

Now let's R's complement the same number using both methods:

Now let's do some subtracting by using the R's complement method. We will go through
the subtraction of 3_{10} from 9_{10} (0011_{2}from 1001_{2}):

Step 1 - Leave the minuend alone:

1001_{2} remains 1001_{2}

Step 2 - Using either method, R's complement the subtrahend:

1101_{2} R's complement of subtrahend

Step 3 - Add the R's complement found in step 2 to the minuend of the original problem:

Step 4 - Remember to discard any carry beyond the size of the original number. Our
original problem had four digits, so we discard the carry that expanded the difference to
five digits. This carry we disregard *is* significant to the computer. It indicates
that the difference is positive. Because we have a carry, we can read the difference
directly without any further computations. Let's check our answer:

If we do *not* have a carry, it indicates the difference is a negative number. In
that case, the difference must be R's complemented to produce the correct answer.

Let's look at an example that will explain this for you.

Subtract 9_{10} from 5_{10} (1001_{2} from 0101_{2}):

Step 1 - Leave the minuend alone:

0101_{2} remains 0101_{2}

Step 2 - R's complement the subtrahend:

0111_{2} R's complement of subtrahend

Step 3 - Add the R's complement found in step 2 to the minuend of the original problem:

Step 4 - We do *not* have a carry; and this tells us, and any computer, that our
difference (answer) is negative. With no carry, we must R's complement the difference in
step 3. We will then have arrived at the answer (difference) to our original problem.
Let's do this R's complement step and then check our answer:

0100_{2} R's complement of difference in step 3

Remember, we had no carry in step 3. That showed us our answer was going to be
negative. Make sure you indicate the difference is negative. Let's check the answer to our
problem:

Try solving a few subtraction problems by using the complement method:

Q.21 Subtract:

Q.22 Subtract:

Q.23 Subtract: