Skip to content
Home ยป Complements

Complements

    In the previous lesson, we learned about number systems โ€“ binary, decimal, octal and hexadecimal number systems in detail. Complements are very helpful in performing subtraction and save computing time and lead to simple circuits.

    Before we move to subtraction, letโ€™s understand what complement is all about. In simple words, if there is group with have R items, and you took S items from the group, then you need the complement R-S items to complete the group.

    These R-S items are called the complements.

    In a number system, there is a fixed range of numbers and when you pick any number from the system, you have a complement for that number in the number system.

    Types of Complements

    There are two types of complements.

    1. Diminished Radix Complement or r-1โ€™s complement.
    2. Radix Complement or rโ€™s complement.

    Diminished Radix Complement [r-1โ€™s complement]

    Suppose a number N is given

    N = Number

    r = base of the number

    n = Number of digits in the number.

    The r-1โ€™s complement of the number is given by the formula.

    (r^n - 1) - N

    Radix Complement [rโ€™s complement]

    To find radix complement of a number N, where

    N = Number

    r. = base of the number

    n = Number of digits in the number.

    The rโ€™s complement of the number is given as

    r^n - N

    or

    r-1โ€™s \hspace{3px}complement + 1 => [( r^n -1) โ€“ N] + 1

    Examples โ€“ Diminished Radix Complements

    Here are some example problems for diminished radix complements.

    Problem1:

    Find 9โ€™s complement of 258.

    Solution:

    \begin{aligned}
    &N = 258\\
    &r = 10\\
    &n=3\\\\
    &We \hspace{3px} use \hspace{3px}the \hspace{3px}formula\hspace{3px} for \hspace{3px}r-1โ€™s \hspace{3px}complement.\\\\
    &(r^n โ€“ 1) โ€“ N\\
    &(10^3 โ€“ 1) โ€“ 258\\
    &999 โ€“ 258\\
    &The \hspace{3px} 9โ€™s \hspace{3px}complement \hspace{3px}of \hspace{3px}258 \hspace{3px}is \hspace{3px}741.
    \end{aligned}

    Problem2:

    Find 1โ€™s complement for 1101.

    Solution:

    In the given problem,

    \begin{aligned}
    &N = 1101\\
    &r = 2\\
    &n = 4\\\\
    &The \hspace{3px}formula \hspace{3px}for \hspace{3px}r-1โ€™s \hspace{3px}complement \hspace{3px}where r = 2\hspace{3px} is \hspace{3px}(r^n - 1) โ€“ N.\\\\
    &(2^4 - 1) - 1101\\\\
    &Note:\hspace{3px} Binary \hspace{3px}equivalent for \hspace{3px}2^4  = 10000.\\\\
    &(10000 - 1)1101\\
    &1111 - 1101\\
    &The \hspace{3px} 1โ€™s \hspace{3px}complement \hspace{3px}for \hspace{3px}1101 \hspace{3px}is \hspace{3px}0010.
    \end{aligned}

    Method 2

    The second method to find the r-1โ€™s complement is to subtract each digit in the number by r-1.

    In our case, r = 2 so r โ€“ 1 = 1

    Given that the 1โ€™s complement of binary number is

    \begin{aligned}
    &1 โ€“ 1 = 0\\
    &1 โ€“ 1 = 0\\
    &1 โ€“ 0 = 1\\
    &1 โ€“ 1 = 0\\\\
    &Answer: 0010
    \end{aligned}

    Problem3:

    Find 7โ€™s complement of octal number 234.

    Solution:

    The range of digits for octal number is 0-to-7. Subtract each digit with 7 will give r-1’s complement for octal.

    \begin{aligned}
    &7 - 2 = 5\\
    &7 - 3 = 4\\
    &7 - 4 = 3\\\\
    &The \hspace{3px} r-1's \hspace{3px} complement \hspace{3px}is \hspace{3px} 543.
    \end{aligned}

    Examples โ€“ Radix Complements

    There are two methods to find the rโ€™s complement of a number.

    \begin{aligned}
    &Method \hspace{3px}1: r^n โ€“ N\\
    &Method \hspace{3px}2: r-1โ€™s \hspace{3px}complement + 1
    \end{aligned}

    Problem4:

    Find 10โ€™s complement for 432.

    Solution:

    Given that

    \begin{aligned}
    &N = 432\\
    &r = 10\\
    &n = 3\\
    &
    \end{aligned}

    Method 1:

    \begin{aligned}
    &First \hspace{3px}we \hspace{3px}will \hspace{3px}find \hspace{3px}the \hspace{3px} 10โ€™s \hspace{3px}complement \hspace{3px}using \hspace{3px}r^n โ€“ N.\\
    &r^n โ€“ N = 1000 โ€“ 432 = 568\\
    &Therefore,\\
    &10โ€™s \hspace{3px}complement \hspace{3px}of\hspace{3px} 432 \hspace{3px}is \hspace{3px}568.
    \end{aligned}

    Method 2:

    By using method 2, you need to find the 9โ€™s complement and then add 1 to the result to get 10โ€™s complement.

    Step1: Subtract each digit by 9 to get 9โ€™s complement.

    \begin{aligned}
    &9 - 4 = 5\\
    &9 - 3 = 6\\
    &9 - 2 = 7\\
    
    \end{aligned}

    Step2: Add 1 to the result.

    \begin{aligned}
    &567 + 1\\
    &=568\\
    &568 \hspace{3px}is \hspace{3px}the \hspace{3px}10โ€™s \hspace{3px}complement \hspace{3px}of \hspace{3px}432.
    \end{aligned}

    Problem5:

    Find 2โ€™s complement of the binary number 1001.

    Solution:

    Method 1:

    We can obtain the solution in using two methods.

    \begin{aligned}
    &To \hspace{3px} find \hspace{3px} 2โ€™s \hspace{3px}complement \hspace{3px}using \hspace{3px}method 1 \hspace{3px}use \hspace{3px}the \hspace{3px}formula r^n โ€“ N.\\
    &Given \hspace{3px} that\\
    &N = 1001\\
    &r = 2\\
    &n = 4\\
    &r^n - N = 10000 โ€“ 1001\\\\
    &\hspace{8px}\sout10000\\
    &-1001\\
    &\hspace{8px}----\\
    &\hspace{11px}0111\\\\
    &The \hspace{3px}2โ€™s \hspace{3px}complement \hspace{3px}for \hspace{3px}1001 \hspace{3px}is \hspace{3px}0111.
    \end{aligned}

    Method 2:

    To use second method, find the 1โ€™s complement for 1001 and then add 1 to the result.

    Step1: find the 1โ€™s complement of 1001.

    \begin{aligned}
    1001 -> 0110 (1โ€™s complement)
    \end{aligned}

    Step2: Add 1 to result.

    \begin{aligned}
    &0110 + 1 => 0111\\
    &Therefore,\\
    &0111 \hspace{3px}is \hspace{3px} the \hspace{3px}2โ€™s \hspace{3px}complement \hspace{3px}of \hspace{3px}0110.
    \end{aligned}

    References

    1. John.F.Wakerly. 2008. Digital Design: Principles And Practices, 4/E. Pearson Education, India.
    2. Mano, M. Morris. 1984. Digital Design. Pearson.