📄 Paper 2 · 4.5 Data Representation
4.5.4b Two's Complement & Signed Integers
AQA 7517 · A-Level Computer Science · ~15 min read

Why Signed Integers?

Unsigned binary can only represent non-negative numbers. To represent negative integers in hardware, computers use two's complement — the standard method used by virtually all modern processors.

Two's Complement Representation

In two's complement, the MSB (most significant bit) has a negative weight:

Bit 7Bit 6Bit 5Bit 4Bit 3Bit 2Bit 1Bit 0
−1286432168421

Range for n-bit two's complement: −2^(n−1) to 2^(n−1)−1. For 8 bits: −128 to +127.

Reading two's complement

  • If MSB = 0 → positive number (read normally).
  • If MSB = 1 → negative number. Multiply MSB by −128 (for 8-bit), add remaining bits normally.

Example: 11110010 = −128+64+32+16+2 = −14

Converting Positive → Negative (Two's Complement)

Method — invert all bits, then add 1:

StepBinaryDecimal
Start: +2300010111+23
Invert all bits11101000—
Add 111101001−23

Verify: −128+64+32+8+1 = −128+105 = −23 ✓

Binary Subtraction Using Two's Complement

Subtraction A − B is performed as A + (two's complement of B). This avoids separate subtraction circuitry.

Example: 45 − 28

StepBinary
+4500101101
28 → invert11100011
Add 1 (−28)11100100
45 + (−28)00010001

Result: 00010001 = 16+1 = 17 ✓ (discard overflow carry)

Sign and Magnitude (Alternative)

An alternative representation: use the MSB as a sign bit (1=negative), remaining bits represent magnitude. Problem: two representations of zero (+0 and −0), and arithmetic is more complex. Not used in practice — two's complement is preferred.

Exam tip: Two's complement is the AQA standard for signed integers. Know the range (−2^(n−1) to 2^(n−1)−1), how to negate a number (invert + add 1), and how to perform subtraction. When subtracting with two's complement, discard any carry out of the MSB — this is normal. Compare with sign-and-magnitude and explain why two's complement is preferred.
▶
Click through the slides at your own pace. Use arrow keys or click to advance.
Click slide or press arrow keys to navigate

Worksheet — 4.5.4b Two's Complement

8 questions · instantly marked · AQA 7517 standard

Q1What is the range of values representable by an 8-bit two's complement signed integer?[2]
✅ Mark scheme
Mark scheme
−128 to +127 [1]; derived from −2⁷ to 2⁷−1 [1].
Q2Convert the 8-bit two's complement number 11001010 to decimal. Show all working.[3]
✅ Mark scheme
Mark scheme
MSB = 1 so negative [1]; −128+64+8+2 = −128+74 = −54 [1]; correct final answer −54 [1].
Q3Represent −37 as an 8-bit two's complement binary number. Show the negation process.[3]
✅ Mark scheme
Mark scheme
+37 = 00100101 [1]; invert: 11011010; add 1: 11011011 [1]; result 11011011 (verify: −128+64+16+8+2+1=−37) [1].
Q4Use two's complement to calculate 72 − 45 in 8-bit binary. Show all steps.[4]
✅ Mark scheme
Mark scheme
72 = 01001000 [1]; 45 = 00101101 → invert = 11010010 → +1 = 11010011 [1]; 01001000 + 11010011 = 100011011 → discard carry, 8-bit result 00011011 [1]; = 16+8+2+1 = 27 [1].
Q5State one advantage of two's complement over sign-and-magnitude for representing negative integers.[2]
✅ Mark scheme
Mark scheme
Two's complement has a unique representation of zero (no +0 and −0) [1]; arithmetic operations (addition and subtraction) work without special cases, simplifying CPU design [1]. Accept any one advantage with explanation.
Q6What is the 8-bit two's complement representation of −1? Explain why.[2]
✅ Mark scheme
Mark scheme
11111111₂ [1]; because +1 (00000001) inverted = 11111110, + 1 = 11111111; or alternatively −128+64+32+16+8+4+2+1 = −1 [1].
Q7Convert 10000000 (8-bit two's complement) to decimal.[2]
✅ Mark scheme
Mark scheme
10000000 in two's complement = −128 [1]; this is the most negative 8-bit value — MSB contributes −128, all other bits are 0 [1].
Q8A programmer stores the value −100 in an 8-bit two's complement register, then adds 50 to it. What is the result in binary and decimal?[3]
✅ Mark scheme
Mark scheme
−100 in two's complement: 10011100 [1]; 50 = 00110010; 10011100 + 00110010 = 11001110 [1]; 11001110 = −128+64+8+4+2 = −50 [1].
Topic Quiz
Question 1 of 15
You scored
out of 15
Card 1 of 8
Click to reveal definition
🎉
All cards reviewed!
TermDefinition
🎯

Mini Test — Two's Complement

10 questions · 10 minutes

← 4.5.4a Binary Integers
38 of 70 · AQA 7517
4.5.4c Floating-Point →