The shape of the lesson
By the end of the lesson, learners can
- One's and two's complement: In the lab's two's complement mode, set the bits and watch the leftmost one count as −128.
- Subtract by adding: Switch the lab to subtraction.
- When the result will not fit: Overflow happens when a calculation produces a value the register cannot represent.
- Two's complement: leftmost place value is −128 in 8 bits; range −128 to +127.
- Negate: invert every bit, then add 1 (inverting alone gives one's complement).
- Subtract: A − B = A + (−B); ignore a carry out of the leftmost bit.
- Overflow: two positives give a negative, or two negatives give a positive.
One picture every idea returns to
In two's complement the most significant bit has a negative place value: in 8 bits it is −128, so the range is −128 to +127. To negate a number, invert every bit (this alone gives the one's complement) and then add 1. Subtraction is done by adding the negative: A − B = A + (−B). Overflow occurs when the true result is outside the range: adding two numbers with the same sign gives a result with the opposite sign.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, Negative numbers in binary.. A register has no minus sign, so negative integers need a representation of their own. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: One's and two's complement | In the lab's two's complement mode, set the bits and watch the leftmost one count as −128. Project tab 5 of the lab (Two's complement) and let a student drive it while the class predicts. Model the worked example Denary to two's complement on the board, one line at a time. Your turn: Write −100 in 8-bit two's complement. | Whole class, then pairs |
| 13 to 21 min | Teach and check: Subtract by adding | Switch the lab to subtraction. Project tab 5 of the lab (Subtraction in two's complement) and let a student drive it while the class predicts. Model the worked example Negative answer on the board, one line at a time. Your turn: Calculate 38 − 91 in 8-bit two's complement. | Pairs |
| 21 to 30 min | Teach and check: When the result will not fit | Overflow happens when a calculation produces a value the register cannot represent. Project tab 3 of the lab (Binary addition and overflow) and let a student drive it while the class predicts. | Numbered Heads Together |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 14 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in When the result will not fit, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Numbered Heads Together
Teams of four number off. Put up a question, give the team time to make sure every member can answer, then call a number: that student answers for the team, so nobody can leave the thinking to someone else.
The full structure, with its variations and the other twelve, is on the cooperative-learning page.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| Inverting the bits is not the whole job for two's complement. | Forgetting to add 1 gives the one's complement, which is out by one. |
| A carry out of the leftmost bit is not the test for overflow in two's complement. | Check the signs: overflow only when two positives give a negative or two negatives give a positive. |
Two's complement and binary arithmetic: worksheet
6 questions, 14 marks. Written in the style of the papers; no past paper question is reproduced.
Convert the denary number −77 to 8-bit two's complement. Show your working.
The 8-bit two's complement integer 10101010 is stored. Give its denary value.
Calculate 38 − 91 using 8-bit two's complement arithmetic. Show your working and give the answer in binary and denary.
The 8-bit two's complement integers 01011010 and 01000110 are added. Give the 8-bit result and explain what has happened.
State the range of integers that can be stored in 8 bits using (a) one's complement and (b) two's complement, and explain why the ranges differ.
A 16-bit register holds the hexadecimal value FF9C, which is a two's complement integer. Give its denary value and show how you found it.
Answer key and marking notes
- +77 = 01001101, inverted 10110010.
- Add 1: 10110011.
−128 + 32 + 8 + 2 = −86.
- 38 = 00100110; −91 = 10100101 (01011011 inverted is 10100100, plus 1).
- 00100110 + 10100101 = 11001011.
- 11001011 = −128 + 64 + 8 + 2 + 1 = −53.
- Result 10100000.
- The true answer is 90 + 70 = 160, which is above the maximum of +127.
- Overflow: two positive numbers have given a negative result (−96).
- (a) −127 to +127.
- (b) −128 to +127.
- One's complement has two representations of zero (00000000 and 11111111), wasting one pattern; two's complement has only one zero, so it can represent one extra negative number.
- FF9C = 1111 1111 1001 1100; it is negative because the leftmost bit is 1.
- Invert to 0000 0000 0110 0011 and add 1: 0000 0000 0110 0100 = 100, so the value is −100.
6 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
What is −45 in 8-bit two's complement?
- A
11010011 - B
11010010 - C
10101101 - D
00101101
The 8-bit two's complement value 10110100 is stored. What is its denary value?
- A−76
- B180
- C−52
- D−75
What is the range of integers that can be stored in 8-bit two's complement?
- A−128 to +127
- B−127 to +127
- C−127 to +128
- D0 to 255
The calculation 52 − 75 is done by adding the 8-bit two's complement of 75 to 00110100. What bit pattern results?
- A
11101001 - B
00010111 - C
11101000 - D
10010111
Which 8-bit two's complement addition produces an overflow?
- A
01110000 + 00100000 - B
11110000 + 11100000 - C
01010000 + 10110000 - D
10000001 + 01111111
In 8-bit two's complement, 11111100 is added to 00000110. A 1 is carried out of the leftmost bit. Which statement is correct?
- AThe stored result 00000010 (+2) is correct and the carry is ignored
- BOverflow has occurred, so the stored result cannot be trusted
- CThe true result is 100000010, which is 258
- DThe stored result is −126 because the carry sets the sign bit
Quiz key
+45 = 00101101; inverting gives 11010010 and adding 1 gives 11010011 (check: −128 + 64 + 16 + 2 + 1 = −45). 11010010 is only the one's complement, 10101101 is sign and magnitude, and 00101101 is +45.
−128 + 32 + 16 + 4 = −76. 180 reads the pattern as unsigned binary, −52 treats the first bit as a plain sign (sign and magnitude), and −75 inverts the bits but forgets to add 1.
10000000 = −128 is the smallest value and 01111111 = +127 is the largest. −127 to +127 is the range of sign and magnitude, −127 to +128 puts the extra value on the wrong side, and 0 to 255 is unsigned binary.
−75 = 10110101; 00110100 + 10110101 = 11101001, which is −128 + 64 + 32 + 8 + 1 = −23. 00010111 is +23 (the sign has been lost), 11101000 is the one's complement form of −23, and 10010111 is −23 in sign and magnitude.
112 + 32 = 144, which is above +127; the register would hold 10010000 (−112), a negative from two positives. −16 + (−32) = −48 fits, even though there is a carry out of the leftmost bit. 80 + (−80) = 0 and −127 + 127 = 0 have opposite signs, so they can never overflow.
11111100 = −4 and 00000110 = +6, so the sum should be +2, which is exactly what the register holds. In two's complement a carry out of the leftmost bit is discarded and is not a sign of overflow; overflow needs two operands of the same sign. 258 treats the values as unsigned with a ninth bit, and the carry does not change the sign bit of the stored result.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.