Karnaugh map

From Academic Kids

The Karnaugh map, also known as a Veitch diagram (K-map or KV-map for short), is a tool to facilitate management of Boolean algebraic expressions. The Karnaugh map was invented in 1950 by Maurice Karnaugh, a telecommunications engineer at Bell Labs. Normally, extensive calculations are required to obtain the minimal expression of a Boolean function, but one can use a Karnaugh map instead. Karnaugh maps make use of the human brain's excellent pattern-matching capability to decide which terms should be combined to get the simplest expression. In addition, K-maps permit the rapid identification and elimination of potential race hazards, something that boolean equations alone cannot do.

A Karnaugh map is an excellent aid for simplification of up to six variables, but with more variables it becomes hard even for our brain to discern optimal patterns. For expressions having more than 4 variables, the Quine-McCluskey algorithm, also called the method of prime implicants, should be used. This algorithm uses a deterministic approach to simplification of boolean expressions. Thus, following the steps of the algorithm ensures that the simplest expression can be found. This is especially useful for creating software programs that simplify any given boolean expression.

Karnaugh maps also help teach about Boolean functions and minimization.



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
 1.  0 0 0 1   0
 2.  0 0 1 0   0
 3.  0 0 1 1   0
 4.  0 1 0 0   1
 5.  0 1 0 1   0
 6.  0 1 1 0   0 
 7.  0 1 1 1   0
 8.  1 0 0 0   1
 9.  1 0 0 1   1
10.  1 0 1 0   1
11.  1 0 1 1   1 
12.  1 1 0 0   1
13.  1 1 0 1   0
14.  1 1 1 0   1
15.  1 1 1 1   1

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

Missing image
Sample Karnaugh map, style #1.

The binary digits in the map represent the function's output for any given combination of inputs. We write 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 1's in the map. The encirclings can only encompass 2n fields, where n is an integer ≥ 0 (1, 2, 3, 4...). They should be as large as possible. The optimal encirclings in this map are marked by the green, red and blue lines.

For each of these encirclings we find those variables that have 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 encircling.
  • 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'.

It should be mentioned that encirclings can wrap around edges, so ABD' is a proper encircling, even though it is not an optimal encircling.

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

It is worth mentioning 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.

Race hazards

Karnaugh maps are useful for detecting and eliminating race hazards. In the above example, a potential race condition exists when C and D are both 0, A is a 1, and B changes from a 0 to a 1 (moving from the green state to the blue state). For this case, the output is defined to remain unchanged at 1, but because this transition is not covered by a specific term in the equation, a potential for a glitch (a momentary transition of the output to 0) exists. This is very easy to spot using a Karnaugh map, because a race condition may exist when moving between any pair of adjacent, but disjointed, regions circled on the map. A harder possible glitch to spot is if D was 0 and A and B were both 1, with C changing from 0 to 1. In this case the glitch wraps around from the bottom of the map to the top of the map. Whether these glitches do occur depends on the physical nature of the implementation, and whether we need to worry about it depends on the application. In this case, an additional term of +AD' would eliminate the potential race hazard, bridging between the green and blue output states or blue and red output states. The term is redundant in terms of the static logic of the system, but such redundant terms are often needed to assure race-free dynamic performance.

See also

External links


  • Maurice Karnaugh, The Map Method for Synthesis of Combinational Logic Circuits, Trans. AIEE. part I, 72(9):593-599, November 1953.

fr:Table_de_Karnaugh pl:Metoda Karnaugh ro:Diagramă Karnaugh sr:Карно мапа


Academic Kids Menu

  • Art and Cultures
    • Art (http://www.academickids.com/encyclopedia/index.php/Art)
    • Architecture (http://www.academickids.com/encyclopedia/index.php/Architecture)
    • Cultures (http://www.academickids.com/encyclopedia/index.php/Cultures)
    • Music (http://www.academickids.com/encyclopedia/index.php/Music)
    • Musical Instruments (http://academickids.com/encyclopedia/index.php/List_of_musical_instruments)
  • Biographies (http://www.academickids.com/encyclopedia/index.php/Biographies)
  • Clipart (http://www.academickids.com/encyclopedia/index.php/Clipart)
  • Geography (http://www.academickids.com/encyclopedia/index.php/Geography)
    • Countries of the World (http://www.academickids.com/encyclopedia/index.php/Countries)
    • Maps (http://www.academickids.com/encyclopedia/index.php/Maps)
    • Flags (http://www.academickids.com/encyclopedia/index.php/Flags)
    • Continents (http://www.academickids.com/encyclopedia/index.php/Continents)
  • History (http://www.academickids.com/encyclopedia/index.php/History)
    • Ancient Civilizations (http://www.academickids.com/encyclopedia/index.php/Ancient_Civilizations)
    • Industrial Revolution (http://www.academickids.com/encyclopedia/index.php/Industrial_Revolution)
    • Middle Ages (http://www.academickids.com/encyclopedia/index.php/Middle_Ages)
    • Prehistory (http://www.academickids.com/encyclopedia/index.php/Prehistory)
    • Renaissance (http://www.academickids.com/encyclopedia/index.php/Renaissance)
    • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
    • United States (http://www.academickids.com/encyclopedia/index.php/United_States)
    • Wars (http://www.academickids.com/encyclopedia/index.php/Wars)
    • World History (http://www.academickids.com/encyclopedia/index.php/History_of_the_world)
  • Human Body (http://www.academickids.com/encyclopedia/index.php/Human_Body)
  • Mathematics (http://www.academickids.com/encyclopedia/index.php/Mathematics)
  • Reference (http://www.academickids.com/encyclopedia/index.php/Reference)
  • Science (http://www.academickids.com/encyclopedia/index.php/Science)
    • Animals (http://www.academickids.com/encyclopedia/index.php/Animals)
    • Aviation (http://www.academickids.com/encyclopedia/index.php/Aviation)
    • Dinosaurs (http://www.academickids.com/encyclopedia/index.php/Dinosaurs)
    • Earth (http://www.academickids.com/encyclopedia/index.php/Earth)
    • Inventions (http://www.academickids.com/encyclopedia/index.php/Inventions)
    • Physical Science (http://www.academickids.com/encyclopedia/index.php/Physical_Science)
    • Plants (http://www.academickids.com/encyclopedia/index.php/Plants)
    • Scientists (http://www.academickids.com/encyclopedia/index.php/Scientists)
  • Social Studies (http://www.academickids.com/encyclopedia/index.php/Social_Studies)
    • Anthropology (http://www.academickids.com/encyclopedia/index.php/Anthropology)
    • Economics (http://www.academickids.com/encyclopedia/index.php/Economics)
    • Government (http://www.academickids.com/encyclopedia/index.php/Government)
    • Religion (http://www.academickids.com/encyclopedia/index.php/Religion)
    • Holidays (http://www.academickids.com/encyclopedia/index.php/Holidays)
  • Space and Astronomy
    • Solar System (http://www.academickids.com/encyclopedia/index.php/Solar_System)
    • Planets (http://www.academickids.com/encyclopedia/index.php/Planets)
  • Sports (http://www.academickids.com/encyclopedia/index.php/Sports)
  • Timelines (http://www.academickids.com/encyclopedia/index.php/Timelines)
  • Weather (http://www.academickids.com/encyclopedia/index.php/Weather)
  • US States (http://www.academickids.com/encyclopedia/index.php/US_States)


  • Home Page (http://academickids.com/encyclopedia/index.php)
  • Contact Us (http://www.academickids.com/encyclopedia/index.php/Contactus)

  • Clip Art (http://classroomclipart.com)
Personal tools