Karnaugh map

Comprehensive study notes, diagrams, and exam preparation for Karnaugh map.

Karnaugh Map

Definition

A Karnaugh map (K-map) is a graphical tool used in Boolean algebra to simplify logical expressions by visually grouping adjacent cells that represent combinations of variables. It provides a systematic way to reduce Boolean functions into simpler forms, usually with fewer literals, gates, and hardware cost.

A K-map is especially useful in digital logic design because it helps minimize:

  • the number of logic gates
  • the number of input variables per gate
  • circuit complexity
  • propagation delay

It works by placing truth table values in a grid arranged so that cells differing in only one variable are adjacent. By grouping adjacent 1s for Sum of Products (SOP) simplification, or adjacent 0s for Product of Sums (POS) simplification, redundant terms can be eliminated.


Main Content

1. Structure of a Karnaugh Map

  • A Karnaugh map is a special arrangement of truth table outputs in a grid of 2, 4, 8, 16, ... cells, depending on the number of variables.
  • The cells are arranged using Gray code order, so adjacent cells differ by only one bit. This is crucial because it allows simplification by combining terms that differ in only one variable.

For example:

  • 2 variables → 2² = 4 cells
  • 3 variables → 2³ = 8 cells
  • 4 variables → 2⁴ = 16 cells

A 3-variable K-map may look like this:

        BC
       00 01 11 10
A = 0   _  _  _  _
A = 1   _  _  _  _

Here:

  • rows represent variable A
  • columns represent variables BC in Gray code order: 00, 01, 11, 10

The key idea is that neighboring cells correspond to minterms that differ in exactly one variable, making it possible to combine them.

  • The map visually represents minterms and maxterms from the truth table.
  • The arrangement is designed so simplification can be done by inspection rather than lengthy algebraic manipulation.

2. Grouping Rules and Simplification Principles

  • In a K-map, cells containing 1s are grouped to simplify SOP expressions, while cells containing 0s are grouped to simplify POS expressions.
  • Groups must contain a number of cells that is a power of 2:
  • 1, 2, 4, 8, 16, ... because each group eliminates one or more variables.

Important grouping rules:

  • Groups must be rectangular or square in shape.
  • Groups can wrap around the edges of the map.
  • A cell can belong to more than one group if it helps achieve maximum simplification.
  • The goal is to form the largest possible groups.
  • Every 1 should be included in at least one group, unless it is a don’t care condition.

Example of a 4-cell group:

        00 01 11 10
      +----------------
00    | 1  1  0  0
01    | 1  1  0  0
11    | 0  0  0  0
10    | 0  0  0  0

The four adjacent 1s form one group, reducing variables significantly.

How grouping simplifies:

  • A group of 2 eliminates 1 variable
  • A group of 4 eliminates 2 variables
  • A group of 8 eliminates 3 variables
  • A group of 16 eliminates 4 variables

This is because only the variables that remain constant within the group appear in the simplified term.


3. Simplification of Boolean Functions Using K-Map

  • K-maps are used to convert a complex Boolean function into a simpler equivalent expression.
  • The simplification process can be done for both canonical SOP and canonical POS forms.

For SOP simplification:

  1. Place 1s in the cells corresponding to the minterms where the function output is 1.
  2. Form largest possible groups of adjacent 1s.
  3. Write the simplified expression by keeping only the variables that do not change within each group.

Example:

Suppose the function is:

F(A,B) = Σm(0,1,2)

Truth table minterms:

  • m0 = A’ব’
  • m1 = A’ব
  • m2 = AB’

K-map:

       B
      0 1
A 0   1 1
A 1   1 0

Grouping:

  • m0 and m1 → common term A’ব’ + A’ব = A’
  • m0 and m2 → common term A’ব’ + AB’ = B’

Final simplified expression: F = A' + B'
depending on grouping choice and function structure.

For POS simplification:

  1. Place 0s in the cells corresponding to the maxterms where the function output is 0.
  2. Group adjacent 0s.
  3. Write the simplified product-of-sums expression.

This method is extremely useful when the function has many 1s or many 0s, because it reduces the complexity efficiently.


Working / Process

1. Convert the given Boolean function or truth table into minterms/maxterms

  • Identify all combinations of variables for which the output is 1 (for SOP) or 0 (for POS).
  • Write them in standard canonical form if needed.

2. Draw the appropriate Karnaugh map and fill the values

  • Use the correct number of variables.
  • Arrange rows and columns in Gray code order.
  • Place 1s, 0s, or don’t-care symbols (X) in the correct cells.

3. Group the cells and write the simplified expression

  • Make the largest possible power-of-2 groups.
  • Use wrap-around and overlapping when helpful.
  • From each group, retain only the variables that remain unchanged.
  • Combine the terms to obtain the final simplified Boolean expression.

Example process for a 3-variable function:

Given: F(A,B,C) = Σm(0,1,2,6,7)

K-map setup:

        BC
       00 01 11 10
A=0     1  1  0  1
A=1     0  0  1  1

Possible groups:

  • Group m0 and m1A’ব’
  • Group m2 and m6B C’ or another valid grouping depending on arrangement
  • Group m6 and m7AB

Final answer depends on selected maximal groups, but always leads to a reduced expression compared to the original canonical form.


Advantages / Applications

Simplifies Boolean expressions quickly and visually

  • , especially for small and medium-sized functions.

Reduces hardware cost

  • by minimizing the number of gates and inputs required in a digital circuit.

Improves circuit efficiency

  • , since fewer gates usually mean less delay, less power consumption, and greater reliability.

Additional applications include:

  • designing combinational logic circuits
  • minimizing logic for adders, multiplexers, decoders, encoders, and comparators
  • identifying redundant logic in digital systems
  • optimizing control logic in processors and embedded systems

K-maps are widely used in:

  • digital electronics
  • computer architecture
  • switching theory
  • logic circuit design labs
  • academic problem solving in Boolean algebra

Summary

  • Karnaugh map is a visual method for simplifying Boolean expressions.
  • It uses Gray code adjacency to combine terms and reduce variables.
  • It helps make digital logic circuits smaller, faster, and more efficient.
  • Important terms to remember: minterm, maxterm, Gray code, SOP, POS, don’t care, grouping