Binary

# What is Two’s Complement? – And its Examples | How To Convert Binary Number Into 2’s Complement

The binary number is most popular in digital electronics. In binary number is has only two bits “1” and “0” i.e. “high” and “low” Represented by any device that only 2 operating states or possible conditions. The binary number system has two types of complement that are “One’s complement and Two’s complement”. The one’s complement is obtained by inversion binary numbers 0 to 1 and 1 to 0. The example of one’s complement is 110011 is 001100. But in two’s complement of any binary number is, firstly we convert the binary number to 1’s complement and then we add 1 in least significant bit in 1’s complement. For example of 2’s complement binary number 110011 is 001100 +1 = 001101.

The logic circuit of 2’s complement are designed by using AND, OR and NOT gates. The logic circuit of two’s complement of five bit binary number is as follows:

Two’s Complement Table

 Binary Number 1’s Complement 2’s complement 0000 1111 1111 +1 = 0000 0001 1110 1110 +1 = 1111 0010 1101 1101 +1 = 1110 0011 1100 1100 +1 = 1101 0100 1011 1011 +1 = 1100 0101 1010 1010+1 = 1011 0110 1001 1001+1 = 1010 0111 1000 1000+1 = 1001 1000 0111 0111+1 = 1000 1001 0110 0110+1 = 0111 1010 0101 0101+1 = 0110 1011 0100 0100+1 = 0101 1100 0011 0011+1 = 0100 1101 0010 0010+1 = 0011 1110 0001 0001+1 = 0010 1111 0000 0000+1 = 0001

## Two’s Complement of a Binary Number

There is simple method to convert a binary number to Two’s complement. For finding the Two’s complement and any binary number, simply we convert the binary number into 1’s complement and add 1 to the least significant bit (LSB) of the 1’s complement. For good understanding of two’s complemented we discuss the four bit two’s complement examples.

Eg – Obtained the 2’s complement of binary bits 10101110.

First we convert binary bit 10101110 into 1’s complement is 01010001. Then add 1 to the least significant bit of the 1’s complement 01010001+1= 01010010 (2’s complement)

Eg − Obtained the 2’s complement of point binary bits 10001.001.

First we convert binary bit 10001.001 into 1’s complement is 01110.110. Then add 1 to the least significant bit of the 1’s complement 01110.110 +1= 01110.111 (2’s complement)

### Two’s Complementation in Signed Binary number Representation

The use of behind of 2’s complement is that to perform the subtraction operation of two binary bits in digital computer. The computer only understands the binary number, it doesn’t understand the negative number is binary number system, but it is absolutely necessary to represent a negative number using binary number. The representation of sign binary number is done by 2’s complement.

For example represent the -5 and +5.

+5 are represented as using sign magnitude method but the representation of -5 using the following steps.

Step 1 – Firstly +5 converted in binary using sign magnitude method. The +5 is 0 0101.

Step 1 – Take 2’s complement of 0 0101 and the result of 2’s complement is 1 1011. The most significant bit of 2’s complement is 1 which indicates that number is negative. In the negative number, the MSB is always 1.

The advantage of 2’s complement is that the 0 has only one representation for -0 and +0 is always consider +0 in 2’s complement representation.  The 2’s complement is most popular as 1’s complement because it has unique or unambiguous representation.

Now let’s see the some arithmetic operation of 2’s complement.

### Subtractions by Two’s Complement

There are some following steps for the subtraction of two binary number using 2’s complement.

• Step 1 – Take 2’s complement of the subtrahend
• Step 2 – Add with minuend
• If the result not produces any carry then we take the 2’s complement of the result and it will be negative.
• If the result produces a carry bit 1, then we discard the carry bit and after this the result will be positive number.

Note that subtrahend is numbers that are use to subtracted from another number, i.e. minuend. And also note the adding end-around-carry-bit is only occurs in 1’s complement arithmetic operations but not 2’s complement arithmetic operations.

#### Case-1: When Carry bit 1,

Example − Evaluate 10101 – 00101

Firstly we take the 2’s complement of subtrahend 00101, which will be 11011, and then we perform the addition operation. So, 10101 + 11011 = 1 10000. Since this result has carry bit so we discard the carry bit and the final result will be 10000 will be positive number.

#### Case-2: When no Carry bit

Example − Evaluate 11001 – 11100

Firstly we take the 2’s complement of subtrahend 11110, which will be 00100, and then we perform the addition operation. So, 11001 + 00100 = 11101. Since in this operation there is no generation of any carry bit, so we take the 2’s complement of 11101 is 00011. 00011 is a negative number, which is the answer. Similarly, we can subtract two mixed (with fractional part) binary numbers.

### Additions by 2’s Complement −

There are three different case of addition of 2’s complement which is explained below:

#### Case-1 − Addition of positive and negative number when positive number has greater than negative number:

When the positive number is greater than negative number, then we take the 2’s complement of negative number, and perform the addition operation. The carry bit is discarded and the result will be positive number, i.e., +0001.

Take the 2’s complement of 1101, which is 0010 and adding 1110 + 0010 = 1 0001. The carry bit 1 discard and this result will be positive number, i.e., +0001.

#### Case-2 − Addition of positive and negative number when negative number has greater than positive number:

When the negative number has grater then positive number, we firstly convert the negative number into 2’s complement and we perform the addition number with positive number. So there will be no any end around carry bit, so we convert the result into 2’s complement and this is the final result which is negative.

In this example there are negative number is -12 which is greater than the positive number. So, we convert the negative number 01100 into 2’s complement, which is 10100 and add with positive number i.e.  01010+10100=11110. After this addition operation we will convert again this result into 2’s complement, which will be 00010 and this will be negative number, i.e., -00010, which is the answer.

#### Case-3 – Addition operation of two negative numbers −

In the addition of two negative numbers, we convert both numbers into 2’s complement. Since there will be always end around carry, so we dropped the carry bit and again take the 2’s complement of previous result, and it will be result of addition of two negative numbers.

Example − add -01010 and -00101

We take the 2’s complement of 01010 and 00101 and this will be 10110 & 11011 respectively. After this, we add the10110+11011 =1 10001.  In this result there is a carry bit so we dropped it. And again we convert 2’s complement of pervious result. And it is a final result which is negative number.

Note- The difficulty level of 2’s complement operation is low than 1’s complement, because there is no extra addition operation of end-around-carry-bit.

Here, the two’s complement are mostly use in representation of negative number and subtraction operation. There are some advantages of two’s complement which are given below-

1. It is use for representation of negative numbers
2. It is use for subtraction for two binary numbers
3. It is easy to accomplish with larger circuit.
4. There is no need operation on end around carry bit as like as in one’s complement.

## “If this tutorial increases your knowledge, you can share with other persons.”

#### How do you calculate Two’s complement?

To get the Two’s complement of any number, firstly we convent in One’s complement of given binary number after this we will add 1 to lest significant bit. For example Two’s complement of binary number 10010 is convert into One’s which is 01101 and then add 1 in LSB 01101 + 1 = 01110.

#### What is 2’s complement with example?

The example of 2’s complement of “01000” is “11000”. To find out of 2’s complement we convent the given binary number into 1’s complement and then we add 1 in least significant bit.

#### What is the 2s complement of 33?

The 2’s complement of the number – 33 is (1101 1111)2.

#### What is the decimal number 50 in 2’s complement?

Number of Bits: Enter decimal value: Enter a decimal number between -128 to 127.

Two’s complement Table.

 2’s complement of -15 00001111 2’s complement of -45 00101101 2’s complement of -19 00010011 2’s complement of – 50 i 00110010

#### What is the Two’s complement of 1000?

-8

Interestingly, if you take the Two’s complement of 1000, you get 1000 Remember 1000 is -8, and not +8, since the MSB is 1 . in 2’s complement the -0 and +0 has unique representation which is 0000 but in 1’s complement “0” has two representation.

#### What is the two’s complement of 17?

The 2’s complement of -17 is (1110 1111).

#### How to representation of Two’s complement using 8 bits?

In Two’s complement notation of positive number is same as ordinary binary representation. In Two’s complement 8-bit number can only represent positive integers that starts from 0 to 127 (01111111), the region behind is that the negative number representation use binary “1” in most significant bit which is not possible because the total bit becomes “9”.

Click to comment

### Most Popular

knowelectronic Website | The Best Blog to Learn Basic Electronics Tutorial for Beginners. Here you can learn Basic Electronics in simple and easy steps - from basic to advanced electronics. All the free online course include – Examples, Video, PDF and Electronics Books Study Materials, Analog Electronics, Digital Electronics, Printed Circuit Board (PCB), Soldering, Electricity, ESD, Electronic Components like Semiconductor, Resistor, Capacitor, Inductor, Transformers, Diodes, Junction, Transistors, JFET, MOSFET, Circuit Diagram etc. This Best and Free Online Basic Electronics Tutorial, Guide, Course is useful for anyone interested in Electrical and Electronics, Engineering Students and Teachers, Electronics Manufacturing Companies. | © http://knowelectronic.com | All Rights Reserved