Mathwords logoMathwords

Karnaugh Map — Definition & Example

A Karnaugh map (K-map) is a grid that shows a Boolean function's truth table. You simplify the function by circling blocks of neighboring 1s.

For a Boolean function of nn variables, a Karnaugh map is a grid of 2n2^n cells. Its rows and columns are labeled in Gray-code order, so any two cells that share an edge differ in exactly one variable. This includes cells that touch by wrapping around the grid's opposite edges. A rectangular group of 2k2^k adjacent 1-cells stands for one product term with kk fewer variables, because XY+XY‾=XXY + X\overline{Y} = X. Covering every 1 with the fewest, largest groups gives a minimal sum-of-products expression.

Worked Example

Problem: Simplify F(A,B,C)=∑m(1,3,5,6,7)F(A,B,C) = \sum m(1,3,5,6,7), meaning F=1F = 1 exactly when ABCABC is 001,011,101,110,001, 011, 101, 110, or 111111.
Step 1: With 3 variables, the map has 23=82^3 = 8 cells. Use AA for the rows and BCBC for the columns. Put the columns in Gray-code order (00, 01, 11, 10), not binary order. Then place a 1 in each listed minterm's cell.
A\BC000111100011010111\begin{array}{c|cccc} A \backslash BC & 00 & 01 & 11 & 10 \\ \hline 0 & 0 & 1 & 1 & 0 \\ 1 & 0 & 1 & 1 & 1 \end{array}
Step 2: Circle the 2-by-2 block in columns 01 and 11. Across that block, AA and BB both change, but C=1C = 1 stays fixed. A group of 4 cells removes log⁡24=2\log_2 4 = 2 variables, so the block reduces to CC. Next, circle the pair in row A=1A = 1, columns 11 and 10. Only CC changes there, so the pair gives ABAB. Cell 111 sits in both groups. Overlapping groups are allowed.
block→C,pair→AB\text{block} \to C, \qquad \text{pair} \to AB
Step 3: Write one product term for each group, then OR the terms together.
F=C+ABF = C + AB
Answer: F=C+ABF = C + AB. This needs one AND gate and one OR gate, while the original expression needs five 3-input AND terms.

Why It Matters

In a digital logic or computer architecture course, you use K-maps to design circuits with fewer gates. Fewer gates make a circuit cheaper, faster, and less power-hungry. K-maps work well for up to about 4 variables. Larger problems are handled by software, using exact methods such as Quine–McCluskey or faster heuristics such as Espresso.

Common Mistakes

Mistake: Labeling the columns in binary order (00, 01, 10, 11).
Correction: In binary order, the cells for 01 and 10 sit next to each other but differ in two variables, so a group across them is invalid. Use Gray-code order (00, 01, 11, 10). Then neighboring cells, including those that wrap around the edges, differ in exactly one variable.

Related Terms