DE Notes
Complete guide to 1
Complements are used in digital systems to simplify subtraction operations and represent negative numbers. Instead of building separate subtractor circuits, computers use complement arithmetic to perform subtraction using addition hardware.
Types of Complements
For a number system with base r (radix), there are two types:
| Complement Type | Formula | Binary Name |
|---|---|---|
| (r-1)'s complement | rⁿ - 1 - N | 1's complement |
| r's complement | rⁿ - N | 2's complement |
Where n = number of digits, N = the given number.
1 0 0 1 1 ← Carry out = 1
End-around carry: 0011 + 1 = 0100 = 4₁₀ ✓
A = 3 = 0011 B = 7 = 0111 1's complement of B = 1000
0 0 1 1 + 1 0 0 0
1 0 1 1 ← No carry out (result is negative)
1's complement of 1011 = 0100 = 4 Result = -4₁₀ ✓
| - **Method 1** | Find 1's complement, then add 1 |
| - **Method 2** | Starting from the right, keep all bits up to and including the first 1, then flip all remaining bits |
| ### Method 1 | Invert and Add 1 |
Original: 1 0 1 1 0 0 1's Complement: 0 1 0 0 1 1 Add 1: + 0 0 0 0 0 1
2's Complement: 0 1 0 1 0 0
Original: 1 0 1 1 0 0 ↑ Keep from right until first 1: ...0 0 Flip the rest: 0 1 0 1 0 0
| 1. **Single zero** | Only 0000...0 represents zero (no -0 problem) |
| 2. **Range** (n bits) | -2ⁿ⁻¹ to +(2ⁿ⁻¹ - 1) |
| 3. **Asymmetric range** | One extra negative number |
| 3. If carry out | discard carry, result is positive |
| 4. If no carry | result is negative, take 2's complement |
| **Example | 12 - 5 (using 5 bits)** |
A = 12 = 01100 B = 5 = 00101 2's complement of B = 11011
0 1 1 0 0 + 1 1 0 1 1
1 0 0 1 1 1 ← Carry out (discard)
Result = 00111 = 7₁₀ ✓
A = 5 = 00101 B = 12 = 01100 2's complement of B = 10100
0 0 1 0 1 + 1 0 1 0 0
1 1 0 0 1 ← No carry (negative)
2's complement of 11001 = 00111 = 7 Result = -7₁₀ ✓
9's complement of 3456 = 9999 - 3456 = 6543 9's complement of 0870 = 9999 - 0870 = 9129
10's complement of 3456 = 6543 + 1 = 6544 10's complement of 2500 = 7499 + 1 = 7500
┌─────────────────────┐ B₃ ──────►│ │ B₂ ──────►│ XOR Gates │──► To Adder B₁ ──────►│ (Controlled │ B₀ ──────►│ Inverter) │ │ │ SUB ──────►│ Control Signal │──► Carry-In └─────────────────────┘
When SUB = 0: B passes unchanged, Cin = 0 (Addition) When SUB = 1: B is inverted, Cin = 1 (2's complement subtraction)
| Feature | 1's Complement | 2's Complement |
|---|---|---|
| Method | Flip all bits | Flip + add 1 |
| Zero representations | Two (+0, -0) | One |
| Range (n bits) | -(2ⁿ⁻¹-1) to +(2ⁿ⁻¹-1) | -2ⁿ⁻¹ to +(2ⁿ⁻¹-1) |
| Subtraction carry | End-around carry needed | Discard carry |
| Hardware | Slightly complex | Simpler (preferred) |
| Modern usage | Rare (checksums) | Universal |
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for 1.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Digital Electronics topic.
Search Terms
digital-electronics, digital electronics, digital, electronics, number, systems, complements
Related Digital Electronics Topics