1. Home
  2. Docs
  3. Digital Logic
  4. Binary Systems
  5. 1`s and 2`s complement

1`s and 2`s complement

Explore 1’s and 2’s complement in digital logic, including definitions, calculation methods, applications in subtraction, signed numbers, and binary arithmetic. Learn how to use complements efficiently in digital systems and computing.


Introduction to 1’s and 2’s Complement

In digital systems and computer arithmetic, representing negative numbers and performing subtraction efficiently is essential. 1’s and 2’s complement methods are foundational techniques used in binary arithmetic to simplify calculations and design arithmetic units in computers.

Understanding these complements is crucial for students and engineers working with digital electronics, computer architecture, and embedded systems.


What is a Complement in Binary Systems?

A complement is a binary number that, when added to the original number, yields a predetermined result:

  • 1’s Complement: The inversion of all bits (0 → 1, 1 → 0).
  • 2’s Complement: The 1’s complement + 1, giving a number that represents the negative value in binary arithmetic.

Purpose: Complements allow subtraction to be performed as addition, reducing hardware complexity in digital circuits and enabling signed number representation.


Note: The 1`s complement and the 2`s complement of a binary number are important because they permit the representation of negative numbers.

∴ Finding the 1`s complement:-

The 1`s complement of a binary number is found by changing all 1s to 0s and all 0s to 1s.

How to find 1`s complement of binary number.

Screenshot 2023 09 14 151753

1`s complement using NOT gate.

image 16
Q). Find the 1`s complement of (10110)2
solution:-

1`s complements = 01001

Finding the 2`s complement

The 2`s complement of a binary number is found by adding 1 to the LSB of the 1`s complement.

2`s complement = (1`s complement) + 1

How find 2`s complement of binary number?

Screenshot 2023 09 14 154229

Alternative way to find direct 2`s complement

  • Start at the right with the LSB and write the bits as they are up to and including the first 1.
  • Yake the 1`s complement of the remaining bits
Screenshot 2023 09 14 155437

In the above solution, we should write the same binary digits from right to left until we found 1, after that change the remaining bits into 1`s complement as shown above.

Screenshot 2023 09 14 160020

→ Subtraction using 1`s complement

Step 1:- Take 1`s complement of subtrahend

Step 2:- Add 1`s complement of subtrahend with minuend

• Step 3:- If got a carry, add the carry to its LSB. Else take 1’s complement of the result and put negative sign

Screenshot 2023 09 15 170253
Screenshot 2023 09 15 171533
Screenshot 2023 09 15 171554

Advantages of Using 1’s and 2’s Complement

  • Simplifies binary subtraction.
  • Eliminates manual borrowing in subtraction.
  • Enables representation of signed numbers in binary.
  • Reduces hardware complexity in digital circuits.
  • 2’s complement avoids issues like two zeros problem present in 1’s complement.

Applications of 1’s and 2’s Complement

  1. Signed Binary Arithmetic:
    • 2’s complement is standard for negative number representation.
  2. ALU Operations:
    • Simplifies subtraction by addition in arithmetic units.
  3. Digital Computers and Processors:
    • Used in CPU registers and binary arithmetic circuits.
  4. Embedded Systems:
    • Reduces computation time and hardware complexity for signed arithmetic.
  5. Teaching & Learning:
    • Essential for understanding binary arithmetic and digital logic design.

Summary Table: 1’s vs 2’s Complement

Feature1’s Complement2’s Complement
DefinitionInvert all bits1’s complement + 1
Representation of Negative NumbersSigned magnitude with end-around carryStandard signed binary
Subtraction MethodEnd-around carry requiredDirect subtraction via addition
Example1010 → 01011010 → 0101 + 1 = 0110
AdvantageEasy to computeEliminates double zero and simplifies subtraction

Conclusion

1’s and 2’s complement are essential techniques in binary arithmetic and digital logic design. While 1’s complement is useful for learning and basic systems, 2’s complement is the preferred method in modern computing for signed number representation and subtraction. Understanding these concepts ensures a solid foundation in computer arithmetic, digital electronics, and processor design.

Call to Action:
Practice computing 1’s and 2’s complement for multi-bit binary numbers and implement binary subtraction problems to strengthen your digital logic and arithmetic skills.


Frequently Asked Questions (FAQ)

1. What is the difference between 1’s and 2’s complement?
1’s complement inverts all bits; 2’s complement adds 1 to the 1’s complement to represent negative numbers efficiently.

2. Why is 2’s complement preferred over 1’s complement?
Because it eliminates the double zero problem and allows subtraction as addition without end-around carry.

3. How do you perform binary subtraction using 2’s complement?
Take the 2’s complement of the subtrahend and add it to the minuend. Ignore overflow beyond the word length.

4. Are complements used in decimal arithmetic?
Yes, the 9’s and 10’s complements are used in decimal arithmetic, similar to 1’s and 2’s complement in binary.

5. Where are 1’s and 2’s complement applied?
They are used in digital computers, arithmetic logic units (ALUs), microprocessors, embedded systems, and teaching arithmetic operations.

Tags , , , , , , , , ,

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *