# Subtraction using 10’s complement

In digital computer systems, arithmetic operations are simplified using the radix complement system also known as r’s complement system. The r stands for radix which is a base for a number in a particular number system. In this post, you learn to do subtraction using 10’s complement.

You must be familiar with the complement system in digital logic to understand this subtraction method. To learn about complements visit the following link.

Digital Design – Complements

Examples of number system are decimal, binary, octal, hexadecimal. In a binary system we have complements.

For example,

If you talk about a binary system, the base is 2, then we have two types of r’s complement.

1. r’s complement
2. (r-1)’s complement

For decimal number the r’s complement is 10’s complement and (r-1)’s complement is 9’s complement because base is 10. In other words, decimal number has base r = 10, so  10’s complement and r-1 = 9, so 9’s complement. The binary number has base r = 2, 2’s complement and r-1 = 1 , so one’s complement.

## Q1. Subtract using 10’s complement 52 – 12 .

We know that 52  – 12 = 40
Let   m = 52   and  n = 12
Take 10’s complement of 12

\begin{aligned}
&+99\\
&-12\\
&----\\
&+87
\end{aligned}

Now, 87 is 9’s complement because we subtracted it with 99. To make it 10’s complement add 1 to 87. The 10’s complement of 12 is 88. Add the 88 to m

\begin{aligned}
&+52\\
&+88\\
&----\\
&\hspace{8px}140
\end{aligned}

Answer: Remove the extra 1 and you get 40

Check the second example.

## Q2: Subtract using 10’s complement 12 – 52

We know that 12 < 52, so answer is -40
Let m = 12 and n = 52
10’s complement of 52

\begin{aligned}
&+99\\
&-52\\
&----\\
&+47
\end{aligned}

The 9’s complement of 52 is 47. To make it 10’s complement add 1 to 47.

\begin{aligned}
&+12\\
&+48\\
&----\\
&+60
\end{aligned}

This is not the answer , wait

Take one more 10’s complement of the result.

\begin{aligned}
&+99\\
&-60\\
&----\\
&+39
\end{aligned}

The 9’s complement of 60 is 39. Add 1 to 39 and make is 10’s complement.
Add negative to the result because m > n.

## Summary

How do I take 10’s complement  ?

Suppose n = 123 then
There are 3 digits in 123. The 10’s complement would be 9’s complement + 1.

\begin{aligned}
&999 - 123 = 876\\
&876 + 1 = 877
\end{aligned}

Therefore, the 10’s complement of 123 is 877.