1’s and 2’s Complement Form in Binary Number System

How to Take Diminished Radix (1’s) and Radix (2’s) Complement in Binary Number System?

  1. For 1’s Complement:
    • Invert all digits (same as subtract each digit from 1).
    • This gives the 1’s complement.
  2. For 2’s Complement:
    • Compute the 1’s complement.
    • Add 1 to it to get the 2’s complement.

Available Space for the 1’s and 2’s Complement in Binary Number System

In the binary number system, with a base of 2, the 1’s and 2’s complement methods are key for representing a number’s complement, which is crucial for operations like subtraction in digital arithmetic. For a number with \(\mathsf{n}\) digits, the 1’s complement is calculated using the maximum value in that digit space, which is \(\mathsf{2^n-1}\) (e.g., 7 (\(\mathsf{111_B}\)) for three digits). The 2’s complement uses \(\mathsf{2^n}\), representing the full space for n digits (e.g., 8 (\(\mathsf{1000_B}\)) for three digits). These values serve as the modulus or “available space” for computing complements. The way these values change with different numbers of digits (n) can be shown in a table, making it easier to understand how complement-based arithmetic works in the binary system.

this image shows the table of available number space variation with the number of digits in a number, in the context of 1's and 2's complement

Complement of a Complement Returns the Original Number

If you take the radix complement (r’s complement) of a number, and apply the radix complement to the result; OR take diminished radix complement ((r – 1)’s complement) of a number and then apply the diminished radix to the result, you will recover the original number.

This works because:

  • The r’s complement of a number, A, is defined as: \(\mathsf{r^n-A}\) and the r’s complement of the complement returns \(\mathsf{r^n-(r^n-A)=A}\).
  • The (r – 1)’s complement is \(\mathsf{r^n-1-A}\) and the (r-1)’s complement of this complement returns \(\mathsf{r^n-1-(r^n-1-A)=A}\).

So when you apply these operations in sequence, the transformations effectively cancel each other out, returning you to the original value.

Example: Binary System (Base 2)

Let’s take the number \(\mathsf{1010_B}\):

  • 2’s complement of \(\mathsf{1010_B}\): \(\mathsf{1111-1010+1=0110}\).
  • 2’s complement of \(\mathsf{0110_B}\): \(\mathsf{1111-0110+1=1010\rightarrow{}}\)original number restored.
  • 1’s complement of \(\mathsf{1010_B}\): \(\mathsf{1111-1010=0101}\).
  • 1’s complement of \(\mathsf{0101_B}\): \(\mathsf{1111-0101=1010\rightarrow{}}\)original number restored.

Practical Mechanism for Taking 1’s and 2’s Complement

In the binary number system, which uses only the digits 0 and 1, calculating the 1’s and 2’s complements is straightforward and can be done using two distinct approaches: one for hardware circuits and another for direct mathematical computation.

Method 1: Circuit-Based (Logical Inversion)

In digital systems, the 1’s complement of a binary number is obtained by passing each bit through a NOT gate, which inverts the bits:

  • 0 becomes 1
  • 1 becomes 0

To compute the 2’s complement, simply:

  • Invert all bits (1’s complement)
  • Add 1 to the result using a binary adder
this image shows the circuit for generating the 1's and 2's complement of the binary numbers

This is the standard mechanism used in hardware for signed number representation and subtraction via addition. A 4-bit 1’s and 2’s complement generator circuit is shown in the figure.

Method 2: Mathematical Shortcut (Bitwise Traversal)

There’s also a direct method to compute the 1’s complement:

  1. Invert all remaining bits.
this image shows the direct method for the calculation of 1's complement
Direct Method for Calculating 1’s Complement

There’s also a direct method to compute the 2’s complement without explicitly adding 1:

  1. Start from the Least Significant Bit (LSB) and move leftward.
  2. Leave all bits unchanged until you encounter the first ‘1’.
  3. From that point onward (toward the Most Significant Bit), invert all remaining bits.
this image shows the direct method for the calculation of 2's complement
Direct Method for Calculating 2’s Complement

This technique works because adding 1 to the 1’s complement flips all trailing zeros until the first 1 is encountered — which remains unchanged — and all bits to the left are inverted.

Example 1: Find 1’s and 2’s complement of 0.

For a single-digit number like 0 in the binary system, the available space for the 1’s complement is 1 (equivalent to \(\mathsf{2^1-1}\)), and for the 2’s complement, it is 2 (\(\mathsf{2^1}\)). Since the number 0 occupies no space, the remaining space directly provides the complements: 1 for the 1’s complement and \(\mathsf{2}\) or \(\mathsf{10_B}\) for the 2’s complement. However, since we are typically dealing with fixed-width systems, which means that the number of output bits remain same as the input bits, we drop the carry and keep the least significant bits. In this case, we drop the 1 and the 2’s complement of 0 is 0. These calculations are illustrated in the accompanying figure.

this image shows the calculation of 1's and 2's complement of the binary number 0

Example 2: Find 1’s and 2’s complement of 1.

For a single-digit number like 1 in the binary system, the available space for the 1’s complement is 1 (equivalent to \(\mathsf{2^1-1}\)), and for the 2’s complement, it is 2 (\(\mathsf{2^1}\)). To find the complements, subtract 1 from these values: the 1’s complement is 1 – 1 = 0, and the 2’s complement is 2 – 1 = 1. These calculations are illustrated in the accompanying figure.

this image shows the calculation of 1's and 2's complement of the binary number 1

Example 3: Find 1’s and 2’s complement of 10.

For a two-digit number like \(\mathsf{10_B}\) in the binary system, the available space for the 1’s complement is 3 (equivalent to \(\mathsf{2^2-1}\)), and for the 2’s complement, it is 4 (\(\mathsf{2^2}\)). To find the complements, subtract \(\mathsf{10_B}\) from these values: the 1’s complement is \(\mathsf{11_B-10_B=01_B(3-2=1)}\), and the 2’s complement is \(\mathsf{100_B-10_B=10_B(4-2=2)}\). These calculations are illustrated in the accompanying figure.

this image shows the calculation of 1's and 2's complement of the binary number 10

Example 4: Find 1’s and 2’s complement of 1101.

For a four-digit number like \(\mathsf{1101}\) in the binary system, the available space for the 1’s complement is \(\mathsf{15=1111_B}\) (equivalent to \(\mathsf{2^4-1}\)), and for the 2’s complement, it is \(\mathsf{16=1\:0000_B}\) (\(\mathsf{2^4}\)). To find the complements, subtract \(\mathsf{1101_B}\) from these values: the 1’s complement is \(\mathsf{1111_B-1101_B=0010_B (15-13=2)}\), and the 2’s complement is \(\mathsf{10000_B-1101_B=0011_B (16-13=3)}\). These calculations are illustrated in the accompanying figure.

this image shows the calculation of 1's and 2's complement of the binary number 1101

Example 5: Find 1’s and 2’s complement of 1000 0000 by direct method.

The direct method to get the 1’s complement is to invert all digits, which gives us \(\mathsf{0111\:1111_B}\). For the 2’s complement, we need to preserve the bits until the first 1 is encountered and complement all the bits after it. Since, the first 1 is actually the MSB of the given number, we don’t need to change any bit at all for this input. Hence, the 2’s complement is \(\mathsf{1000\:0000}\) which is the same as the original number. These steps are illustrated in the accompanying figure.

this image shows the calculation of 1's and 2's complement of the binary number 1000 0000 by using direct method