Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store

2S Complement Addition Explained: Concepts & Practice

Reviewed by:
ffImage
hightlight icon
highlight icon
highlight icon
share icon
copy icon
SearchIcon

How to Solve 2S Complement Addition Problems Efficiently

Do you know something about the term 2s complement addition? If not, do not worry, as this article covers everything about addition using 2s complement. 2s complement examples are also given for understanding to better understand the given topic. Some practice problems, based on binary addition using 2s complement, along with the 2s complement of negative numbers, are assigned for getting a hold of the concepts. So, let's get started with the learning process.


How to Write Numbers in Binary Format?

To convert the number to binary format, we must divide it by 2 until the further division is impossible and then write the remainder in the reverse order to obtain the corresponding binary format of the number. For example, let's convert 122 to binary form. We start by dividing the number, 122 by 2, as shown in the table, and noting the remainder in reverse order, i.e. 111010.


Thus the binary representation of 122 is 111010.


Decimal

Quotient after division by 2

Remainder

122

61

0

61

30

1

30

15

0

15

7

1

7

3

1

3

1

1


How to write Numbers in 2s Complement?

To convert the binary format to a 2s complement, we must replace the 0s with 1s and 1s with 0s, then add 1 to the inversion to obtain the required conversion. For example, write 2s complement of 9, whose binary representation is given by 1001.


This is done by replacing the 0s with 1s and vice versa, i.e. 0110. Now adding 1 to the inversion to obtain 2s complement, i.e. 0111.


Thus the 2s complement of 9 is 0111.


What is Addition Using 2s Complement?

Addition using 2s complement is done by converting the given numbers to binary form and then to 2s complement. After obtaining the 2s complement of the numbers, adding them will represent their 2s complement addition. It is a way of adding two numbers by making use of the 2s complement.


Binary addition and subtraction


Binary addition and subtraction


This binary subtraction can be understood by 2’s complement method. We can’t subtract directly like addition.


Binary Addition Using 2s Complement

Here are some steps to carry out the binary addition using 2s complement:

  • Write the given numbers in binary form, if they are present in decimal form

  • Then write their corresponding 2s complement using the conversion of binary form to 2s complement

  • Now, carry out the addition of the obtained 2s complement, write the sum as 1 when adding 0 and 1 and write the sum as 0 when adding two 0s

  • When adding two 1s, you must write the sum as 0 and transfer the carry to the next term


For Example: Add 1010 and 0101 using 2s complement addition

Write the 2s complement of the numbers, i.e. 0110 and 1011 respectively. Now add their respective 2s complement, which would give the result 10001. Now, discard the carry and take two’s complement (1110 + 1 = 1111).


Sign Rules for 2s Complement Addition

  • Addition Using the 2s Complement of Positive Numbers

If both the given numbers in 2s complement addition are positive; then their result will always be a positive quantity.

If both numbers are positive, their 2’complement representation will be the same as its true (uncomplemented) form.

  • Addition Using the 2s Complement of Positive and Negative Numbers

If one number is positive and the other is negative in 2s complement addition, then the overall sign of their difference will depend on the sign of the bigger quantity, i.e. if a positive number has a greater magnitude, then the overall sign will be positive and if a negative number has a greater magnitude than the overall sign will be negative.

  • 2s Complement of Negative Numbers

If both the given numbers in 2s complement addition are negative, then the corresponding result of their addition will be negative.


2s Complement Solved Examples

Q 1. Find the 2s complement of given numbers, converted in binary form: 1011 and -0101.

Ans: For finding the 2s complement of given numbers, we are required to follow some steps:

  • Convert the given binary number to 2s complement by replacing 0s with 1s and 1s with 0s; finally adding 1 to the inversion, i.e. 2s complement of 1011 is 1011, and -0101 is 1011.

  • Now, we add both the complement numbers, 1011 and 1011, i.e.

1011 + 1011 = 10110

  • Here, it can be noted that the carry can be discarded.

Thus, the 2s complement of the given numbers is 0110.


Q 2. Add 8 + 5.

Ans: Steps to perform addition are given as

  • Write the binary form of the numbers 8 and 5, i.e. 1000 and 0101, respectively

  • Add both the numbers, i.e. 1000 and 0101, which equals 1101.

Thus, the result of addition is given by 1101.


Practice Problems

Q 1. Using addition with 2s complement, calculate the sum of 1101 and -1110.

Ans: -0001

Q 2. Add 0011 and -0101.

Ans: -0010


Q 3. Find the addition with 2s complement of a negative number, -8 and -5.

Ans: -1101


Summary

To wrap up here with the topic of addition using 2s complement. Reading this article, we got a clear understanding of our topic. In addition, an important operation used in mathematics can be easily found using the 2s complement. This writing has discussed the steps required to perform the binary addition using a 2s complement. Some 2s complement examples are also given to clarify the concepts deeply. I hope you find it useful to read the article. Feel free to put your doubts in the comments.

FAQs on 2S Complement Addition Explained: Concepts & Practice

1. What is 2's complement in the context of binary numbers?

In digital computing, 2's complement is a mathematical operation used to represent signed (positive or negative) integers. It is the most common method for handling negative numbers in computer systems because it makes arithmetic operations like addition and subtraction straightforward. In this system, the Most Significant Bit (MSB), or the leftmost bit, indicates the sign: '0' for a positive number and '1' for a negative number.

2. What is the step-by-step process for finding the 2's complement of a binary number?

To find the 2's complement of any binary number, you can follow a simple two-step process:

  • Step 1: First, find the 1's complement of the number by inverting all the bits. This means changing every '0' to a '1' and every '1' to a '0'.
  • Step 2: Add 1 to the 1's complement result. The final value is the 2's complement.
  • For example, for the binary number 10110, its 1's complement is 01001. Adding 1 gives 01010, which is its 2's complement.

3. How is addition performed using the 2's complement method? Explain with an example.

To perform addition using 2's complement, you simply add the two binary numbers, including their sign bits. If there is a final carry bit beyond the Most Significant Bit, it is discarded. For example, to add +7 (0111) and -3 (represented as 1101 in 2's complement), you add them directly:

0111 (+7)
+ 1101 (-3)
-------
10100

Since we are using 4-bit numbers, the 5th bit (the carry) is discarded. The result is 0100, which is the binary representation for +4. This demonstrates how 2's complement allows for correct addition of positive and negative numbers.

4. Why is 2's complement preferred over 1's complement for representing signed numbers in computers?

The 2's complement system is preferred over 1's complement for two main reasons:

  • Unambiguous Zero: 2's complement has only one representation for zero (e.g., 0000 in 4-bit). In contrast, 1's complement has two representations for zero: a positive zero (+0 as 0000) and a negative zero (–0 as 1111), which complicates arithmetic logic.
  • Simpler Arithmetic: Arithmetic operations are more direct in 2's complement. For addition, no special correction like the 'end-around carry' required in 1's complement is needed, which simplifies the hardware design of the computer's Arithmetic Logic Unit (ALU).

5. How does 2's complement simplify the process of binary subtraction?

2's complement brilliantly transforms subtraction into an addition problem. To compute 'A - B', a computer finds the 2's complement of B to get '-B', and then adds it to A (i.e., A + (-B)). This is highly efficient because the same electronic circuits (adders) in the Arithmetic Logic Unit (ALU) can be used for both addition and subtraction. This eliminates the need for separate, more complex subtraction hardware, saving cost and space on the microprocessor.

6. What is an overflow error in 2's complement addition, and how can it be detected?

An overflow error is a condition that occurs when the result of an arithmetic operation is too large to be represented by the available number of bits. In 2's complement addition, an overflow can be detected by checking the signs of the operands and the result. An overflow has occurred if:

  • The sum of two positive numbers results in a negative number.
  • The sum of two negative numbers results in a positive number.

Overflow cannot happen if you add a positive and a negative number together. It is a critical error to detect in computing to ensure the accuracy of calculations.

7. What are the key real-world applications of 2's complement addition?

The primary application of 2's complement addition is within the core of every digital computer and processor. It is fundamental to how the Arithmetic Logic Unit (ALU) performs arithmetic. Specific applications include:

  • Processor Arithmetic: Performing both addition and subtraction of signed integers using the same simple adder circuit.
  • System Clocks & Timers: Used in countdown timers where values decrement below zero.
  • Calculating Memory Addresses: Used in some architectures for calculating relative memory offsets, which can be positive or negative.