adjacent: next to a cell with only one input changed; Gray order: an order where neighbouring labels change one bit
55-minute lesson sequence
0–5 · Retrieve algebraic simplification.
5–15 · Model the two-cell group, then show Gray order and the wrap-around edge.
15–25 · Guide task 1 and ask which variable changes.
25–45 · Students construct task 2 and verify all eight cases with a table or Boolean Python.
45–50 · Each student explains the wrap-around group without relying on its appearance alone.
50–55 · Collect the Gray-order exit explanation; assign homework.
Try before notes
Simplify A AND B OR A AND NOT B.
Build the idea
A Karnaugh map rearranges a truth table so neighbouring cells differ in one input. Grouping removes an input that changes while the output remains 1. Explain the fixed input in words before writing the simplified term.
For three inputs use A for rows and BC=00,01,11,10 for columns. The left and right edges touch logically. The order is not ordinary counting: it is chosen to keep neighbours one bit apart.
Groups are rectangles containing 1,2,4 or 8 cells. Do not include zeros. Overlapping groups are allowed. Diagonal contact does not make two cells adjacent.
A / BC | 00 01 11 10
0 | 0 0 1 1
1 | 0 0 1 1
See the method
For a two-input map, rows are A=0,1 and columns B=0,1. If the A=1 row contains two ones, B changes but A stays 1, so the group gives A. Groups use 1, 2, 4 or 8 cells in a rectangle. For three inputs use columns BC=00,01,11,10; left and right edges are neighbours.
Two worked K-map examples
Start with the rows where the output F is 1. The map puts those same 1s next to each other so you can spot which inputs matter. These examples are separate from your workbook and homework.
Read the shorthand:An apostrophe means NOT. Letters side by side mean AND. A plus sign means OR.B′ + ACmeans “NOT B, or A AND C.”
Why a changing letter drops out:AB′ + AB = A(B′ + B) = A. Both cells need A to be 1. Together they cover B = 0 and B = 1, so B does not matter.
Example 1: Three inputs
Copy the outputs from the truth table.
Split each input into A and BC. For 101, go to row A = 1 and column BC = 01. Copy its output, 1, to that cell. Fill the rest the same way, including the 0s.
Truth table
ABC
F
000
1
001
1
010
0
011
0
100
1
101
1
110
0
111
1
Map for three inputs
A/BC
00
01
11
10
0
1G1
1G1
0
0
1
1G1
1G1/G2
1G2
0
The columns go 00, 01, 11, 10. Each neighbour changes just one bit. Ordinary counting puts 01 beside 10, but both bits change, so those two cannot be neighbours. The first and last columns, 00 and 10, differ in just one bit.
Group the 1s. Start with the biggest groups you can use.
G1: The four 1s in the first two columns form a rectangle.
G2: The 1 at 111 still needs a group. Join it to 101 in the same row. Diagonals do not count.
A group can have 1, 2, 4, 8 or 16 cells. Never include a 0. You can use a 1 twice: the cell marked G1/G2 belongs to both groups.
Read what stays the same in each group.
Keep an input if it has the same value in every cell of the group. If it stays 1, write the letter. If it stays 0, write the letter with an apostrophe. If it changes, leave it out.
G1: B stays 0. A and C change. Write B′.
G2: A and C stay 1. B changes. Write AC.
Join the terms with OR. Check an output of 1 and an output of 0.
F = B′ + AC
At 111, AC is 1, so F is 1. At 010, B′ and AC are both 0, so F is 0. Both match the truth table.
For a full check, try the expression on all 8 input rows. Every output must match the truth table.
Example 2: Four inputs and wrapped corners
Copy the outputs from the truth table.
Split each input into AB and CD. For 1010, go to row AB = 10 and column CD = 10. Copy its output, 1, to that cell. Fill the rest the same way, including the 0s.
Truth table
ABCD
F
0000
1
0001
0
0010
1
0011
0
0100
0
0101
0
0110
0
0111
0
1000
1
1001
0
1010
1
1011
1
1100
0
1101
0
1110
1
1111
1
Map for four inputs
AB/CD
00
01
11
10
00
1G1
0
0
1G1
01
0
0
0
0
11
0
0
1G2
1G2
10
1G1
0
1G2
1G1/G2
Both axes use 00, 01, 11, 10. First and last columns are neighbours, and so are first and last rows. Think of the map as joined at both pairs of edges.
Group the 1s. Start with the biggest groups you can use.
G1: Take the four corners. Each edge joins its opposite edge, so these corners form one 2 by 2 group. This is not a diagonal pair.
G2: Take the 2 by 2 block in rows 11 and 10 and columns 11 and 10. That covers the 1s not yet in a group.
A group can have 1, 2, 4, 8 or 16 cells. Never include a 0. You can use a 1 twice: the cell marked G1/G2 belongs to both groups.
Read what stays the same in each group.
Keep an input if it has the same value in every cell of the group. If it stays 1, write the letter. If it stays 0, write the letter with an apostrophe. If it changes, leave it out.
G1: B and D stay 0. A and C change. Write B′D′.
G2: A and C stay 1. B and D change. Write AC.
Join the terms with OR. Check an output of 1 and an output of 0.
F = B′D′ + AC
At 0010, B′D′ is 1, so F is 1. At 0001, B′D′ and AC are both 0, so F is 0. Both match the truth table.
For a full check, try the expression on all 16 input rows. Every output must match the truth table.
Predict then reveal
In the displayed map, group the last two columns across both rows. What stays fixed?
Reveal reasoning
A changes across rows. C changes between 11 and 10. B stays 1 in all four cells. The simplified output is B.
A two-input map has a single 1 at A=0,B=0. What term represents it? Can it join a diagonal 1 at 11?
Reveal reasoning
The single-cell term is NOT A AND NOT B. It cannot join 11 diagonally: both variables change. Each isolated cell needs its own term if those are the only ones.
Work one step together
Read the first task. Each learner predicts the first step privately. Compare the method, then complete one intermediate row or one code iteration together. Do not display a finished workbook answer.
Practice
Draw a two-input map. Put output 1 in both cells where B=1 and output 0 elsewhere. Group the ones. Write the simplified expression and verify four rows.
Your turn
Complete the remaining steps of task 1 alone, then the next tasks. Predict before running code. Save your own evidence before comparing.
Practice
Draw a two-input map. Put output 1 in both cells where B=1 and output 0 elsewhere. Group the ones. Write the simplified expression and verify four rows.
Draw a three-input map: rows A=0,1; columns BC=00,01,11,10. Both rows contain 1,0,0,1. Group all four ones across the two outside columns. State what stays fixed. Verify the simplified result using all eight inputs.
A / BC | 00 | 01 | 11 | 10
0 | | | |
1 | | | |
Check and explain
A visually close cell is not necessarily logically adjacent; compare its input label.
Point to the first step, row, condition or requirement that supports your answer. If results differ, find the first different state and repair one cause.
Show what you know
Why must the three-input columns not use ordinary binary order 00,01,10,11?
HL challenge when ready
A two-input map has ones only at 01 and 10. Can they form a diagonal group?
Week 2 homework
Show working. Keep code and output. Stop at 25 minutes and mark where you reached.
Make a truth table for Y=(A AND B) OR NOT C. Show intermediate columns and all eight rows.
Draw Y using standard gate symbols. Write a Python expression with the same meaning.
Simplify (X AND Y) OR (NOT X AND Y). Use algebra and a two-variable Karnaugh map.
A learner says XOR and OR are always equal. Give one counterexample.
Spend about 3 minutes on each during practice time. Predict, run, change one thing, then explain. These prompts do not add homework.
A starter is runnable code to explore or complete. If the playground restores your saved code, the linked starter is selected in Example: use Load example when ready. Download your work before confirming replacement.
Prompt 1
Print a rule in Gray-code column order. Why does each neighbouring pair change only one bit?
No imports needed.
Hint and starter code
Gray-code order is 00, 01, 11, 10; a Karnaugh map uses this adjacency.
# Gray-code order is 00, 01, 11, 10; a Karnaugh map uses this adjacency.
columns = [(0, 0), (0, 1), (1, 1), (1, 0)]
for a, b in columns:
print(a, b, a or b)