Skip to main content
โšก Calmops

Karnaugh Maps: Simplifying Boolean Functions

Introduction

Karnaugh maps (K-maps) are a visual tool for simplifying Boolean functions and designing efficient digital circuits. While algebraic methods can simplify Boolean expressions, Karnaugh maps provide an intuitive graphical approach that often reveals simplifications that might be missed through algebraic manipulation alone. This technique is essential for digital logic design, circuit optimization, and understanding Boolean function structure.

This article explores Karnaugh map construction, simplification techniques, and practical applications in circuit design.

Historical Context

Karnaugh maps were invented by Maurice Karnaugh in 1953 as an improvement over Veitch diagrams. They became a standard tool in digital logic design and remain widely used in circuit design education and practice. The visual nature of K-maps makes them particularly effective for functions with 2-6 variables, though they can be extended to larger functions.

Fundamentals

Boolean Functions and Truth Tables

A Boolean function maps binary inputs to binary outputs:

Example: f(x, y, z) = xy + yz

Truth Table:

x y z | f
------|---
0 0 0 | 0
0 0 1 | 0
0 1 0 | 0
0 1 1 | 1
1 0 0 | 0
1 0 1 | 0
1 1 0 | 1
1 1 1 | 1

Minterms and Maxterms

Minterm: A product term where each variable appears exactly once (complemented or not)

  • Example: xyz, x’yz, xy’z'

Maxterm: A sum term where each variable appears exactly once

  • Example: (x+y+z), (x’+y+z), (x+y’+z')

Sum of Minterms (SOP): f = ฮฃ mแตข (OR of minterms where f = 1)

Product of Maxterms (POS): f = ฮ  Mแตข (AND of maxterms where f = 0)

Karnaugh Map Construction

2-Variable K-Map

Layout:

     y'  y
x'  [0] [1]
x   [2] [3]

Example: f(x, y) = xy + x’y

     y'  y
x'  [0] [1]  โ† x'y = 1
x   [0] [1]  โ† xy = 1

Simplified: f = y

3-Variable K-Map

Layout:

       y'z' y'z yz yz'
x'    [0]  [1] [3] [2]
x     [4]  [5] [7] [6]

Gray Code Order: Adjacent cells differ by one variable

Example: f(x, y, z) = xy + yz

       y'z' y'z yz yz'
x'    [0]  [0] [0] [0]
x     [0]  [0] [1] [1]

Grouping: yz (covers cells 3, 7)
Simplified: f = yz

4-Variable K-Map

Layout:

         y'z' y'z yz yz'
w'x'    [0]  [1] [3] [2]
w'x     [4]  [5] [7] [6]
wx      [12] [13][15][14]
wx'     [8]  [9] [11][10]

Example: f(w, x, y, z) = w’xy’z’ + w’xyz + wxy’z’ + wxyz

         y'z' y'z yz yz'
w'x'    [0]  [0] [0] [0]
w'x     [1]  [0] [1] [0]
wx      [0]  [0] [1] [0]
wx'     [0]  [0] [0] [0]

Grouping: w'xy'z' (cell 4), w'xyz (cell 7), wxy'z' (cell 12), wxyz (cell 15)

5-Variable K-Map

Use two 4-variable maps side by side (one for v = 0, one for v = 1)

6-Variable K-Map

Use four 4-variable maps in a 2ร—2 arrangement

Simplification Techniques

Grouping Rules

Valid Groups:

  • Must contain 1, 2, 4, 8, 16, … cells (powers of 2)
  • Cells must be adjacent (horizontally or vertically, including wraparound)
  • Cells must form a rectangle

Invalid Groups:

  • Diagonal adjacency (not allowed)
  • Non-rectangular shapes
  • Groups with non-power-of-2 sizes

Simplification Process

Step 1: Mark all 1s in the K-map

Step 2: Group adjacent 1s into rectangles (largest possible groups)

Step 3: For each group, identify variables that don’t change

Step 4: Write the simplified term for each group

Step 5: OR all simplified terms

Example: 3-Variable Simplification

Function: f(x, y, z) = x’y’z + x’yz + xy’z + xyz

Truth Table:

x y z | f
------|---
0 0 1 | 1
0 1 1 | 1
1 0 1 | 1
1 1 1 | 1

K-Map:

       y'z' y'z yz yz'
x'    [0]  [1] [1] [0]
x     [0]  [1] [1] [0]

Group 1: x'y'z, x'yz โ†’ x'z (y changes)
Group 2: xy'z, xyz โ†’ xz (y changes)
Combined: x'z + xz = z

Simplified: f = z

Don’t Care Conditions

Don’t Care (X): Outputs that can be either 0 or 1 (usually for invalid inputs)

Advantage: Can be treated as 1 or 0 to create larger groups

Example:

       y'z' y'z yz yz'
x'    [0]  [X] [1] [0]
x     [0]  [X] [1] [0]

Treating X as 1:
Group: x'y'z, x'yz, xy'z, xyz โ†’ z

Advanced Simplification

Prime Implicants

Prime Implicant: A group that cannot be enlarged without including a 0

Essential Prime Implicant: A prime implicant that covers at least one 1 not covered by any other prime implicant

Procedure:

  1. Find all prime implicants
  2. Identify essential prime implicants
  3. Cover remaining 1s with minimum additional prime implicants

Quine-McCluskey Algorithm

For functions with many variables, use the Quine-McCluskey algorithm:

Step 1: List all minterms in binary

Step 2: Group by number of 1s

Step 3: Compare adjacent groups, combining terms that differ in one bit

Step 4: Repeat until no more combinations possible

Step 5: Find essential prime implicants

Example: f(x, y, z) = ฮฃ(1, 3, 5, 7)

Minterms: 001, 011, 101, 111

Group 0: 001
Group 1: 011, 101
Group 2: 111

Combining:
001, 011 โ†’ 0_1 (x'z)
001, 101 โ†’ _01 (yz)
011, 111 โ†’ _11 (yz)
101, 111 โ†’ 1_1 (xz)

Prime implicants: x'z, yz, xz
Essential: yz (covers 011, 111)
Remaining: 001, 101 โ†’ x'z, xz
Simplified: yz + x'z + xz = yz + z = z

Practical Applications

Circuit Design

Goal: Minimize number of gates and connections

Process:

  1. Write Boolean function from specification
  2. Create K-map
  3. Simplify using K-map
  4. Implement simplified function with gates

Example: 2-to-1 Multiplexer

Inputs: A, B, S (select)
Output: Y = S'A + SB

K-Map:
       A'B' A'B AB AB'
S'    [0]  [1] [1] [0]
S     [0]  [0] [1] [0]

Simplified: Y = A'B + AB = B (when A = B)
Actually: Y = S'A + SB (no further simplification)

Logic Optimization

Reduce circuit complexity:

  • Fewer gates
  • Fewer connections
  • Lower power consumption
  • Faster operation

Hazard Detection

Static Hazard: Output momentarily changes when it shouldn’t

Dynamic Hazard: Output changes multiple times when it should change once

K-Map Detection: Adjacent 1s not in same group indicate potential hazards

Limitations and Extensions

Limitations

  • Practical for up to 6 variables
  • Beyond 6 variables, becomes difficult to visualize
  • Doesn’t handle multiple outputs efficiently

Extensions

Tabular Method (Quine-McCluskey): Handles more variables algorithmically

Espresso Algorithm: Heuristic algorithm for multi-output minimization

Computer-Aided Design: CAD tools for complex circuits

Glossary

Adjacent Cells: Cells differing in exactly one variable

Don’t Care: Output that can be 0 or 1 (usually invalid input)

Essential Prime Implicant: Prime implicant covering 1s not covered by others

Gray Code: Binary code where adjacent values differ by one bit

Karnaugh Map: Visual tool for simplifying Boolean functions

Minterm: Product term with each variable appearing exactly once

Prime Implicant: Maximal group of 1s that cannot be enlarged

Simplification: Reducing Boolean expression to fewer terms/literals

Practice Problems

Problem 1: Simplify f(x, y) = x’y’ + x’y + xy using a K-map.

Solution:

K-Map:
     y'  y
x'  [1] [1]
x   [0] [1]

Group 1: x'y', x'y โ†’ x' (y changes)
Group 2: x'y, xy โ†’ y (x changes)
Simplified: f = x' + y

Problem 2: Find the simplified form of f(x, y, z) = ฮฃ(0, 1, 2, 3, 5, 7).

Solution:

K-Map:
       y'z' y'z yz yz'
x'    [1]  [1] [1] [1]
x     [0]  [1] [1] [0]

Group 1: x'y'z', x'y'z, x'yz, x'yz' โ†’ x' (y, z change)
Group 2: x'yz, xyz โ†’ yz (x changes)
Simplified: f = x' + yz

Problem 3: Minimize f(w, x, y, z) = ฮฃ(0, 2, 5, 7, 8, 10, 13, 15) with don’t cares at (1, 4, 6, 11, 12, 14).

Solution: Use K-map with don’t cares treated as 1s where beneficial to form larger groups.

Conclusion

Karnaugh maps remain an essential tool for digital logic design and Boolean function simplification. Their visual nature makes them intuitive for understanding Boolean function structure and identifying simplification opportunities. While computer-aided tools handle larger functions, understanding K-maps provides valuable insight into logic optimization principles.

For students and practitioners of digital logic design, mastering Karnaugh maps is fundamental to creating efficient, cost-effective circuits. Combined with other optimization techniques, K-maps form the foundation of modern digital circuit design.

Comments