GCSE Revision Aid: This resource is designed to support your revision and may contain errors. If you find a discrepancy with your class teaching, your teacher is correct โ€” please let us know at gcserevise@scott.scottrix.co.uk.

CS18: Binary Arithmetic

Foundation Higher AQAEdexcelOCREduqas

Binary addition rules, overflow errors, adding multiple binary numbers, and logical binary shift operations (left and right).

Fastmail

๐Ÿ“‹ Binary Addition Rules

Binary addition follows the same principles as decimal addition but with only two digits (0 and 1). There are only four rules to remember.
The Four Binary Addition Rules:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (which is 0, carry 1)

When carrying into a column that already has a 1:
1 + 1 + 1 = 11 (which is 1, carry 1)
Input A Input B Carry In Sum Carry Out
00000
01010
10010
11001
00110
01101
10101
11111

โž• Binary Addition Step-by-Step

Add 01010100 and 00111001 (8-bit)
  Carry:  0 1 1 0 0 0 0 0
  Num A:  0 1 0 1 0 1 0 0   (84)
  Num B:  0 0 1 1 1 0 0 1   (57)
  -----------------------
Result:  1 0 0 0 1 1 0 1   (141)

Step through from right to left, carrying 1 whenever the column sum is 2 or more.

Add 01101011 and 00110110 (8-bit)
  Carry:  0 1 1 0 1 1 0 0
  Num A:  0 1 1 0 1 0 1 1   (107)
  Num B:  0 0 1 1 0 1 1 0   (54)
  -----------------------
Result:  1 0 1 0 0 0 0 1   (161)
Add 11110000 and 00001111 (8-bit)
  Carry:  1 1 1 1 1 1 1 1
  Num A:  1 1 1 1 0 0 0 0   (240)
  Num B:  0 0 0 0 1 1 1 1   (15)
  -----------------------
Result:  1 0 0 0 0 1 1 1 1   (BUT this is 9 bits!)

The result is 255, which needs 8 bits: 11111111. The 9th bit is a carry out that overflows.

โš ๏ธ Overflow

Overflow occurs when the result of a binary addition requires more bits than are available. If adding two 8-bit numbers produces a 9th bit (a carry out from the leftmost column), the result cannot be stored correctly in 8 bits. This is an overflow error.
Overflow Example
  Num A:  1 1 0 0 1 1 0 0   (204)
  Num B:  0 1 1 0 0 1 0 1   (101)
  -----------------------
Result: 1 0 0 1 1 0 0 0 1

The result needs 9 bits but we only have 8. The 9th bit (leftmost 1) is lost, leaving 00110001 = 49. The correct answer should be 305, but we get 49 - this is an overflow error!

Detecting overflow: If there is a carry out from the most significant bit (leftmost column), overflow has occurred. The stored result will be incorrect. In programming, you need to check for this condition.
Overflow Rule:
If two positive binary numbers are added and the result appears negative (in signed representation) or exceeds the available bits, an overflow has occurred.

For 8-bit unsigned numbers: overflow happens when the sum exceeds 255.

๐Ÿ”ข Adding Multiple Binary Numbers

To add more than two binary numbers, add them two at a time. Add the first two, then add the third to that result, and so on. Check for overflow at each step.
Add 01010011 + 00110110 + 00011001

Step 1: Add the first two numbers

  01010011  (83)
+ 00110110  (54)
---------
  10001001  (137)

Step 2: Add the result to the third number

  10001001  (137)
+ 00011001  (25)
---------
  10100010  (162)

Check: 83 + 54 + 25 = 162 โœ“ No overflow.

โฌ…๏ธ Binary Shift Left

A binary shift left moves all bits one position to the left. A 0 fills the empty position on the right. The leftmost bit is discarded. Shifting left by 1 position multiplies the number by 2. Shifting left by n positions multiplies by 2^n.
Shift Left by 1
Original:  0 0 0 1 0 1 1 0   (22)
Shift left: 0 0 1 0 1 1 0 0   (44)

22 x 2 = 44. The shift left has multiplied the value by 2.

Shift Left by 2
Original:  0 0 0 1 0 1 1 0   (22)
Shift 1:   0 0 1 0 1 1 0 0   (44)
Shift 2:   0 1 0 1 1 0 0 0   (88)

22 x 2^2 = 22 x 4 = 88. Each shift left multiplies by 2.

Warning: If a 1 bit is shifted out from the leftmost position, data is lost. This is similar to overflow. For example, shifting 10110000 left by 1 would lose the leading 1.

โžก๏ธ Binary Shift Right

A binary shift right moves all bits one position to the right. A 0 fills the empty position on the left. The rightmost bit is discarded. Shifting right by 1 position divides the number by 2 (integer division, discarding any remainder). Shifting right by n positions divides by 2^n.
Shift Right by 1
Original:  0 0 1 0 1 1 0 0   (44)
Shift right: 0 0 0 1 0 1 1 0   (22)

44 / 2 = 22. The shift right has divided the value by 2.

Shift Right with Remainder Loss
Original:  0 0 0 1 0 1 1 1   (23)
Shift right: 0 0 0 0 1 0 1 1   (11)

23 / 2 = 11.5, but integer division gives 11. The remainder (the rightmost 1 bit) is lost.

Shift Right by 2
Original:  0 1 0 1 1 0 0 0   (88)
Shift 1:   0 0 1 0 1 1 0 0   (44)
Shift 2:   0 0 0 1 0 1 1 0   (22)

88 / 2^2 = 88 / 4 = 22. Each shift right divides by 2.

๐Ÿ“Š Shift Operations Summary

Operation Effect Mathematical Equivalent Bits Lost Bits Added
Shift left by 1 Move all bits left, fill right with 0 Multiply by 2 Leftmost bit 0 on right
Shift left by n Move all bits left n times Multiply by 2^n n leftmost bits n zeros on right
Shift right by 1 Move all bits right, fill left with 0 Divide by 2 (integer) Rightmost bit 0 on left
Shift right by n Move all bits right n times Divide by 2^n (integer) n rightmost bits n zeros on left
Shift Formulas:
Shift left by n = multiply by 2^n
Shift right by n = integer divide by 2^n

These are logical shifts (always fill with 0).
Arithmetic shifts (for signed numbers) preserve the sign bit.

โš ๏ธ Common Mistakes

Mistake Why It's Wrong How to Fix It
Forgetting to carry in binary addition 1+1 = 10, not just 0 Always carry the 1 to the next column left
Not checking for overflow The result may be incorrect if bits are lost Check if there is a carry out from the leftmost bit
Shifting in the wrong direction Left multiplies, right divides Left = multiply, Right = divide
Forgetting that shift right loses data The rightmost bit is discarded, not wrapped Be aware that odd numbers lose their remainder
Shifting left causing overflow If a 1 is shifted out, the value is wrong Check if the result fits in the available bits

โ“ Practice Questions

Q1: Add the binary numbers 01011010 and 00110101. Show your working.

Q2: Add 10110011 and 01101010. Does overflow occur? Explain why.

Q3: Perform a binary shift left by 2 on 00101100. What is the result in decimal?

Q4: Perform a binary shift right by 1 on 01101010. What is the result in decimal?

Q5: What mathematical operation does a shift left by 3 perform?

โœ… Answers

  1.   Carry:  0 0 1 1 0 0 0 0
      Num A:  0 1 0 1 1 0 1 0   (90)
      Num B:  0 0 1 1 0 1 0 1   (53)
      -----------------------
    Result:  1 0 0 0 1 1 1 1   (143)
  2.   Num A:  1 0 1 1 0 0 1 1   (179)
      Num B:  0 1 1 0 1 0 1 0   (106)
    Result would be 100101101 (285), but this needs 9 bits. With only 8 bits, we get 00101101 (45). Overflow occurs because 179 + 106 = 285, which exceeds the maximum 8-bit value of 255. The carry out from the leftmost column indicates overflow.
  3. Original: 00101100 (44). Shift left 1: 01011000 (88). Shift left 2: 10110000 (176). Result = 176. Check: 44 x 2^2 = 44 x 4 = 176.
  4. Original: 01101010 (106). Shift right 1: 00110101 (53). Result = 53. Check: 106 / 2 = 53.
  5. A shift left by 3 multiplies the number by 2^3 = 8. For example, 00000101 (5) shifted left by 3 becomes 00101000 (40), and 5 x 8 = 40.

๐ŸŽฏ Exam Tips

โš ๏ธ Common Errors

โœ— Forgetting to carry when binary addition column sum exceeds 1 โœ“ In binary: 1+1 = 10 (write 0, carry 1). 1+1+1 = 11 (write 1, carry 1). Always carry just like decimal addition.

โœ— Confusing binary shift direction โ€” left vs right โœ“ Left shift multiplies by 2 (fills with 0 on right). Right shift divides by 2 and discards the remainder (fills with 0 on left for positive numbers).

โœ— Thinking overflow only occurs in very large numbers โœ“ Overflow occurs whenever the result exceeds the available number of bits. Even small numbers like 11111111 + 1 = 100000000 overflow an 8-bit register.

โœ— Losing bits during a right binary shift and not recording them โœ“ A right shift discards the least significant bit โ€” this is integer division by 2 with truncation. The lost bit represents the remainder and cannot be recovered.

โœ๏ธ Model Answer

Full-Mark Response

Perform the binary addition: 10110110 + 01101001. Show your working including any carries, and state whether overflow has occurred in an 8-bit system. [4 marks]

10110110 + 01101001 -------- 100011111 Working right to left: 0+1=1, 1+0=1, 1+0=1, 0+1=1, 1+0=1, 1+1=0 carry 1, 0+1+1=0 carry 1, 1+0+1=0 carry 1 Result: 100011111 (9 bits) Overflow has occurred because the result requires 9 bits but an 8-bit register can only hold 8 bits. The 9th bit (carry out) is lost, and the stored result would be 00011111 = 31, which is incorrect.

๐Ÿ“Š AO Deep Dive

Assessment Objective Analysis

AO1 (Computational Thinking โ€” 40%): Demonstrate knowledge and understanding of the principles and concepts of computer science, including binary arithmetic: addition and shifts for AQA 8525, OCR J277 & Edexcel 1CP2.

AO2 (Application โ€” 40%): Apply knowledge and understanding of computer science, including binary arithmetic: addition and shifts to analyse problems in computational terms and to design, write and evaluate solutions.

AO3 (Evaluation โ€” 20%): Evaluate the effectiveness, correctness and efficiency of computational solutions, including binary arithmetic: addition and shifts, and make reasoned judgements about trade-offs.

๐Ÿ“ Exam Technique

GCSE Computer Science Exam Tips:
Binary addition: add column by column from right, carry when sum โ‰ฅ 2. Check for overflow by seeing if result needs more bits than available. Binary shift: left = ร—2, right = รท2. Show the direction clearly. Right shift loses the LSB โ€” state this. For two's complement, left shift can overflow into the sign bit. Always show carries in your working.

๐Ÿ“ Exam Questions by Topic

๐ŸŽฌ Video Resources

Share this page

Ready to ace your GCSE Computer Science exams?

Get the best revision books and guides to boost your grades.