Binary Addition (OCR GCSE Computer Science): Revision Notes
📚 Revision Notes
Binary Addition
Rules of Binary Addition
There are four key rules to remember when adding binary numbers:
| Step | Binary Addition | Explanation |
|---|---|---|
| 1 | 0 + 0 = 0 | Nothing to carry, so we write 0. |
| 2 | 0 + 1 = 1 | No carry, so we write 1. |
| 3 | 1 + 1 = 10 | We write 0 and carry 1 (just like how 9 + 1 in denary is 10). |
| 4 | 1 + 1 + 1 = 11 | We write 1 and carry 1. |
Example: Adding Two Binary Numbers
Let's add 010001 and 100001.
Step-by-step:
- Align the two binary numbers.
- Apply the binary addition rules starting from the rightmost column (just like denary addition). | | | | | | | | |---|---|---|---|---|---|---| | | 0 | 1 | 0 | 0 | 0 | 1 | | + | 1 | 0 | 0 | 0 | 0 | 1 | | | | | | | | | | Carried values | | 1 | | | | | | Result | 1 | 1 | 0 | 0 | 0 | 1 |
Steps Explained
- In the first column, 1 + 1 = 10, so write 0 and carry 1.
- In the second column, 1 + 0 + carry 1 = 10, so write 0 and carry 1.
- Continue the process until all columns are added.
- The result is 1100010.
Checking the Answer with Denary
- 010001 = 17 in denary.
- 100001 = 33 in denary.
- 17 + 33 = 50 in denary.
- 1100010 in binary = 50 in denary, so the addition is correct!
Overflow Errors
When adding two binary numbers, there is a limit to the size of the result when using 8 bits. The largest binary number that can be represented with 8 bits is 11111111 (which equals 255 in denary). If the result of an addition exceeds this, it causes an overflow error.
What is Overflow?
- Overflow happens when a result is too large to fit into the available number of bits.
- If we add 1 to 11111111, we get 100000000. Since we're limited to 8 bits, the leftmost 1 is lost, and the result is incorrect.
Example of Overflow
Let's add 11001010 and 10110010.
| 1 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | |
| + | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| Carried values | 1 | 1 | 1 | 1 | 1 | 1 | ||
| Result | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 |
Explanation
- Adding these two 8-bit numbers results in 11111100 with a carried 1 on the left.
- Since there's no space for this carried 1 in 8 bits, it's lost, causing overflow.
- The correct result would need 9 bits: 111111100.
infoNote
Tips for Binary Addition
- Start from the rightmost column (just like in denary addition).
- Remember to carry if the sum in a column is 2 or more.
- Watch out for overflow errors when working with fixed bit lengths (e.g., 8 bits).