Binary Subtraction Using Two's Complement
Binary subtraction can be carried out with classic bit‑by‑bit borrowing, but an even simpler approach is to use two’s complement arithmetic. By converting the subtrahend to its negative binary form and then adding, the operation reduces to a single binary addition.
Two’s complement lets us encode negative numbers in the same bit width as positive ones by using a leading “negative‑weight” bit. When we add a positive number to a negative number, the most significant bit of the negative operand behaves as a negative weight, effectively performing subtraction.
Example 1: 710 − 510
Represent each value in two’s complement using three data bits plus one negative‑weight bit:
positive seven = 0111₂ negative five = 1011₂
Now add them:
. 1111 ← Carry bits . 0111 . + 1011 . ------ . 10010 . | . Discard the overflow bit . Result = 0010₂
The overflow bit is discarded because the leftmost position represents a negative weight (−8). The final 4‑bit pattern 0010₂ equals the decimal value 2, confirming 7 − 5 = 2.
Example 2: 1810 + (−25)10
First determine the required bit width. The largest magnitude in the operation is 25, which needs five bits; add one more for the negative‑weight bit, giving six bits in total.
Represent +25 and its two’s complement:
+2510 = 011001₂ (six bits) One’s complement of 11001₂ = 100110₂ Add 1 → Two’s complement = 100111₂ −2510 = 100111₂
Positive 18 is written as:
1810 = 010010₂
Adding the two numbers:
. 11 ← Carry bits . 100111 . + 010010 . ------ . 111001
No overflow occurs, so the result 111001₂ remains. The most significant bit is 1, indicating a negative value in two’s complement. Converting back to decimal:
(1 × −32) + (1 × 16) + (1 × 8) + (1 × 1) = −7
Thus 18 + (−25) = −7, as expected.
RELATED WORKSHEETS:
- Binary Math Worksheet
Industrial Technology
- 3‑Bit Binary Counter with 555 Timer and 4027 Flip‑Flops
- Decimal vs. Binary Numeration: Place‑Weight, Efficiency, and Conversion
- Octal and Hexadecimal Numeration: A Practical Guide for Engineers
- Binary Addition Explained: Rules, Examples, and Its Role in Digital Computers
- Understanding Negative Numbers in Binary: Sign-Magnitude, Complement, and Two’s Complement
- Binary Overflow: How Sign Bits Affect Binary Addition
- Understanding Four‑Bit Binary Counters
- Designing a Binary Half‑Adder: From Logic Gates to Ladder Diagrams
- Binary Switch Game – Arduino UNO Project
- Build Your First Go Application on PLCnext: A Beginner’s Guide