Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 3: 1's & 2's Complement Methods

Lesson 28 of 34 in the free Fundamentals of IT & Computers notes on Siksha Sarovar, written by Rohit Jangra.

Unit III — 1's & 2's Complement Methods

Complement methods are used to represent negative numbers in binary and to perform subtraction using addition circuits, simplifying CPU hardware design.

---

Why Complements?

Computers represent negative numbers using complements rather than a separate sign. This allows the same addition circuits to handle both addition and subtraction.

---

1's Complement

Definition: The 1's complement of a binary number is obtained by inverting every bit (0→1, 1→0).

Example:

  • Number: (10110011)₂
  • 1's Complement: (01001100)₂

Another Example:

  • Number: (00001010)₂ = 10
  • 1's Complement: (11110101)₂ = −10 in 1's complement notation

Properties:

  • Two representations of zero: 00000000 (+0) and 11111111 (−0).
  • Range for 8-bit: −127 to +127.

---

2's Complement

Definition: The 2's complement is the 1's complement plus 1.

Method 1:

  1. Find 1's complement.
  2. Add 1 to the result.

Example: Find 2's complement of (10110011)₂

  • 1's Complement: 01001100
  • Add 1: 01001100 + 1 = (01001101)₂

Method 2 (Shortcut):

  • Starting from the rightmost bit, copy all bits up to and including the first 1.
  • Invert all remaining bits to the left.

Example: 2's complement of (10110000)₂

  • Copy from right up to first 1: ...10000 → keep 10000
  • Invert remaining: 101 → 010
  • Result: (01010000)₂

---

Subtraction Using 1's Complement

Rule: A − B = A + (1's complement of B); if there is an end-around carry, add it to the result.

Example: Subtract (1011)₂ − (0101)₂ = (0110)₂ ? (11 − 5 = 6)

  1. 1's complement of 0101 = 1010
  2. Add: 1011 + 1010 = 1 0101 (carry out = 1)
  3. End-around carry: 0101 + 1 = (0110)₂ = 6 ✓

---

Subtraction Using 2's Complement

Rule: A − B = A + (2's complement of B); discard any carry out.

Example: Subtract (1011)₂ − (0101)₂ (11 − 5 = 6)

  1. 2's complement of 0101 = 1010 + 1 = 1011
  2. Add: 1011 + 1011 = 1 0110 (carry out = 1, discard it)
  3. Result: (0110)₂ = 6 ✓

---

Example 2: Subtract (01000)₂ − (01011)₂ (8 − 11 = −3)

  1. 2's complement of 01011 = 10100 + 1 = 10101
  2. Add: 01000 + 10101 = 11101
  3. No carry out → result is negative; find 2's complement of 11101: 00010+1 = 00011 = 3
  4. Result: −3

---

Comparison

Feature1's Complement2's Complement
MethodInvert all bitsInvert all bits + 1
Zero representationsTwo (+0 and −0)One (unique zero)
Subtraction carryEnd-around carry addedCarry simply discarded
Used inOlder systemsAll modern computers
Key Takeaway: 2's complement is the universal standard for representing negative integers in modern CPUs. It eliminates the double-zero problem of 1's complement and allows subtraction via addition with a simple carry discard. Master both methods with worked examples for the exam.