Welcome to Binary Addition!
Have you ever wondered how computers do maths? Inside a computer, there are billions of tiny electronic switches that can only be ON or OFF. Because of this, computers cannot count using digits from \(0\) to \(9\) like humans do. Instead, they use a system called binary. In these notes, you will learn how computers add numbers together using just two digits: \(0\) and \(1\)!
Don't worry if this seems tricky at first! Once you learn the basic rules, binary addition works just like the column addition you already know from maths.
1. Quick Recap: Data Units and Number Systems
Before jumping into addition, let's review the essential terms:
• Denary (or Decimal): This is the "Base-10" number system used by humans. It uses ten digits: \(0, 1, 2, 3, 4, 5, 6, 7, 8,\) and \(9\).
• Binary: This is the "Base-2" number system used by computers. It uses only two digits: \(0\) and \(1\).
• Bit: A single binary digit (a single \(0\) or \(1\)). It is the smallest unit of data in computing.
• Nibble: A group of \(4\) bits (for example, \(1010\)).
• Byte: A group of \(8\) bits (for example, \(11001010\)).
Binary Place Values
In standard denary maths, place value columns increase by multiplying by \(10\) (\(1, 10, 100, 1000\)). In binary, place values double as you move to the left (powers of \(2\)):
\(128\) | \(64\) | \(32\) | \(16\) | \(8\) | \(4\) | \(2\) | \(1\)
Did you know? The largest number you can make using a single 8-bit byte is \(255\) (which is \(2^8 - 1\), or all eight bits set to \(11111111\)).
Key Takeaway: Binary is Base-2 (only \(0\)s and \(1\)s). \(1\) byte = \(8\) bits, and its columns double from right to left: \(1, 2, 4, 8, 16, 32, 64, 128\).
2. The Five Golden Rules of Binary Addition
To add any binary numbers, you only need to remember five simple rules. Think of it like a code:
Rule 1: \(0 + 0 = 0\)
(Zero plus zero equals zero)
Rule 2: \(0 + 1 = 1\)
(Zero plus one equals one)
Rule 3: \(1 + 0 = 1\)
(One plus zero equals one)
Rule 4: \(1 + 1 = 10\)
(In binary, \(1 + 1\) equals \(2\), which is written as \(10\). You write down \(0\) in the column and carry \(1\) to the next column to the left.)
Rule 5: \(1 + 1 + 1 = 11\)
(This happens when you have a carry from the previous column! In binary, \(1 + 1 + 1\) equals \(3\), which is written as \(11\). You write down \(1\) in the column and carry \(1\) to the next column to the left.)
Quick Memory Trick
• In denary: \(1 + 1 = 2\). In binary, the number \(2\) is written as \(10\) (one 2 and zero 1s).
• In denary: \(1 + 1 + 1 = 3\). In binary, the number \(3\) is written as \(11\) (one 2 and one 1).
Key Takeaway: Never write the digit "\(2\)" or "\(3\)" in a binary answer! Always write a "\(0\)" or "\(1\)" and carry over the rest.
3. Step-by-Step Column Addition
Just like normal maths, we use column addition. Always follow these two important rules:
1. Align the numbers by their place values.
2. Always start adding from the least significant bit (LSB) on the far right and move towards the left.
Worked Example 1: Simple 4-Bit Addition
Let's add \(0101\) (denary \(5\)) and \(0010\) (denary \(2\)):
\(0\) \(1\) \(0\) \(1\)
+ \(0\) \(0\) \(1\) \(0\)
-----------------
• Column 1 (far right, 1s column): \(1 + 0 = 1\)
• Column 2 (2s column): \(0 + 1 = 1\)
• Column 3 (4s column): \(1 + 0 = 1\)
• Column 4 (8s column): \(0 + 0 = 0\)
Answer: \(0111\) (denary \(7\)).
Worked Example 2: Addition with Carries
Let's add \(0110\) (denary \(6\)) and \(0111\) (denary \(7\)):
\(0\) \(1\) \(1\) \(0\)
+ \(0\) \(1\) \(1\) \(1\)
-----------------
• Column 1 (far right): \(0 + 1 = 1\). Write down \(1\).
• Column 2: \(1 + 1 = 10\). Write down \(0\), carry \(1\) to the next column.
• Column 3: \(1 + 1 + 1\) (including carry) \(= 11\). Write down \(1\), carry \(1\) to the next column.
• Column 4: \(0 + 0 + 1\) (carry) \(= 1\). Write down \(1\).
Answer: \(1101\) (which equals \(8 + 4 + 1 = 13\) in denary).
Key Takeaway: Start at the far right. Whenever you get \(1 + 1\), write \(0\) and carry \(1\). When you get \(1 + 1 + 1\), write \(1\) and carry \(1\).
4. 8-Bit Addition and Overflow Errors
In KS3 Computing, you will often work with 8-bit binary numbers (up to one byte). But what happens if the answer is too big to fit inside \(8\) bits?
What is an Overflow Error?
An overflow error occurs when the result of an addition is greater than the maximum value that the allocated number of bits can store.
For an 8-bit byte:
• The maximum value is \(255\) (\(2^8 - 1\)).
• If you add two 8-bit numbers and the sum requires a 9th bit, the computer has no room to store that extra carried bit.
Real-World Analogy
Imagine a digital scoreboard or a car odometer that only has room for \(3\) digits. If the score reaches \(999\) and you add \(1\), the display might roll over and show \(000\)! The carried "\(1\)" falls off the edge because there is nowhere to put it.
Consequences of an Overflow Error
When an overflow error occurs in an 8-bit calculation:
• The carried 9th bit on the far left is lost or ignored.
• The remaining 8 bits give a completely incorrect result.
• This can lead to computer software bugs or crashes!
Key Takeaway: Overflow happens when a calculation produces a number that needs more bits than the computer has allocated (e.g. an 8-bit calculation needing a 9th bit).
5. Common Pitfalls to Avoid
When practising binary addition, watch out for these common mistakes:
• Decimal Thinking: Writing "\(2\)" in a column. Remember, the digit "\(2\)" does not exist in binary! Always write "\(0\)" and carry "\(1\)".
• Ignoring the Carry: Forgetting to add the carried "\(1\)" into the next column to the left. Make sure to write your carries clearly under or above the columns.
• Place Value Confusion: Assuming binary place values are \(1, 10, 100\) like denary. Remember that binary place values double: \(1, 2, 4, 8, 16, 32, 64, 128\).
• Misunderstanding Overflow: Thinking an overflow is just "a large number". An overflow is a specific error where the computer lacks the storage bits to hold the final sum.
6. Chapter Summary Checklist
Before you move on, make sure you can answer yes to these points:
✔ Do you know that binary is Base-2 (\(0\) and \(1\)) and denary is Base-10 (\(0\) to \(9\))?
✔ Can you recall the size of a bit (\(1\)), nibble (\(4\) bits), and byte (\(8\) bits)?
✔ Can you recite all \(5\) addition rules, including \(1 + 1 = 10\) and \(1 + 1 + 1 = 11\)?
✔ Do you always start adding from the least significant bit (LSB) on the far right?
✔ Can you explain what an overflow error is and why the 9th bit gets lost in 8-bit addition?