Main Page | See live article | Alphabetical index

# Method of complements

In mathematics, the method of complements is a technique used to subtract one number from another using only addition of positive numbers. Specifically, the number to be subtracted is first converted into its complement, and then added to the other number.

One practical application of the method of complements is for performing subtraction in a computer microprocessor which uses the binary numeral system. Binary computers typically employ the two's complement for the operation of subtraction.

In the decimal numbering system, the method of complements can be carried out using nine's complement or ten's complement.

 Table of contents 1 Nine's complement 2 Ten's complement 3 Comments

## Nine's complement

To subtract a number y (the subtrahend) from another number x (the minuend), nine's complement may be used. In this method, y is complemented by determining the complement of each digit. The complement of a decimal digit in the nine's complement system is the number that must be added to it to produce 9. The complement of 3 is 6, the complement of 7 is 2, and so on. Given a subtraction problem:

```  873  (x)
- 218  (y)
```
The nine's complement of y (218) is 781. This is the same as subtracting y from 999. The number of 9's is equal to the number of digits as y itself has.

Next, the complement of y is added to x:

```  873  (x)
+ 781  (complement of y)
=
1654
```
The first "1" digit is then dropped, giving 654. Finally, 1 is added to the result, giving 655. It can easily be verified that 873 - 218 = 655.

This technique works differently if x < y. In that case, there will not be a "1" digit to cross out at the end, and nor is a "1" added to the result. For example:

```  185  (x)
- 329  (y)
```
Complementing y gives:

```  185  (x)
+ 670  (y)
=
855
```
The result of 855 is then complemented, giving 144. Since x < y, a negative sign must be added, so the answer is -144. Again, it can easily be confirmed that 185 - 329 = -144.

## Ten's complement

With the ten's complement approach, the complement of the subtrahend is found with regard to 10n, where n is the number of digits in y. Using the same example as above:

```  873  (x)
- 218  (y)
```
The complement of y with respect to 103 = 1000 is the same as 1000 - y, or 782. In the same way as before, this number is added to x:

```  873  (x)
+ 782  (complement of y)
=
1655
```
Dropping the initial "1" gives 655. Since ten's complement was used, there is no need to add 1 to the result.

For cases where x <= y, the second approach must be used. Note that with ten's complement, if x = y, this approach must be used also. Using the same example as before:

```  185  (x)
- 329  (y)
```
Complementing y using ten's complement gives:

```  185  (x)
+ 671  (y)
=
856
```
Finally, complementing 856 with ten's complement gives the result 144, or -144 once the negative sign is added.

## Comments

The necessity of erasing the initial "1" in the result is convenient, particularly considering that computer microprocessors typically have a limited, fixed number of digits with which to perform arithmetic. In a microprocessor that can only contain 8 bits, for example, the leftmost "1" in the examples above is equivalent to the ninth bit, which is lost during calculation. Since subtraction may be a complex operation involving multiple steps for a microprocessor, the method of complements is extremely useful for performing subtractions using only addition. For details, see two's complement.