Any Binary Number can be of two types. They can be either signed or unsigned. Here we are going to find the 1’s and 2’s complement of these two types of binary numbers.

1’s Complement of Unsigned Binary Numbers:

There is a simple way to find the 1’s complement of any unsigned binary numbers. It is formed by changing 1’s into 0’s and 0’s into 1’s. Let’s take some examples and find their complements.

Question 1: Find the 1’s complement of 1011001?

Solution: 1’s complement of 1011001 is obtained by replacing all 1s with 0s and all 0s with 1. Therefore the 1’s complement of 1011001 will be 0100110.

Question 2: Find the 1’s complement of 0000111?

Solution: 1’s complement of 0000111 is 1111000.

Question 3: Find the 1’s complement of 110.101?

Solution: 1’s complement of 110.101 is 001.010.

1’s Complement of Signed Binary Numbers:

Signed numbers can be of two types. Either they can be positive or negative. In the binary number system, a positive sign is represented by 0 while a negative is denoted by 1.

If a signed binary number is given and we want to find the 1’s complement of it then first we have to replace the sign of that number by either 0 for plus or 1 for minus then we will have to complement each bit of that binary number except the sign bit.

Question 4: Find 1’s complement of + 000111?

Solution: First we will replace the positive sign of the given number by 0 and then will complement each bit of the given number except the sign bit to get its 1’s complement. Now applying the above rules the representation of + 000111 will be 0 000111. Hence 1’s complement of 0 000111 is 0 111000.

Question 5: Find 1’s complement of – 00111?

Solution: Representation of – 00111 is 1 00111 and its 1’s complement is 1 11000.

If the given number is not in the binary number system then we have to convert it into the binary number system to get its 1’s complement. For example

Question 6: Find 1’s complement of + 5 which is stored in a four-bit register?

Solution: The binary representation of + 5 is 0 101. Here, the most significant bit 0 represents the plus sign, and the rest of the three bits represent 5. Therefore, 1’s complement of + 5 is 0 010, where 010 is the 1’s complement of 101, and the Most Significant Bit 0 represents the plus sign. Let us take another example.

Question 7: Find 1’s complement of – 14 which is stored in an eight-bit register?

Solution: Binary representation of – 14 in an eight-bit register is 1 0001110. The Most Significant Bit 1 represents the minus sign, and the rest of the seven bits 0001110 represent 14. Now, we can find the 1’s complement of – 14 by applying the above rule. The 1’s complement of – 14 is 1 1110001.

2’s Complement of Unsigned Binary Numbers:

The 2’s complement of an unsigned binary number is formed by changing 1’s into 0’s and 0’s into 1’s or taking the 1’s complement and then adding 1 to the least significant bit. For example

Question 8: Find the 2’s complement of 1011001?

Solution: First we will change all 1’s into 0’s and all 0’s into 1’s. So by applying this rule, 1011001 will become 0100110. Now, we will add 1 to the least significant bit. Thus 0100110 + 1 = 0100111. Therefore, the required answer is 0100111.

Question 9: Find the 2’s complement of 101101?

Solution: To find the 2’s complement of the binary number first we have to find the 1’s complement of this binary number and then add 1 to the left most bit of the binary number. The 1’s complement of 101101 is 010010. Now, to get the 2’s complement of 101101 we will add 1 to the LSB of 010010. Thus, 010010 + 1 = 010011. Hence, the required answer is 010011.

Question10: Find the 2’s complement of 110.101?

Solution: 1’s complement of 110.101 is 001.010. Now, 001.010 + 1.000 = 010.010. Therefore, the 2’s complement is 010.010.

2’s Complement of Signed Binary Numbers:

If a signed decimal number is given and we want to find out the 2’s complement of that number then first we have to replace the sign of that number by either 0 for plus or 1 for minus and then convert the given number into the binary system. To find 2’s complement of that number we have to first find 1’s complement of the whole digits excluding sign bit and have to add 1 to the least significant bit. For example

Question 11: Find 2’s complement of + 7 which is stored in a four-bit register?

Solution: Binary representation of + 7 is 0 111. Here, the most significant bit 0 represents the plus sign, and the rest of the three bits represent 7. Now, 1’s complement of + 7 is 0 000, where 000 is the 1’s complement of 111 and Most Significant Bit 0 represents the plus sign. Finally, we will add 1 to the LSB. There 2’s complement of + 7 is 1 000 + 1 = 1 001.

Question 12: Find 2’s complement of + 000110?

Solution: Representation of + 000111 is 0 000110. Now, 1’s complement of 0 000111 is 0 111001. Hence, 2’s complement is 0 111001 + 1 = 0 111010.

Q13: Find 2’s complement of – 14 which is stored in an eight-bit register?

Solution: Binary representation of – 14 in an eight-bit register is 1 0001110. The Most Significant Bit 1 represents the minus sign, and the rest of the seven bits 0001110 represent 14. Now, 1’s complement of – 14 is 1 1110001. Therefore, 2’s complement is 1 1110001 + 1 = 1 1110010.

Question 14: Find 2’s complement of – 00111?

Solution: Representation of – 00111 is 1 00111 and its 1’s complement is 1 11000. Therefore 2’s complement of 1 11000 is 1 11000 + 1 = 1 11001.