Skip to topic
    ← Back to course topics

    Signed binary using two’s complement — AQA A-Level Computer Science

    Two's complement is a mathematical system used in computer systems to represent signed integers in binary, where the most significant bit holds a negative place value. It simplifies processor design by allowing binary addition and subtraction to be executed using identical arithmetic logic circuits without requiring separate hardware.

    Signed binary using two’s complement explained

    Signed binary in two's complement uses the leftmost bit as a sign bit, which has a place value of negative 2 to the power of (n minus 1), where n is the number of bits.

    Read the full explanation

    For an 8-bit pattern, the leftmost bit is worth −128, and each remaining bit is worth its usual positive power of two: 64, 32, 16, 8, 4, 2 and 1. To convert 11110110 to decimal, add the place values of the set bits: −128 + 64 + 32 + 16 + 4 + 2 = −10. To convert in the other direction, write the positive value in binary, invert every bit, and add 1 to obtain the two's complement pattern; for example, +10 is 00001010, inverting gives 11110101, and adding 1 gives 11110110. Always state the bit length first, because the same pattern means a different value in a different number of bits. Check the answer by confirming that the sign bit agrees with the sign of the result.

    Your focus

    1. Students are expected to be able to convert between signed binary and decimal and vice versa.

    Which command word is this?

    Show all intermediate numerical steps, including bit padding, inversion, addition of 1, and the final binary or denary answer.

    Signed binary using two’s complement exam tips

    Topic Overview

    Two's complement is the standard binary representation for signed integers in digital computing, mandated by the AQA A-Level Computer Science specification. It assigns a negative place value to the most significant bit (MSB), enabling both positive and negative values to be stored uniformly within fixed-width registers.

    Understanding two's complement is crucial because it allows the Arithmetic Logic Unit (ALU) to perform subtraction via standard adder circuitry, avoiding duplicate hardware for negative numbers. This concept also underpins fixed-point and floating-point representations, binary arithmetic operations, and processor status flags.

    Key Concepts
    • →The Most Significant Bit (MSB) acts as a negative place-value weight equal to -(2^(n-1)) rather than simply a sign flag.
    • →Conversion from positive to negative is achieved by finding the one's complement (inverting all bits) and adding 1, or scanning from right to left, keeping bits unchanged up to and including the first '1', then inverting the rest.
    • →An n-bit system represents values in the asymmetric range -(2^(n-1)) to +(2^(n-1) - 1), which uniquely represents zero and avoids the '+0' and '-0' ambiguity of sign and magnitude.
    • →Subtraction (A - B) is implemented in hardware as addition: A + (-B), discarding any carry-out bit beyond the register width.
    Marking Points
    • Identifies the leftmost bit as the sign bit with a negative place value.
    • Calculates the negative place value as −2^(n−1) for the stated bit length.
    • Adds the positive place values of the remaining set bits correctly.
    • Inverts all bits and adds 1 when converting a negative decimal value to two's complement.
    • Confirms the bit length before interpreting or producing the pattern.
    Examiner Tips
    • 💡Write the place values above the bits before adding, so the negative sign bit is not overlooked.
    • 💡Check the answer by testing whether the sign bit matches the sign of the decimal result.
    • 💡When asked to convert a negative denary value, write the positive binary first, then invert and add 1 as a separate visible step.
    • 💡Always check whether the exam question specifies an 8-bit, 12-bit, or 16-bit register; failing to pad with leading zeros before negating loses all method marks.
    • 💡When explaining why two's complement is preferred over sign and magnitude, explicitly mention both the absence of duplicate representations of zero and the simplification of ALU circuitry.
    • 💡Verify negative conversions quickly in your head by evaluating: MSB weight + sum of remaining positive bits.
    Common Mistakes
    • Treats the leftmost bit as a positive place value; the sign bit must carry a negative value such as −128 in an 8-bit pattern.
    • Adds 1 before inverting the bits when forming the two's complement of a negative number, which gives the wrong pattern.
    • Interprets a pattern without reference to its bit length, so the same bits are read with the wrong sign or magnitude.
    • Believing that two's complement has two representations for zero: unlike sign and magnitude, two's complement features only a single zero (e.g., 00000000 in 8 bits).
    • Assuming that an extra carry bit generated past the MSB indicates an arithmetic overflow; this bit is normal and discarded in two's complement addition/subtraction.
    • Forgetting to pad numbers to the required register size before taking the two's complement, which produces completely incorrect sign and value bits.
    Revision Plan
    1. 1Day 1: Master the conversion of positive denary values to two's complement binary for 8-bit and 16-bit widths using both inversion methods.
    2. 2Day 2: Practise converting negative binary patterns back to denary using negative MSB place values.
    3. 3Day 3: Perform subtraction operations by negating the subtrahend and executing binary addition, monitoring for true overflow.
    4. 4Day 4: Work through AQA past paper questions focusing on algebraic range expressions and comparison with sign and magnitude.
    Exam Question Types
    • 📋Denary to binary conversion: Converting a negative denary integer into an 8-bit or 12-bit two's complement pattern.
    • 📋Binary arithmetic and subtraction: Adding or subtracting two signed binary values with an explanation of carry and overflow flags.
    • 📋Theoretical comparison: Short-answer questions explaining why modern processors use two's complement over alternative signed representations.
    • 📋Range determination: Calculating maximum and minimum representable values for a given register size n.
    Command Word Expectations (AQA)
    Calculate

    Show all intermediate numerical steps, including bit padding, inversion, addition of 1, and the final binary or denary answer.

    Explain

    Set out the mathematical or structural reasoning behind a concept, such as why a particular hardware advantage arises from two's complement.

    State

    Give a concise, direct fact or value (such as a range boundary or binary bit pattern) without needing extended working.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Neglecting to pad the binary number to the specified bit width before performing two's complement inversion, leading to incorrect leading bits.
    ❌ Weak Answer (Loses Marks):Converting -13 by taking 13 (1101), flipping to 0010, and adding 1 to get 0011.
    Example improved answer:In an 8-bit system, first express +13 as 00001101. Invert all bits to produce 11110010 (one's complement), then add 1 to obtain 11110011. The MSB has a weight of -128, giving -128 + 64 + 32 + 16 + 2 + 1 = -13.
    Examiner Tip: Always write out your place-value column headings including the negative MSB (e.g., -128, 64, 32, 16, 8, 4, 2, 1) and confirm your result works to the required bit length.
    Pitfall: Confusing standard arithmetic overflow with the discarding of the carry bit out of the most significant bit during two's complement subtraction.
    ❌ Weak Answer (Loses Marks):An overflow error occurred because there was a carry bit of 1 left over at the very end of the binary addition.
    Example improved answer:An overflow error occurs only when the result of adding two numbers of the same sign produces a result with the opposite sign bit, exceeding the representable range [-128 to +127 for 8 bits]. The carry bit generated beyond the MSB during subtraction or addition is routinely discarded and does not itself indicate overflow.
    Examiner Tip: Distinguish clearly between the end carry bit (which is discarded in standard two's complement addition) and condition code overflow (V flag), which occurs if two positive numbers yield a negative result or vice versa.
    Step-by-Step Worked Solutions

    Question: Using 8-bit two's complement arithmetic, calculate the result of the denary operation 42 - 75. Show all your working, including the conversion of negative numbers and the binary addition.

    1. 1.Step 1: Convert +42 to an 8-bit binary pattern: 32 + 8 + 2 = 00101010.
    2. 2.Step 2: Convert +75 to an 8-bit binary pattern: 64 + 8 + 2 + 1 = 01001011.
    3. 3.Step 3: Negate +75 to find -75 using two's complement: invert the bits of 01001011 to get 10110100, then add 1 to yield 10110101.
    4. 4.Step 4: Perform binary addition of 42 (00101010) and -75 (10110101): 00101010 + 10110101 = 11011111.
    5. 5.Step 5: Verify using column weights (-128, 64, 32, 16, 8, 4, 2, 1): -128 + 64 + 0 + 16 + 8 + 4 + 2 + 1 = -33. Since 42 - 75 = -33, the binary sum is correct.
    Final Answer: 00101010 + 10110101 = 11011111 (denary -33)

    Question: State the minimum and maximum denary values that can be represented using an n-bit signed integer in two's complement. Hence, calculate the range for a 12-bit register.

    1. 1.Step 1: State the general algebraic formula for the range of an n-bit two's complement integer: Minimum = -(2^(n-1)), Maximum = (2^(n-1)) - 1.
    2. 2.Step 2: Substitute n = 12 into the lower bound: -(2^(12-1)) = -(2^11) = -2048.
    3. 3.Step 3: Substitute n = 12 into the upper bound: (2^(12-1)) - 1 = (2^11) - 1 = 2048 - 1 = +2047.
    4. 4.Step 4: Formulate the continuous integer range.
    Final Answer: Range formula is -(2^(n-1)) to (2^(n-1)) - 1; for 12 bits, the range is -2048 to +2047.
    Active Recall Memory Test
    What is the weight of the MSB in an 8-bit two's complement binary byte?
    Key Fact: -128 (or -2^7).
    What are the two major advantages of two's complement over sign and magnitude?
    Key Fact: There is only one representation for zero, and the same ALU addition circuitry can be used for both addition and subtraction.
    What is the formula for the most negative number representable in an n-bit two's complement system?
    Key Fact: -(2^(n-1)).
    If adding two positive 8-bit numbers results in an MSB of 1, what condition has occurred?
    Key Fact: Arithmetic overflow.
    Frequently Asked Questions
    How do you quickly convert a negative two's complement binary number back to denary?
    The most reliable method is to use column headings where the most significant bit (MSB) has a negative weight. For an 8-bit pattern such as 11110011, write the weights: -128, 64, 32, 16, 8, 4, 2, 1. Add the active positive columns to the negative MSB: -128 + 64 + 32 + 16 + 2 + 1 = -13. Alternatively, you can invert all bits, add 1 to find the positive magnitude, and attach a negative sign.
    Why is the range of two's complement asymmetrical?
    In an n-bit register, 2^n unique bit patterns are possible. Because zero is represented by an all-zero pattern (00000000), it belongs to the positive/non-negative half of representations (from 0 to 2^(n-1) - 1). This leaves exactly 2^(n-1) bit patterns for negative values, allowing the negative range to reach one integer lower: down to -(2^(n-1)). For 8 bits, this produces a range of -128 to +127.
    What is the difference between one's complement and two's complement?
    One's complement is obtained simply by inverting every bit in a binary pattern (changing 1s to 0s and 0s to 1s). Two's complement takes the one's complement and adds 1 to the result. One's complement suffers from having two distinct patterns for zero (+0 and -0), which complicates computer arithmetic, whereas two's complement has only one representation for zero.
    What happens to the carry bit generated past the most significant bit during two's complement addition?
    In standard two's complement arithmetic, any carry bit produced beyond the most significant bit is discarded by the register. It does not indicate an error during subtraction; rather, the mathematical mechanics of modular arithmetic in two's complement naturally account for this discarded carry. True overflow occurs only when the sign bit of the result does not match the expected sign of the arithmetic operation.