Minimise F(A,B,C,D) = Σm(0,2,4,5,8,10,12,14) as a sum of products.
A Karnaugh map redraws a truth table on a Gray-coded grid so that terms which can be merged sit side by side. Grouping the 1s (or 0s) gives a minimal SOP (or POS) by eye; the Quine–McCluskey tabulation does the same job systematically.
Simplifying with Boolean theorems works, but it has no fixed recipe: you must spot which theorem to apply next, and you can never be sure the result is minimal. A Karnaugh map (K-map) removes the guesswork. Maurice Karnaugh of Bell Labs introduced it in 1953 as a refinement of Edward Veitch's 1952 chart. The truth table is redrawn as a grid in which terms that can be merged sit next to each other.
Everything rests on one identity, the combining theorem XY + XY' = X(Y + Y') = X. Two minterms that differ in exactly one variable merge into a single term with that variable removed. Such minterms are called logically adjacent. Merging two adjacent pairs that differ in yet another variable removes a second variable, and so on.
To make logical adjacency visible, rows and columns are labelled in Gray code: 00, 01, 11, 10. Each label differs from the next in a single bit. In plain binary order (00, 01, 10, 11) the labels 01 and 10 would sit side by side although they differ in two bits, and the picture would mislead you.
The labels also wrap around. The last column (10) differs from the first (00) in one bit, so the left and right edges touch, and so do the top and bottom rows — imagine the map drawn on a doughnut. In an n-variable map every cell therefore has exactly n logical neighbours, one for each variable you can flip.
An n-variable map has 2ⁿ cells, one for each truth-table row. A cell holds the function value for that input combination: 1, 0, or X for a don't care. The number of a cell is its minterm index — the decimal value of the input code, with the row variables as the more significant bits.
| A \ B | 0 | 1 |
|---|---|---|
| 0 | m0 | m1 |
| 1 | m2 | m3 |
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | m0 | m1 | m3 | m2 |
| 1 | m4 | m5 | m7 | m6 |
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | m0 | m1 | m3 | m2 |
| 01 | m4 | m5 | m7 | m6 |
| 11 | m12 | m13 | m15 | m14 |
| 10 | m8 | m9 | m11 | m10 |
Filling a map. From a Σm list, write 1 in each listed cell and 0 elsewhere. From a truth table, copy row by row, remembering the swapped positions. From an SOP that is not in canonical form, each product term marks every cell where it is 1: a term with k literals in an n-variable map covers 2ⁿ⁻ᵏ cells. For example, in four variables the term BD' covers cells 4, 6, 12 and 14.
Reading a group. Look at each variable across the group's cells. If it stays 1, write it plain; if it stays 0, write it complemented; if it changes, drop it. A group of 2ᵏ cells in an n-variable map drops k variables and leaves n − k literals.
| Cells in group (4 variables) | Variables eliminated | Literals left | Example |
|---|---|---|---|
| 1 | 0 | 4 | m5 → A'BC'D |
| 2 | 1 | 3 | m5, m7 → A'BD |
| 4 | 2 | 2 | m0, m2, m8, m10 → B'D' |
| 8 | 3 | 1 | rows 00 and 10 → B' |
| 16 | 4 | 0 | whole map → F = 1 |
A 3-variable example. Take F(A,B,C) = Σm(0,2,3,4,6,7). The four cells under columns 11 and 10 (m3, m2, m7, m6) form a quad in which B = 1 throughout while A and C change, giving B. The cells under columns 00 and 10 (m0, m2, m4, m6) form a second quad by wrapping round the side edges; there C = 0 throughout, giving C'. Cells m2 and m6 are shared, which is allowed. Hence F = B + C': two literals in place of six three-literal minterms.
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | 1 (m0) | 0 (m1) | 1 (m3) | 1 (m2) |
| 1 | 1 (m4) | 0 (m5) | 1 (m7) | 1 (m6) |
Three terms describe groups precisely. An implicant is any product term that implies F — any valid group of 1s, even a single cell. A prime implicant (PI) is an implicant that cannot be enlarged: its group is not contained in any bigger valid group. An essential prime implicant (EPI) is a PI that covers at least one 1 that no other PI covers, so it appears in every minimal SOP. The remaining PIs are non-essential (selective) and are used only as needed.
The biggest group is not always needed. In F(A,B,C,D) = Σm(1,5,6,7,11,12,13,15) the central square m5, m7, m13, m15 (BD) is a prime implicant and the largest group on the map. Yet each of its cells is also covered by an essential pair: A'C'D (m1, m5), A'BC (m6, m7), ABC' (m12, m13) and ACD (m11, m15). Those four pairs are forced, together they cover all eight 1s, and BD becomes redundant: F = A'C'D + A'BC + ABC' + ACD.
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0 | 1 | 0 | 0 |
| 01 | 0 | 1 | 1 | 1 |
| 11 | 1 | 1 | 1 | 0 |
| 10 | 0 | 0 | 1 | 0 |
Minimal is not always unique. A cyclic map has no essential PIs at all. F(A,B,C) = Σm(0,1,2,5,6,7) has six PIs — A'B', A'C', B'C, BC', AC and AB — and every 1 is covered by exactly two of them. Two different covers are equally cheap: F = A'B' + BC' + AC and F = A'C' + B'C + AB. Both are correct minimal answers, so an exam option may show either.
Sometimes the output for certain inputs does not matter, either because those inputs never occur or because nobody uses the output then. The classic case is a circuit fed with BCD digits: the codes 1010 to 1111 (10–15) never appear. Such cells are marked X (or d) and listed separately, as in F = Σm(…) + d(…).
Don't cares can save a lot. A BCD-input circuit that detects digits of 5 or more needs 9 literals if the six unused codes are treated as 0s, but only 5 literals (F = A + BD + BC) when they are used as Xs — see Worked example 2. The circuit's response to an illegal code is then whatever the groups happen to give, which is acceptable precisely because those codes never occur.
A K-map gives a minimal product of sums just as easily. Group the 0s with exactly the same rules; each 0-group is a product term of the complement F'. Complementing with De Morgan's theorem then turns the SOP for F' into a POS for F.
Direct reading. You can skip F' and read each 0-group straight into a sum term. A variable that stays 0 across the group appears uncomplemented, one that stays 1 appears complemented, and a changing variable is dropped — the opposite of the SOP rule. For instance, the 0-group formed by the top row of a 4-variable map (A = 0, B = 0) gives the sum term (A + B).
Neither form is always cheaper, so compare their cost. Count literals, or, more finely, gate inputs: the inputs of the first-level gates plus one input per term at the output gate. In Worked example 3 the POS needs 6 literals against 7 for the SOP; in Practice exercise 4 the SOP wins.
Five variables need 32 cells. The usual layout places two 4-variable maps side by side: the left map holds the cells with A = 0 (minterms 0–15) and the right map those with A = 1 (16–31). Both use BC for the rows and DE for the columns, so a cell in the right map is numbered 16 more than the cell in the same position on the left.
| BC \ DE (A = 0) | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0 | 1 | 3 | 2 |
| 01 | 4 | 5 | 7 | 6 |
| 11 | 12 | 13 | 15 | 14 |
| 10 | 8 | 9 | 11 | 10 |
| BC \ DE (A = 1) | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 16 | 17 | 19 | 18 |
| 01 | 20 | 21 | 23 | 22 |
| 11 | 28 | 29 | 31 | 30 |
| 10 | 24 | 25 | 27 | 26 |
Adjacency. Inside each map the 4-variable rules apply, wrap-around included. Between the maps, a cell is adjacent to the cell in the same position in the other map, because the two differ only in A — imagine laying one map on top of the other. So m9 (01001) is adjacent to m25 (11001), but m9 and m24 (11000) are not, since they differ in both A and E. A group may lie inside one map (A appears in the term: A' on the left, A on the right) or occupy identical positions in both maps (A drops out and the group doubles).
Six variables need four 4 × 4 maps (64 cells), with adjacency between maps that are neighbours in Gray order. Beyond five or six variables the eye can no longer spot every adjacency reliably, so designers switch to the tabular Quine–McCluskey method, or to software minimisers such as Espresso that use heuristics to handle dozens of variables.
The Quine–McCluskey (QM) method, developed by Willard Quine in 1952 and extended by Edward McCluskey in 1956, performs the same merging as a K-map but in tables. Because it never relies on pictures, it works for any number of variables. Below, the procedure is applied to F(A,B,C,D) = Σm(0,1,2,5,6,7,8,9,10,14).
| Groups | Pair | ABCD | Status |
|---|---|---|---|
| 0–1 | 0, 1 | 000- | ✓ |
| 0–1 | 0, 2 | 00-0 | ✓ |
| 0–1 | 0, 8 | -000 | ✓ |
| 1–2 | 1, 5 | 0-01 | PI: A'C'D |
| 1–2 | 1, 9 | -001 | ✓ |
| 1–2 | 2, 6 | 0-10 | ✓ |
| 1–2 | 2, 10 | -010 | ✓ |
| 1–2 | 8, 9 | 100- | ✓ |
| 1–2 | 8, 10 | 10-0 | ✓ |
| 2–3 | 5, 7 | 01-1 | PI: A'BD |
| 2–3 | 6, 7 | 011- | PI: A'BC |
| 2–3 | 6, 14 | -110 | ✓ |
| 2–3 | 10, 14 | 1-10 | ✓ |
| Quad | ABCD | Term | Status |
|---|---|---|---|
| 0, 1, 8, 9 | -00- | B'C' | PI |
| 0, 2, 8, 10 | -0-0 | B'D' | PI |
| 2, 6, 10, 14 | --10 | CD' | PI |
| Prime implicant | 0 | 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 14 |
|---|---|---|---|---|---|---|---|---|---|---|
| B'C' (0,1,8,9) | × | × | × | × | ||||||
| B'D' (0,2,8,10) | × | × | × | × | ||||||
| CD' (2,6,10,14) | × | × | × | × | ||||||
| A'C'D (1,5) | × | × | ||||||||
| A'BD (5,7) | × | × | ||||||||
| A'BC (6,7) | × | × |
Columns 9 and 14 each have a single ×, so B'C' and CD' are essential. Together they cover 0, 1, 2, 6, 8, 9, 10 and 14, leaving m5 and m7. A'BD covers both, whereas A'C'D and A'BC cover one each, so A'BD is chosen. Result: F = B'C' + CD' + A'BD (7 literals). The prime implicant B'D' was never needed.
Try the problem first, then reveal the working one step at a time.
Minimise F(A,B,C,D) = Σm(0,2,4,5,8,10,12,14) as a sum of products.
A circuit receives a BCD digit ABCD (A = MSB) and outputs F = 1 when the digit is 5 or more. Codes 1010–1111 never occur. Find the minimal SOP, and compare it with the result obtained without using the don't cares.
For F(A,B,C,D) = Σm(0,1,2,5,8,9,10), obtain the minimal SOP and the minimal POS. Which is cheaper?
Minimise F(A,B,C,D,E) = Σm(0,2,4,6,9,13,21,23,25,29,31) using a 5-variable map.
Minimise F(A,B,C) = Σm(0,1,4,5,6) using a K-map.
Minimise F(A,B,C,D) = Σm(0,1,2,3,5,7,8,9,10,11,13,15).
Minimise F(A,B,C,D) = Σm(1,3,7,11,15) + d(0,2,5). Is the minimal answer unique?
Find the minimal POS of F(A,B,C,D) = ΠM(0,1,2,3,4,10,11) and compare its cost with the minimal SOP.
Use the Quine–McCluskey method to find all prime implicants and a minimal SOP of F(A,B,C,D) = Σm(0,1,3,7,8,9,11,15).
12 questions. 70 % passes the topic quiz (+30 XP, +20 more for 100 %). Exam scoring: +1 correct, −⅓ wrong.
Modelled on real KPSC questions (reworded) with the same concept and answer; each links to its original paper.