Overview

Logic design is about analysing, building and minimising Boolean functions. A circuit built from a shorter expression uses fewer gates, so finding the smallest equivalent expression matters. Simplifying by algebra alone works but takes experience and a certain amount of luck, and it gets harder quickly as the number of variables grows. Some simplifications are obvious: AB + AB clearly depends only on B. Others are not: it is far from obvious that AB + BC + AC is the same function as AB + AC.

The Karnaugh map (Maurice Karnaugh, 1953) is a tool that turns this into pattern recognition. It lays the truth table out as a grid arranged so that any two neighbouring cells differ in exactly one variable. Groups of adjacent 1's then correspond directly to simplified product terms.

Key Concepts:

  • A map for n variables has 2n cells, one for each row of the truth table.
  • Row and column headings are written in Gray code order (00, 01, 11, 10) so that neighbours differ by a single bit. The map also wraps around: the first and last rows are neighbours, as are the first and last columns.
  • Circle rectangular groups of 1's whose size is a power of two. Each group becomes one product term containing only the variables that are constant across the group.
  • The minimal expression is the OR of the group terms.

Key Concepts

Laying Out the Map

Write 1 for an uncomplemented variable and 0 for a complemented one, so the term ABC corresponds to the binary cell 101. Each cell is filled with the function's value for that input combination.

Two variables

A \ B01
00001
11011

Cell labels show the values of AB.

Three variables

C \ AB00011110
0000010110100
1001011111101

Cell labels show ABC. Note the column order 00, 01, 11, 10.

Four variables

CD \ AB00011110
000000010011001000
010001010111011001
110011011111111011
100010011011101010

Cell labels show ABCD. Both the rows and the columns use Gray code order.

Grouping Rules

  • Groups contain only 1's; no zeros are allowed.
  • Groups are rectangles (no diagonals) of 1, 2, 4, 8 or 16 cells.
  • Make each group as large as possible.
  • Every 1 must be in at least one group.
  • Groups may overlap.
  • Groups may wrap around the edges of the map.
  • Use the fewest groups possible.

Reading a Group as a Term

Within a group, look at each variable. If it has the same value in every cell of the group, keep it (uncomplemented for 1, complemented for 0). If it changes, drop it. In a four-variable map a group of two cells eliminates one variable, a group of four eliminates two, and a group of eight eliminates three.

Examples

Example 1: Two variables

Minimise f(A, B) = AB + AB.

A \ B01
010
110

The two 1's form a vertical pair in the B = 0 column. A changes within the group (0 then 1), so it is dropped; B is 0 throughout, so the term is B.

f = B

Example 2: Three variables

Minimise f(A, B, C) = AB + BC + AC.

First find which cells are 1. AB covers 100 and 101; BC covers 001 and 101; AC covers 001 and 011.

C \ AB00011110
00001
11101
  1. The two 1's in the AB = 10 column (cells 100 and 101) form a group. C changes; A = 1 and B = 0 are constant. Term: AB.
  2. The two 1's in the C = 1 row under AB = 00 and 01 (cells 001 and 011) form a group. B changes; A = 0 and C = 1 are constant. Term: AC.
  3. Every 1 is now covered, so the BC term from the original expression was redundant.

f = AB + AC

Example 3: Wrapping around

Minimise f(A, B, C) = ABC + ABC + AB + AC.

Cells that are 1: 000 (from the first and fourth terms), 110, 100 and 101 (from AB), and 010 (from AC).

C \ AB00011110
01111
10001
  1. The whole C = 0 row is 1's: a group of four. Only C is constant. Term: C.
  2. The remaining 1 at 101 pairs with 100 directly above it. Term: AB.

f = C + AB

Practice Problems

Type complements with an apostrophe (A' for A), write AND as juxtaposition (AB) and OR as +. Terms may be given in any order.

Problem 1 Junior

Use a Karnaugh map to minimise the function whose truth table gives f(A, B) = 1 for (A, B) = (0, 0), (0, 1) and (1, 1), and f = 0 for (1, 0).

Problem 2 Junior

Use a Karnaugh map to minimise f = ABC + ABC + ABC + ABC.

Problem 3 Intermediate

Use a Karnaugh map to minimise f = ABC + ABC + ABC + ABC + ABC.

Problem 4 Intermediate

The Karnaugh map below shows a three-variable function. Write its minimal sum-of-products expression.

C \ AB00011110
01001
11100

Problem 5 Senior

Use a four-variable Karnaugh map to minimise f = ABD + ABCD + ABC + BCD + ABCD.