EN

Karnaugh map

Solver for 2 to 6 variables with coloured groups

Karnaugh map solver

Click each cell to switch it between 0, 1 and X (don't care), or type the minterms. The tool groups the ones and gives the simplified function.

Function
Minimal sum of products (SOP)–
Minimal product of sums (POS)–

Groups chosen

How to solve a Karnaugh map

1. What it is and what it is for

A Karnaugh map is a graphical form of the truth table in which neighbouring cells differ in only one variable (rows and columns follow the Gray code: 00, 01, 11, 10). Grouping neighbouring cells is therefore equivalent to applying the property \(X\,Y + X\,\overline{Y} = X\) and eliminating variables, without doing the algebra by hand.

2. Grouping rules

  1. Groups can only have 1, 2, 4, 8, 16 or 32 cells, and must be rectangular.
  2. The bigger, the better: each time the size doubles, one variable disappears.
  3. The edges touch: the first and last row (or column) are neighbours, and the four corners form a group.
  4. A cell can be in several groups. Use the X cells only if they help to enlarge a group.
  5. Use the smallest number of groups that covers all the ones.
  6. With 5 and 6 variables, columns (or rows) placed symmetrically about the centre of the map are also neighbours: that is why some groups appear split into two blocks.

3. Reading each group

In each group, the variables that change value are eliminated. Those that do not change stay in the term: uncomplemented if they are 1 and complemented if they are 0. For the product-of-sums form, the zeros are grouped and read the other way round (complemented if they are 1).

Solved exercise: \(f = \sum m(0, 1, 2, 5, 6, 7, 8, 9, 10, 14)\)

This is the function loaded in the map. The minimal groups are:

\[ f = \overline{B}\,\overline{C} + C\,\overline{D} + \overline{A}\,B\,D \]
Solved exercise with don't cares: \(f = \sum m(1, 3, 7, 11, 15) + d(0, 2, 5)\)

The whole column CD = 11 (3, 7, 11, 15) gives \(C\,D\). To cover the 1, use the don't cares 0 and 2 or 5: with 1, 3, 5 and 7 you get \(\overline{A}\,D\). Result: \(f = C\,D + \overline{A}\,D\).

Related: Boolean algebra: laws and simplifier. Type an expression and get its map and its minimal form.