SLIDE 1
CSZone.co.uk
Click to advance · Arrow keys also work
CAIE 9618 · Paper 1 · Topic 1.1.2
Binary Arithmetic &
Two's Complement
Binary Addition · Overflow · Signed Integers · Subtraction
CSZone
Cambridge International AS & A Level Computer Science 9618
Learning Objectives
By the end of this video you will be able to...
Perform binary addition and identify when overflow occurs
Represent negative numbers using two's complement
Use two's complement to perform binary subtraction
Explain what an overflow error is and when it occurs
Binary Addition
Four Rules of Binary Addition
THE FOUR RULES
0 + 0 = 0
0 + 1 = 1
1 + 1 = 10 (0, carry 1)
1 + 1 + 1 = 11 (1, carry 1)
WORKED EXAMPLE: 0110 + 0111
0 1 1 0
+ 0 1 1 1
= 1 1 0 1
6 + 7 = 13 ✓
Overflow Error
When the Result Is Too Large
An overflow error occurs when the result of a binary arithmetic operation is too large to be stored in the available number of bits.
EXAMPLE: 8-BIT OVERFLOW
1111 1111 (255)
+ 0000 0001 (1)
= 1 0000 0000 ← 9 bits! Overflow!
The carry bit has no register to store in — it is lost
The result stored is incorrect — a major problem in software
Two's Complement
Representing Negative Numbers
"Two's complement is the standard method used by computers to represent both positive and negative integers using the same binary circuitry."
SIGN BIT
The most significant bit (leftmost) acts as the sign:
0 = positive number
1 = negative number
8-BIT RANGE
With 8 bits in two's complement:
Positive: 0 to +127
Negative: −128 to −1
Total: 256 values
Converting to Two's Complement
How to Find −27 in 8-bit Two's Complement
Step 1
Write the positive version in binary:
+27 = 0001 1011
Step 2
Invert all bits (flip 0→1 and 1→0):
1110 0100
Step 3
Add 1 to the result:
1110 0100 + 1 = 1110 0101
Answer: −27 = 1110 0101
Check: sign bit = 1 ✓ (negative)
Binary Subtraction
Subtract by Adding the Negative
To compute A − B, find the two's complement of B, then add A + (−B).
This means the same addition circuits handle both addition and subtraction.
EXAMPLE: 9 − 5 using 8-bit two's complement
9 = 0000 1001
5 = 0000 0101 → invert → 1111 1010 → +1 → 1111 1011 (= −5)
0000 1001 + 1111 1011 = 1 0000 0100
Discard overflow carry → 0000 0100 = 4 ✓
Reading Negative Values
What Does 1110 0101 Equal?
METHOD: CONVERT BACK
1
Sign bit = 1 → number is negative
2
Invert all bits: 1110 0101 → 0001 1010
3
Add 1: 0001 1010 + 1 = 0001 1011 = 27
Conclusion: 1110 0101 in two's complement = −27
The sign bit has a negative weight: for 8-bit, it represents −128 (not +128)
Exam Practice
Cambridge-style questions
Question 1
Show how the denary number −42 is represented in 8-bit two's complement binary. Show your working.
3 marks
✓ MARK SCHEME
1 mark
+42 in binary: 0010 1010
1 mark
Invert all bits: 1101 0101
1 mark
Add 1: 1101 0110 (final answer)
⚠ All three steps must be shown for full marks — do not skip the inversion step
Exam Practice
Question 2
The 8-bit two's complement binary number 1100 1110 is stored in a register. What is its denary value?
2 marks
✓ MARK SCHEME
1 mark
Invert: 0011 0001, Add 1: 0011 0010 = 50 (showing it is negative)
Question 3
Explain what is meant by an overflow error in binary arithmetic.
2 marks
1 mark
The result of a calculation is too large to fit in the available bits/register
1 mark
The carry/extra bit is lost/discarded, causing an incorrect result to be stored
Common Mistakes
Don't lose easy marks
1
Forgetting to add 1 after inverting — inverting alone gives the one's complement, not the two's complement. Both steps are required.
2
Overflow in subtraction via addition — when subtracting using two's complement, a carry out of the most significant bit is expected and discarded. This is not an overflow error.
3
Saying overflow happens when numbers are "too big" — be specific: overflow occurs when the result exceeds the range of the register (e.g. exceeds +127 or is less than −128 for 8-bit).
4
Treating the sign bit as a positive value — in two's complement, the MSB represents −128 (for 8-bit), not +128. A common error is computing 1000 0000 as 128 instead of −128.
Topic Summary — 1.1.2
What You Need to Know
BINARY ADDITION RULES
0+0=0 · 0+1=1 · 1+1=10 (carry 1)
1+1+1=11 (1, carry 1)
Overflow: result needs more bits than available
Carry bit lost → incorrect result stored
OVERFLOW
Result too large for register
8-bit unsigned: max 255
8-bit two's complement: −128 to +127
Carry bit discarded → wrong answer
TWO'S COMPLEMENT
MSB = sign bit (0=pos, 1=neg)
To negate: invert all bits, then add 1
Subtraction = add the two's complement
Discard expected carry in subtraction
8-bit range: −128 to +127
CSZone
Next Video
1.1.3
Floating-Point Representation
Mantissa · Exponent · Normalisation · Precision
Head to CSZone.co.uk for the complete worksheet, quiz, and interactive tools