Karnaugh Map Worked Examples
The rules for Karnaugh maps take five minutes to learn and considerably longer to apply well. What follows is six maps solved in full, chosen because each one is where a particular mistake usually happens.
Every map below is live. Groups are outlined and labelled with their product term, and you can click cells to change the function and watch the answer move.
Example 1: one group is the whole answer
Four 1s, all in the cells where C is 0. They form one block of four.
F = C'
4 ones, covered by 1 group. This grouping is the only minimal one.
The answer is C'. A group of four on a three-variable map eliminates two of the three variables, and the one left is the only variable that holds the same value across every cell in the group. Here that is C, which is 0 throughout, so the term is C'.
The common error is grouping these as two pairs. That is not wrong, it is just twice the size: two terms of two literals each instead of one term of one literal.
Example 2: the group that wraps
Same map with one extra 1 added at minterm 1.
F = A'B' + C'
5 ones, covered by 2 groups. This grouping is the only minimal one.
The answer is A'B' + C'. The new cell cannot join the block of four, so it needs a group of its own, and the largest one available runs off the edge of the map and continues on the other side.
Edges wrap because the columns are labelled in Gray code. The first and last columns differ in exactly one bit, which is the same relationship any two side-by-side columns have. Nothing special is happening; the map is just drawn flat when it is really a cylinder.
Example 3: four corners
Four 1s, one in each corner of a 4-variable map, touching nothing else.
F = B'D'
4 ones, covered by 1 group. This grouping is the only minimal one.
They are one group, and the answer is B'D'. Both axes wrap, so the corners are all mutually adjacent. The widget draws this as four dashed pieces to show they belong to a single group.
If you can see this one without help, you have understood the wraparound rule. It is the standard exam question for exactly that reason.
Example 4: groups are allowed to overlap
Seven 1s in an L-shaped arrangement. There is no way to cover them with non-overlapping blocks without using more groups than necessary.
F = A'B' + A'D + A'C
7 ones, covered by 3 groups. This grouping is the only minimal one.
The answer is A'B' + A'D + A'C, in 3 terms. Notice that some cells sit inside two groups at once.
Overlap costs nothing. A 1 covered twice is still just a 1: in Boolean algebra x + x = x, so repeating coverage never changes the function. What matters is that every 1 is covered at least once and that no group is redundant.
Example 5: don't-cares change the shape
The BCD comparison from the previous lesson. Six inputs cannot occur, so they are marked X.
F = BD + BC + A
5 ones and 6 don't-cares, covered by 3 groups. This grouping is the only minimal one.
The answer is BD + BC + A. Treating those six cells as 0 instead would give A'BD + A'BC + AB'C', which is 3 terms and 9 literals against 3 and 5.
Example 6: two answers, both minimal
This one has a property that surprises people the first time: there is more than one correct minimal answer.
F = A'C + AC' + A'B'
5 ones, covered by 3 groups. There is 1 other grouping that is just as small.
The solver reports A'C + AC' + A'B', and there is one other grouping with exactly the same number of terms and literals. None of them is more correct than the others.
This is why a grader that compares your answer against one stored solution is unreliable. The practice tool below checks the two things that actually define a right answer: that your groups reproduce the function, and that no smaller grouping exists.
A procedure that works
When a map does not fall out by inspection, this order rarely goes wrong.
| Step | What to do |
|---|---|
| 1 | Find any 1 that can only be covered one way. The group covering it is forced, so commit to it. |
| 2 | Repeat until no forced 1s remain. |
| 3 | For whatever is left, take the largest legal group that covers an uncovered 1. |
| 4 | Stop as soon as every 1 is covered. |
| 5 | Check each group: if all its 1s are covered by others, delete it. |
Step 5 is the one people skip. A redundant group produces a correct expression with an extra term in it, which is the most common way to lose marks on an otherwise right answer.
Now do it yourself
A new random map every time, marked against the true minimum. Start on easy and move up when the 3-variable maps stop being interesting.
No groups yet.
Cover every 1 using 2 groups and 4 literals.
Click cells to select them, then confirm. Take the largest legal group you can each time: groups may wrap around the edges of the map.
There is a full-page version at the K-map practice generator, and a solver if you want to check a map of your own.