## Encyclopedia > Karnaugh map

Article Content

# Karnaugh map

The Karnaugh map (K-map for short) was invented in 1950 by Maurice Karnaugh[?]. It is a very useful tool to facilitate Boolean algebraic expressions. Normally, extensive calculations are required to receive the minimal expression of a Boolean function. Instead of making algebraic simplifications one can use a Karnaugh map. Karnaugh maps make use of the human brain's excellent 'pattern matching' capability to decide which terms should be combined to get the most simple expression. A Karnaugh map is an excellent aid for simplification of up to six variables; with more variables it becomes hard even for our brain to discern optimal patterns.

Karnaugh maps also help teach about Boolean functions and minimization.

### Example

Consider the following function:

f(A, B, C, D) = E(4, 8, 9, 10, 11, 12, 14, 15)

This function has this truth table:

``` A B C D   f
0 0 0 0   0
0 0 0 1   0
0 0 1 0   0
0 0 1 1   0
0 1 0 0   1
0 1 0 1   0
0 1 1 0   0
0 1 1 1   0
1 0 0 0   1
1 0 0 1   1
1 0 1 0   1
1 0 1 1   1
1 1 0 0   1
1 1 0 1   0
1 1 1 0   1
1 1 1 1   1.
```

The input variables can be combined in 16 different ways, therefore our Karnaugh map has to have 16 positions. The most convenient way to arrange this is in a 4x4 Karnaugh map.

The binary digits in the map represents the functions output at any given combination of inputs. We write down 0 in the upper leftmost corner of the map because f = 0 when A = 0, B = 0, C = 1, D = 0. Similarly we mark the bottom right corner as 1 because A = 1, B = 0, C = 0, D = 0 gives f = 1.

After the Karnaugh map has been constructed our next task is to find the minimal terms to use in the final expression. These terms are found by encircling the the 1's in the map. The encirclings can only encompass 2n fields, where n is an integer ≥ 0 (1, 2, 4, 8...). They should be as large as possible. The optimal encirclings in this map is marked by the green, red and blue encirclings.

For each of these encirclings we find those variables that has the same state in each of the fields in the encircling. For the first encircling (the red one) we find that:

• The variable A maintains the same state (1) in the whole encircling, therefore it should be included in the term for the red enricling.
• Variable B does not maintain the same state (it shifts from 1 to 0), and should therefore be excluded.
• Similarly D changes but C does not.

The first term becomes AC.

For the green encircling we see that A and B maintains the same state, C and D changes. But B is 0 and has to be negated before it can be included.

The second term becomes AB'.

By working the blue encircling the same way we find the term BC'D' and our final expression for the function is ready: AC + AB' + BC'D'.

The inverse of a function is solved in the same way by encircling the 0's instead.

Worth mentioning is that the number of product terms for an encircling P is:

P = 2log(n/x)

where n is the number of variables in the Karnaugh map and x the number of fields encircled.

All Wikipedia text is available under the terms of the GNU Free Documentation License

Search Encyclopedia
 Search over one million articles, find something about almost anything!

Featured Article
 Battle Creek, Michigan ... and the average family size is 3.04. In the city the population is spread out with 27.2% under the age of 18, 8.7% from 18 to 24, 29.5% from 25 to 44, 21.0% from 45 to ...