AQA GCSE Computer Science (8525), section 3.3.4 (Binary arithmetic)
The rules
Binary addition works like decimal addition, with only two digits.
| Sum | Result | Carry |
|---|---|---|
| 0 + 0 | 0 | 0 |
| 0 + 1 | 1 | 0 |
| 1 + 1 | 0 | 1 |
| 1 + 1 + 1 | 1 | 1 |
Work from the right (the least significant bit) to the left, and add any carry to the next column.
Worked example
Add (53) and (27).
carry: 1 1 1 1 1 1
0 0 1 1 0 1 0 1
+ 0 0 0 1 1 0 1 1
-----------------
0 1 0 1 0 0 0 0
Column by column from the right:
| Column | Sum | Write | Carry |
|---|---|---|---|
| 1 | 1 + 1 | 0 | 1 |
| 2 | 0 + 1 + 1 (carry) | 0 | 1 |
| 3 | 1 + 0 + 1 | 0 | 1 |
| 4 | 0 + 1 + 1 | 0 | 1 |
| 5 | 1 + 1 + 1 | 1 | 1 |
| 6 | 1 + 0 + 1 | 0 | 1 |
| 7 | 0 + 0 + 1 | 1 | 0 |
| 8 | 0 + 0 | 0 | 0 |
The answer is 0101 0000, which is 80. Check: . ✔
Adding three numbers
You can add up to three numbers. When adding three numbers, a column can contain up to three 1s (including any carry). In a column with three 1s, write 1 and carry 1 ( in binary). Exam questions never need more than three 1s in a column.
Add 0000 0101 (5), 0000 0011 (3) and 0000 0001 (1): the right-hand column has three 1s, so write 1 and carry 1. The answer is 0000 1001 = 9.
Overflow
All answers fit in 8 bits and there is no carry beyond the 8th bit in exam questions. In a real computer, if the answer is too large for the number of bits (for example in 8 bits), an overflow error occurs.
Common mistake: forgetting a carry into the next column, or writing 1 + 1 = 2. In binary, 1 + 1 = 10: write 0 and carry 1. Also, always work from the right-hand column.
Exam tip: write the carry digits above the columns. Check by converting to decimal, adding, and comparing with the answer.
Check yourself
What is 1 + 1 in binary?
10 (write 0 and carry 1).
Add 0000 0110 and 0000 0011.
0000 1001.
Why can an overflow error occur?
The result is too large to be stored in the available number of bits.