# Complements

Complements are classified into two types based on each base r system:

1. r’s Complement or Radix Compliment.
2. (r-1)’s Complement or Diminished radix complement.

If N is a positive number with base r and having n integer digits, the r’s complement of N is defined as

r’s complement = rn – N

where r = radix(base) of the number system
n= number of integer digits.
N= given positive number.

Also,

r’s complement = (r-1)’s complement + 1

Example: Find 10’s complement of (645.783)10

Solution: The given number, N= 645.783 and here n = 3
so, 10’s complement = 103 – 645.783 = 354.217

## Diminished Radix Compliment or (r-1)’s Complement

If N is a positive number with base r and having n integer digits and m fraction digits, the (r-1)’s complement of N is defined as

where r = radix(base) of the number system
n= number of integer digits.
m= number of fraction digits
N= given positive number.

Example: Find 9’s complement of (645.783)10

Solution: The given number, N= 645.783 and here n = 3 , m=3
so, 10’s complement = 103 -10-3 – 645.783 = 354.216

Note: The complement of the complemented number is the original number N as given below
r’s complement of N is rn-N
r’s complement of rn-N is rn – ( rn-N) which is equal to N

## Complement of the Decimal number system

In the decimal number system (r=10), two compliments are 10’s complement and 9’s complement.

### 9′ Complement Representation

The 9’s complement is calculated by subtracting each digit of decimal number from 9.

Example: Find 9’s complement of (645.783)10

Solution: The 9’s complement of (645.783)10 is calculated by subtracting each digit by 9 computed as below

### 10’s Complement Representation

The 10’s complement is calculated by the addition of 1 to the Least significant bit (LSB) of the 9’s complement of a decimal number.

Example: Find 10’s complement of (645.783)10

Solution: To calculate 10’s complement, firstly we calculate 9’s complement of decimal number and then add 1 to the LSB of 9’s complement to get the 10’s complement shown below:

## Complement of the Binary number system

In the binary number system (r=2), two complements are 2’s complement and 1’s complement.

### 1’s Complement Representation

The 1’s complement of a binary number is calculated by converting all 0’s to 1’s and all 1’s to 0’s.

Example: Find the 1’s Complement of the binary number (11011010)2

Solution: The 1’s complement of a binary number is calculated by changing all 1’s to 0’s and vice versa as shown below:

### 2’s Complement Representation

Solution: The 2’s complement of a binary number is calculated by adding 1 to the LSB of 1’s complement of the given binary number (11011010)2 as shown below:

#### Shortcut method to calculate 2’s complement

2’s Complement of a binary number can also be calculated by keeping all least significant 0’s and the first 1 remain unchanged and convert all the 1’s to 0’s and vice versa in all other higher significant bits as shown below:

## Complement of the Octal number system

In the Octal number system (r=8), two compliments are 8’s complement and 7’s complement.

### 7’s complement Representation

The 7’s complement is calculated by subtracting each digit of an octal number from 7.

Example: Find 7’s complement of (723)8

Solution: The 7’s complement of (723)8 is calculated by subtracting each digit from 7 as shown below:

### 8’s complement Representation

8’s complement is obtained by adding 1 to the least significant bit (LSB) of the 7’s complement of an octal number.

Example: Find 8’s complement of (723)8

Solution: 8’s complement is obtained by adding 1 to the LSB of 7’s complement of an Octal number as shown below:

## Complement of Hexadecimal number system

In the Hexadecimal number system (r=16), two compliments are 16’s complement and 15’s complement.

### 15’s complement Representation

The 15’s complement is calculated by subtracting each digit of hexadecimal number from 15.

Example: Find 15’s complement of (A8B5)16.

Solution: The 15’s complement of (A8B5)16 is obtained by subtracting each digit by 15 as shown below:

### 16’s complement Representation

Example: Find 16’s complement of (A8B5)16.

Solution: The 16’s complement is obtained by adding 1 to the Least significant bit (LSB )of the 15’s complement of a Hexadecimal number as shown below:

## Subtraction with r’s complement

The steps to be taken to perform the subtraction of 2 positive numbers A(minuend) and B( subtrahend ) having base r is are as follows:

1. Firstly check the number of digits between Minuend and subtrahend either they are equal or not. If they are not equal then padding with zero is done to make them equal.
2. Add minuend with the r’s complement of the subtrahend, then the following two conditions arise :
(i) If the sum produces a carry then discard the carry
(ii) If no carry is produced by the above sum then take the r’s complement of the sum and put a negative sign in front.

Example 1: Subtract (84231)10 – (3162)10 by using r’s complement.

Solution: Here r=10, so r’s complement refers to 10’s complement.

Step I: Number of digits in minuend = 5
Number of digits in subtrahend= 4
Padding one 0 to subtrahend to make equal digits as given below,
84231 – 03162

Step II: 10’s complement of 03162 can be calculated as

Step III: Add Minuend with 10’s complement of subtrahend as shown below:

Example 2: Subtract (3162)10 – (84231)10 by using r’s complement.

Solution: Here r=10, so r’s complement refers to 10’s complement.

Step I: Number of digits in minuend = 4
Number of digits in subtrahend= 5
Padding one 0 to minuend to make equal digits as given below,
03162 – 84231

Step II : 10’s complement of 84231 can be calculated as

Step III: Add Minuend with 10’s complement of subtrahend as shown below:

## Subtraction with (r-1)’s complement

The steps to be taken to perform the subtraction of 2 positive numbers A(minuend) and B(subtrahend) having base r by using (r-1)’s complement method is are as follows:

1. Firstly check the number of digits between Minuend and subtrahend either they are equal or not. If they are not equal then padding with zero is done to make them equal.
2. find the (r-1)’s complement of the subtrahend
3. Add minuend to the (r-1)’s complement of the subtrahend, then the following two conditions arise:
(i) If the above sum produces a carry, add this carry to the LSB of the sum.
(ii) If the above sum does not produce carry then take the (r-1)’s complement of the sum and put a negative sign in front.

Example 1: Subtract (84231)10 – (3162)10 by using (r-1)’s complement.

Solution: Here r=10, so (r-1)’s complement refers to 9’s complement.

Step I: Number of digits in minuend = 5
Number of digits in subtrahend= 4
Padding one 0 to subtrahend to make equal digits as given below,
84231 – 03162

Step II: 9’s complement of 03162 can be calculated as

Step III: Add Minuend with 9’s complement of subtrahend as shown below:

The carry produced by the above sum is added to the LSB of the result to get the final result. So,

84231 – 3162 = 81069

Example 2: Subtract (3162)10 – (84231)10 by using r’s complement.

Solution: Here r=10, so (r-1)’s complement refers to 9’s complement.

Step I: Number of digits in minuend = 4
Number of digits in subtrahend= 5
Padding one 0 to minuend to make equal digits as given below,
03162 – 84231

Step II : 10’s complement of 84231 can be calculated as

Step III: Add Minuend with 9’s complement of subtrahend as shown below:

John Wick: Chapter 4 Receives Critical Acclaim . Why Dwayne Johnson’s focus on Black Adam hurt the DCEU. Paris Jackson Stuns in Liquid Gold Dress at Fashion Trust Awards Hollywood. Trea Turner’s Five Home Runs In World Baseball Classic Ties South Korea’s Lee Seung-Yuops World Record CDC Warns Against A Life Threatening Fungal Infection ‘Candida Auris’.
John Wick: Chapter 4 Receives Critical Acclaim . Why Dwayne Johnson’s focus on Black Adam hurt the DCEU. Paris Jackson Stuns in Liquid Gold Dress at Fashion Trust Awards Hollywood. Trea Turner’s Five Home Runs In World Baseball Classic Ties South Korea’s Lee Seung-Yuops World Record CDC Warns Against A Life Threatening Fungal Infection ‘Candida Auris’.