- Foundation
- About 13 min
- 5 practice questions
Binary arithmetic and complements
Add and subtract binary numbers and find the 1's and 2's complement.
If something looks wrong, please tell us.
Computers add using simple rules on 0s and 1s. Even subtraction is done by adding a complement, which is why complements are tested.
Binary addition rules
| Sum | Result |
|---|---|
| 0 + 0 | 0 |
| 0 + 1 | 1 |
| 1 + 0 | 1 |
| 1 + 1 | 10 (write 0, carry 1) |
| 1 + 1 + 1 | 11 (write 1, carry 1) |
Example 1. 1011 + 110. In decimal this is 11 + 6 = 17. In binary, align 1011 and 0110: 1+0=1; 1+1=0 carry 1; 0+1+1=0 carry 1; 1+0+1=0 carry 1; final carry 1, giving 10001. Check: 16 + 1 = 17.
Example 2. 1101 + 1011 = 13 + 11 = 24, which is 11000 in binary (16 + 8).
Binary subtraction
Example 3. 1010 - 11 means 10 - 3 = 7, which is 111 in binary.
Complements
The 1's complement of a binary number is found by flipping every bit (0 to 1 and 1 to 0). The 2's complement is the 1's complement plus 1. Computers use the 2's complement to store negative numbers.
Example 4. 1's complement of 10110 is 01001. Add 1 for the 2's complement: 01010. Check: 10110 is 22, and in 5 bits 32 - 22 = 10, which is 01010.
Example 5. In a 4-bit system, the 2's complement of 0011 (decimal 3): flip to 1100, add 1 to get 1101, which represents -3.
1 + 1 = 10 in binary. 2's complement = flip all bits, then add 1.
Key takeaways
- Binary addition carries when a column reaches 2.
- 1's complement flips bits; 2's complement adds 1.
- Verify by converting to decimal.
Check your understanding
-
1. What is 1 + 1 + 1 in binary?
- 10
- 111
- 3
- 11
Show answer
Answer: D. 1 + 1 + 1 = 3, which is 11 in binary: write 1 and carry 1.
-
2. Add binary 1001 and 111.
- 10000
- 1110
- 10010
- 1111
Show answer
Answer: A. 9 + 7 = 16. In binary: 1+1 = 0 carry 1; 0+1+1 = 0 carry 1; 0+1+1 = 0 carry 1; 1+0+1 = 0 carry 1; final carry 1 gives 10000 (16).
-
3. Subtract binary 101 from 1100.
- 101
- 111
- 1001
- 110
Show answer
Answer: B. 1100 is 12 and 101 is 5; 12 - 5 = 7, which is 111.
-
4. What is the 1's complement of 101100?
- 101101
- 010100
- 010011
- 001101
Show answer
Answer: C. Flip every bit: 1 to 0 and 0 to 1, giving 010011. (010100 would be the 2's complement.)
-
5. In 4 bits, what is the 2's complement of 0110?
- 1001
- 0111
- 1011
- 1010
Show answer
Answer: D. Flip to 1001, then add 1: 1010. Check: 16 - 6 = 10, which is 1010.
Sign in to keep track of the lessons you finish.