Intermediate

Binary Number Representations

AicademyAicademy
·A-Level Computer Science·AQA 7517·5 min
4.5.4.1 Unsigned binary·4.5.4.2 Unsigned binary arithmetic·4.5.4.3 Signed binary — two's complement

Unsigned Binary

Unsigned binary represents non-negative integers (zero and above). With bits, the representable range is to .

Bits ()RangeMax value
40 to 15
80 to 255
160 to 65 535
320 to

Converting unsigned binary to decimal:

: working right to left, bit has value .

Bit76543210
Value1286432168421
Digit10110101
Contribution128321641

Converting decimal to binary: see the number systems lesson (repeated division by 2).

Binary Addition

Binary addition follows the same rules as decimal addition but in base 2:

ABCarry inSum bitCarry out
00000
01010
10010
11001
11111

Worked example — add (122) + (53):

  0111 1010   (122)
+ 0011 0101   ( 53)
-----------
  1010 1111   (175)

Carry trace (right to left): 0+1=1; 1+0=1; 0+1=1; 1+0=1; 1+1=10 (0 carry 1); 1+1+1=11 (1 carry 1); 1+0+1=10 (0 carry 1); 0+0+1=1.

Result:

Multiplication by 2: shift all bits one place to the left and insert a 0 in the rightmost position. This is because each bit's place value doubles when shifted left.

Two's Complement: Representing Signed Integers

Two's complement is the standard way to represent positive and negative integers in binary. With bits:

  • Range: to
  • The most significant bit (MSB) acts as the sign bit: 0 = positive, 1 = negative

For 8 bits: range is to .

Interpreting a two's complement number:

The MSB has a negative place value: .

Negating in Two's Complement

To negate a number (flip its sign): invert all bits, then add 1.

Example — represent in 8-bit two's complement:

Step 1: write in binary:

Step 2: invert all bits:

Step 3: add 1:

So .

Verify using the sign-bit method:

Converting negative two's complement to decimal:

Given : apply the same process — invert and add 1: Invert: Add 1: Therefore .

How much of this have you taken in?

Quiz yourself on this section — free, no card needed.

Test myself

Subtraction Using Two's Complement

Binary subtraction is performed by adding the two's complement of the subtrahend:

Worked example — compute in 8-bit two's complement:

: start with ; invert: ; add 1:

  0000 1010   (+10)
+ 1111 1010   ( -6)
-----------
1 0000 0100   (carry-out discarded)

Result: ✓ (carry out of the MSB is discarded for correct results)

Overflow occurs when the result exceeds the range of bits. In two's complement: overflow is detected when the carry into the MSB differs from the carry out of the MSB.

Summary: Unsigned vs Signed

Unsigned binaryTwo's complement
8-bit range0 to 255−128 to 127
Negative valuesNot representableRepresentable
MSB rolePlace value Negative place value
Addition same?YesYes
Overflow detectionCarry out of MSBCarry in ≠ carry out of MSB

The same 8-bit pattern has different meanings under unsigned vs two's complement:

  • unsigned =
  • two's complement =

Common Exam Mistakes

1. Using the wrong range formula

Unsigned -bit range: to . Two's complement -bit range: to . Note the asymmetry — there is one more negative value than positive.

2. Forgetting to add 1 when negating

Inverting the bits alone gives the one's complement, not the two's complement. The +1 step is essential. Omitting it gives the wrong result.

3. Not discarding the carry-out in subtraction

When subtracting with two's complement, a carry-out of the MSB is expected for a correct positive result. It must be discarded, not included in the answer.

4. Misreading the sign of a two's complement number

A leading 1 does not mean the number is a large positive. two's complement = , not .

Generate revision on any topic you study

Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set — personalised to your level.

Lessons on anything

Structured, level-matched lessons on any topic you study

Practice quizzes

Find out what you actually know before the exam does

Flashcard sets

Lock in key concepts with instant revision cards

Ask Aica

Stuck on something? Get a clear explanation, any time

Prev

Number Systems and Bases

Next

Floating Point Numbers

Related lessons

7 Slides

Lesson

Number Systems and Bases

A-Level Computer Science · AQA 7517

10 hours ago

7 Slides

Lesson

Floating Point Numbers

A-Level Computer Science · AQA 7517

10 hours ago

6 Slides

Lesson

Logic Gates and Circuits

A-Level Computer Science · AQA 7517

10 hours ago

7 Slides

Lesson

Character Encoding and Error Detection

A-Level Computer Science · AQA 7517

10 hours ago