Teachers' Portal  /  A-Level Computer Science 9618  /  Hardware and virtual machines  /  Karnaugh maps
Lesson pack · A-Level Computer Science 9618 · 15.2 · A Level (A2)

Karnaugh maps

Simplify by grouping. A Karnaugh map lays out a truth table as a grid in which neighbouring cells differ by just one input.

Student lesson Lab, full screen
At a glance

The shape of the lesson

Topic
Hardware and virtual machines
Syllabus reference
Cambridge International AS and A Level Computer Science 9618, 15.2
Level
A Level (A2)
Duration
45 minutes, lab-led; stretches to a 60 minute block (see the contingency notes)
Position in topic
Lesson 5 of 6 in Hardware and virtual machines; follows Boolean algebra; leads into Half adders, full adders and flip-flops
Central model
Fig. 1: a four-input K-map. The four corner cells are neighbours because the map wraps round, giving B. D; the centre square gives B.D
Cooperative structure
Assessment
Stage 1 check and the exam-style plenary from the student lesson, plus the worksheet as the exit task
Learning objectives

By the end of the lesson, learners can

Section by section
  • Setting up the map: Each cell is one row of the truth table.
  • The grouping rules: Click the cells of the map in the lab to add 1s, and watch the groups and the simplest expression appear.
  • Solving a logic problem: Exam questions often start with a problem statement.
Key points to leave on the board
  • Layout: label rows and columns 00, 01, 11, 10 and fill the 1s from the truth table.
  • Groups: 1, 2, 4 or 8 cells, rectangles only, as large and as few as possible, wrapping and overlapping allowed.
  • Terms: keep only the inputs that stay the same within each group.
  • Answer: OR the terms; one mark is often for each correct group or term.
The core visual model

One picture every idea returns to

A Karnaugh map (K-map) is a grid with one cell for each row of the truth table. The rows and columns are labelled in Gray code order (00, 01, 11, 10), so cells that are next to each other, including across the edges, differ in exactly one input. Each 1 is circled in a group of 1, 2, 4 or 8 neighbouring cells forming a rectangle; groups must be as large as possible and as few as possible, may overlap and may wrap round the edges. Each group gives one product term containing only the inputs that do not change inside it, and the terms are ORed together to give a sum of products. The benefit: a systematic, visual method that gives the simplest expression with less risk of error than Boolean algebra.

a four-input Karnaugh map with two groups of four AB CD 00 01 11 10 00 1 m0 0 m1 0 m3 1 m2 01 0 m4 1 m5 1 m7 0 m6 11 0 m12 1 m13 1 m15 0 m14 10 1 m8 0 m9 0 m11 1 m10 four corners: B.D (the map wraps round both edges) centre square: B.D X = B.D + B.D rows and columns in Gray code order: neighbours differ in one bit
Fig. 1: a four-input K-map. The four corner cells are neighbours because the map wraps round, giving B. D; the centre square gives B.D
Lesson sequence

Forty-five minutes, phase by phase

TimePhaseWhat happens in the roomGrouping
0 to 5 minHook: predictOpen with the question in the title, Simplify by grouping.. A Karnaugh map lays out a truth table as a grid in which neighbouring cells differ by just one input. 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 minTeach and check: Setting up the mapEach cell is one row of the truth table.Whole class, then pairs
13 to 21 minTeach and check: The grouping rulesClick the cells of the map in the lab to add 1s, and watch the groups and the simplest expression appear. Project tab 7 of the lab (Karnaugh maps: grouping and the simplest expression) and let a student drive it while the class predicts. Model the worked example A three-input map on the board, one line at a time. Your turn: Find the simplest expression for this map. AB \ CD 00 01 11 10 00 1 0 0 1 01 1 0 1 1 11 1 0 1 1 10 1 0 0 1Pairs
21 to 30 minTeach and check: Solving a logic problemExam questions often start with a problem statement. Model the worked example A majority vote on the board, one line at a time. Your turn: A sprinkler X switches on when the water tank is not empty (B = 1) and at least one of these is true: the soil is dry (A = 1), the temperature is high (C = 1), the timer is on (D = 1). Use a K-map to find the simplest sum-of-products expression.Cooperative Concept Mapping
30 to 36 minCheckThe 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 minPlenaryThe 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 minExit and homeworkSet the worksheet below (6 questions, 18 marks). Learners self-assess against the objectives before they leave.Individual
Timing and contingency

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 Solving a logic problem, 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.

Running the cooperative task

Cooperative Concept Mapping

Teams receive the key terms on cards and arrange them on a large sheet, drawing and labelling the links. Compare maps between teams before showing the model map.

The full structure, with its variations and the other twelve, is on the cooperative-learning page.

Examiner traps to pre-empt

What to head off, and how

Trap learners fall intoTeaching move that pre-empts it
Labelling the columns 00, 01, 10, 11 (binary order) is the most common mistake: then neighbouring cells 01 and 10 differ in two inputs, and every group in that part of the map is wrong.Return to Setting up the map: ask a pair to state the correct version and show it on the lab before moving on.
Do not stop at the first groups you see.A pair inside a possible group of four gives a term with an extra letter, which loses the simplification mark.
Every group must be checked for the inputs that stay the same.If an input is 0 in some cells of a group and 1 in others, it must not appear in that term.
Worksheet

Karnaugh maps: worksheet

6 questions, 18 marks. Written in the style of the papers; no past paper question is reproduced.

NameClassDate
Q1 · recall[2 marks]

State two benefits of using a Karnaugh map to simplify a logic expression.

Q2 · apply[3 marks]

A logic circuit has inputs A, B and C. The output X is 1 for the rows 000, 010, 100, 101 and 110 only. Draw the K-map and find the simplest expression for X.

Q3 · apply[3 marks]

Find the simplest sum-of-products expression for this K-map.

AB \ CD00011110
001111
010100
110100
101111
Q4 · apply[3 marks]

Find the simplest sum-of-products expression for this K-map.

AB \ CD00011110
001001
011011
111011
101001
Q5 · analysis[4 marks]

A sprinkler X switches on when the water tank is not empty (B = 1) and at least one of these is true: the soil is dry (A = 1), the temperature is high (C = 1) or the timer is on (D = 1). Use a Karnaugh map to find the simplest sum-of-products expression for X.

Q6 · explain[3 marks]

A student draws a three-input K-map with columns labelled 00, 01, 10, 11 and circles a group of three 1s. Explain the two errors and why each matters.

Answer key and marking notes
Q1 · 2 marks
  • It is a systematic / visual method, so there is less chance of making an error than with Boolean algebra.
  • It gives the simplest (minimal) sum-of-products expression, and it is quicker for three or four inputs.
Q2 · 3 marks
  • K-map:
    A \ BC00011110
    01001
    11101
  • Group of four: columns 00 and 10 wrap round (C = 0 throughout), giving C.
  • Pair: row A = 1, columns 00 and 01 (A = 1, B = 0), giving A.B. X = C + A.B.
Q3 · 3 marks
  • Rows AB = 00 and AB = 10 are neighbours (top and bottom wrap round) and are all 1s: a group of eight with B = 0, giving B.
  • Column CD = 01 is all 1s: a group of four with C = 0 and D = 1, giving C.D.
  • X = B + C.D
Q4 · 3 marks
  • Columns CD = 00 and CD = 10 wrap round to make a group of eight: D.
  • Cells 6, 7, 14, 15 make a group of four with B = 1 and C = 1: B.C.
  • X = D + B.C
Q5 · 4 marks
  • K-map with 1s in cells 5, 6, 7, 12, 13, 14 and 15:
    AB \ CD00011110
    000000
    010111
    111111
    100000
  • Row AB = 11 is a group of four: A.B.
  • Middle two rows, columns 01 and 11: B.D; middle two rows, columns 11 and 10: B.C.
  • X = A.B + B.C + B.D
Q6 · 3 marks
  • Columns must be in Gray code order 00, 01, 11, 10, so that neighbouring cells differ in only one input.
  • With 01 next to 10, two inputs change between neighbours, so a group across them does not simplify correctly.
  • Groups must contain 1, 2, 4 or 8 cells; a group of three does not correspond to a single product term (it must be split into overlapping pairs or enlarged).
Quiz

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.

Q11 mark

In which order must the columns CD of a four-input Karnaugh map be labelled?

  • A00, 01, 11, 10
  • B00, 01, 10, 11
  • C00, 11, 01, 10
  • D01, 10, 00, 11
Q21 mark

Find the simplest sum-of-products expression for this Karnaugh map.

A \ BC00011110
01100
11101

  • AB + A.C
  • BB + A
  • CB.C + A.C
  • DA.B + A.C
Q31 mark

Which of these groups of 1s is not allowed when simplifying with a Karnaugh map?

  • AA rectangle of six 1s, two rows by three columns
  • BThe four corner cells of a four-input map
  • CA pair that overlaps a group of four already circled
  • DA pair that wraps from the left edge to the right edge
Q41 mark

Find the simplest sum-of-products expression for this Karnaugh map.

AB \ CD00011110
001111
010011
110011
100000

  • AA.B + B.C
  • BA + B.C
  • CA.B + A.B.C
  • DA.B + B.C.D
Q51 mark

Find the simplest sum-of-products expression for this Karnaugh map.

AB \ CD00011110
001101
010000
110000
101101

  • AB.D + B.C
  • BB
  • CB.D + C.D
  • DB.D + A.B.C.D
Q61 mark

A three-input function is 1 for the rows 011, 100, 110 and 111 only.

A \ BC00011110
00010
11011
A student circles three pairs and writes X = A.B + A.C + B.C. Which statement is correct?

  • ACorrect but not the simplest: A.B covers no 1 the other pairs miss, so X = B.C + A.C
  • BWrong: the pair A.B covers cells that are 0, so it must be replaced by A on its own
  • CAlready the simplest: every 1 must be in as many groups as it has neighbouring 1s
  • DWrong: the pair in row A = 1 should wrap round to give A.C instead of A.C
Quiz key
Q1: A

Gray code order 00, 01, 11, 10 changes one bit between each pair of neighbours and also from 10 back round to 00, so adjacent cells differ in one input and the map wraps round. Binary order 00, 01, 10, 11 puts 01 next to 10, which differ in two bits. 00, 11, 01, 10 starts with a two-bit change, and 01, 10, 00, 11 has two-bit changes between 01 and 10 and between 00 and 11.

Q2: A

Columns BC = 00 and BC = 01 are full of 1s, a group of four in which only B stays the same (B = 0): B. The 1 in row A = 1, column 10 pairs with its wrap-round neighbour in column 00 (A = 1, C = 0): A.C. So X = B + A.C. B + A would also cover cell 7 (A = 1, B = 1, C = 1), which is 0. B.C + A.C misses cells 1 and 5, and A.B + A.C misses cell 5.

Q3: A

Every group must contain 1, 2, 4 or 8 cells, so a group of six is never allowed: it must be split into overlapping groups of four or of two. The four corners of a four-input map are neighbours because the map wraps round, groups may overlap if that makes them larger, and pairs may wrap from one edge to the opposite edge.

Q4: A

Row AB = 00 is a group of four with A = 0 and B = 0: A.B. Cells 6, 7, 14 and 15 (rows 01 and 11, columns 11 and 10) form a square with B = 1 and C = 1: B.C. So X = A.B + B.C. A + B.C would also cover cells 4 and 5, which are 0. A.B + A.B.C only covers cells 14 and 15 of the square, missing 6 and 7, and A.B + B.C.D misses cells 7 and 15.

Q5: A

Rows AB = 00 and AB = 10 are neighbours because the map wraps from top to bottom. The four corners (cells 0, 2, 8, 10) give B.D, and columns 00 and 01 in those two rows (cells 0, 1, 8, 9) give B.C. So X = B.D + B.C, which is B.(C + D). B would include cells 3 and 11, which are 0. B.D + C.D includes cells 5 and 13, which are 0. B.D + A.B.C.D uses a single cell for cell 1 and leaves cell 9 uncovered.

Q6: A

The pairs are A.B (cells 6 and 7), A.C (cells 4 and 6) and B.C (cells 3 and 7). All three lie inside the 1s, so the expression is correct, but cells 6 and 7 are already covered by the other two pairs, so A.B is redundant and X = B.C + A.C has one term fewer. A.B covers no 0s, and replacing it with A would cover cell 5, which is 0. Groups should be as few as possible, not one per neighbour, and the wrap-round pair in row A = 1 joins columns 00 and 10, where C = 0, so it gives A.C, not A.C.

Lab and demo

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

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.

Also for this topic

Everything else you can use

Original work by the TheLucidSTEM team. The worksheet items are written in the style of the papers; no past paper question is reproduced.
Previous lessonBoolean algebra