Introduction
The Quine-McCluskey (QM) method finds all prime implicants of a Boolean function by systematically combining minterms, then selects a minimum cover with a prime-implicant chart. It is the syllabus's tabular minimization technique: the same mathematics as K-maps, but mechanical, so it works for more variables and can be programmed.
The method has two stages. Stage A builds every prime implicant by repeated merging of bit strings. Stage B chooses a cheapest set of primes that covers every 1 of the function. The method yields the number of prime implicants, the number of essential ones, the entries of a combination table, and the final minimal SOP.
Prerequisites
- Karnaugh Maps: prime implicants, essential primes, don't-cares, covering.
Core concepts
Cubes as strings
A product term over ordered variables is written as an -character string over : 1 for an uncomplemented literal, 0 for a complemented literal and for an absent variable. With variables , the string is and covers minterms 3 and 7. A string with dashes covers minterms.
Stage A: find prime implicants
- List all minterms and don't-cares as -bit strings, grouped by the number of 1 bits (the index).
- Compare every string with every string in the next group only. Two strings combine when they have dashes in the same positions and differ in exactly one of the other positions. Write the merged string with a new dash there and check off both parents.
- Repeat step 2 on the list of merged strings, column by column, until no merge is possible. Record each merged string once, even if several pairs produce it.
- Strings never checked off are the prime implicants.
Why only adjacent groups. Two strings that differ in exactly one fixed bit have indices that differ by exactly 1, so comparing a group only with the next group finds every merge.
Stage B: prime-implicant chart
- Rows: prime implicants. Columns: onset minterms only (don't-cares need not be covered).
- Star a cell when the prime covers that minterm.
- A column with a single star marks an essential prime; select it, delete its row and all columns it covers.
- Row dominance. If row covers every remaining column of row and costs no more, delete .
- Column dominance. If every row that covers column also covers column , delete (covering will cover automatically).
- Repeat until every column is covered or the chart is cyclic (no essential row, no dominance left); then use Petrick's method or branching.
Petrick's method
Name the remaining primes . For each uncovered column write the OR of the names of the rows that cover it, and AND these clauses together. Multiply out into a sum of products (using to drop supersets). Each product is an irredundant cover; choose one with the fewest primes, then the fewest literals.

How it works
Don't-cares in QM
Include don't-care minterms in Stage A so they can enlarge implicants. Omit their columns in Stage B so they are not required in the cover. A prime that covers only don't-cares (and no onset minterm) can be discarded at once.
Completeness
Stage A enumerates every prime implicant of the onset plus don't-care set: every implicant is a cube, every cube of size arises by merging two cubes of size , and only cubes contained in no larger implicant survive unchecked. Stage B then solves the covering problem exactly when Petrick's method is used.
Algorithms and pseudocode
Pseudocode uses strings over and <- for assignment.
QM-PRIMES(onset, dontcares, n)
1 current <- onset union dontcares, as n-bit strings
2 primes <- empty set
3 while current is not empty
4 next <- empty set; used <- empty set
5 for each pair (a, b) in current with equal dash positions
6 if a and b differ in exactly one non-dash position i then
7 add (a with position i replaced by '-') to next
8 add a and b to used
9 primes <- primes union (current minus used)
10 current <- next
11 return primes minus {p : p covers no onset minterm}
QM-COVER(primes, onset) // return one minimum cover
1 rows <- primes; remaining <- onset; chosen <- empty set
2 repeat
3 select an essential row p, if one exists, in chart (rows, remaining)
4 if p exists then
5 chosen <- chosen union {p}
6 remaining <- remaining minus columns covered by p; rows <- rows minus {p}
7 apply cost-respecting row and column dominance to (rows, remaining)
8 until no change
9 if remaining is not empty then
10 minimumSets <- PETRICK(rows, remaining)
11 choose one set S from minimumSets
12 chosen <- chosen union S
13 return chosen
PETRICK(rows, columns)
1 S <- { empty set } // partial covers
2 for each column u in columns
3 C <- rows that cover u
4 S <- { s union {p} : s in S, p in C }
5 delete from S every set that strictly contains another set in S
6 return the sets in S with fewest rows, ties broken by fewest literalsCost. Stage A on strings in a column compares at most pairs, each in time; there are at most columns. QM is exact; it is not fast.
| Procedure | Best case | Worst case |
|---|---|---|
| QM-PRIMES | No two minterms are adjacent, for example odd parity: one column, at most comparisons, and every minterm is its own prime (8 primes for ) | : column holds all cubes with dashes, so all cubes are built (81 for ) in columns, and comparing pairs within columns costs |
| QM-COVER | The essential primes cover every column, as in the Karnaugh Maps note's Figure 1 function: one pass, , and PETRICK never runs | A cyclic chart: no essentials, no dominance, everything goes to PETRICK |
| PETRICK | One column left: one set per covering row | columns with stars each give up to selections before absorption, exponential in |
For Example 1 below, PETRICK sees columns with stars each: selections, 18 distinct sets, and 5 sets after absorption (the two 3-prime covers and three 4-prime covers). Minimum cover is set cover, which is NP-hard, so no known exact method is polynomial in the worst case. There is no useful average case: the cost depends on how many implicants the onset has, anywhere from to .
Mathematical explanation
Merging two cubes that differ in one fixed position is the combining rule , so every merged string is an implicant. A string is left unchecked exactly when no implicant one dimension larger contains it, which is the definition of prime. Every minimal SOP is a sum of primes (removing a literal from a non-prime term would lower the cost), so searching among primes loses nothing. The chart step is minimum set cover over the onset columns, with each row weighted by its literal count.
Worked examples
Example 1: with (variables )
Stage A, column 1 (minterms by index):
| Index | Minterms |
|---|---|
| 0 | 000 (0) |
| 1 | 001 (1), 010 (2) |
| 2 | 101 (5), 110 (6) |
| 3 | 111 (7) |
Column 2 (merges of adjacent groups): ; ; ; ; ; . Every minterm is checked off. Pairs such as 1 and 2 are in the same group and never combine; 2 and 5 are in adjacent groups but differ in three bits.
Column 3. No two column-2 strings have the same dash position and differ in one bit: and differ in two bits, and in two, and in two. So the six pairs are the prime implicants: , , , , , .
Stage B.
| PI | 0 | 1 | 2 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|
| * | * | |||||
| * | * | |||||
| * | * | |||||
| * | * | |||||
| * | * | |||||
| * | * |
Every column has exactly two stars, so no prime is essential and no row or column dominates another: the chart is cyclic. Petrick's method gives
whose smallest products are and . So the two minimal SOPs are
each with 3 terms and 6 literals. Figure 1 shows the chart: no row is marked essential, and the ticked rows are one of the two minimum covers.
Example 2: the same function with a don't-care
Add . Now Stage A also merges 4 () with 0, 5 and 6, and the column-3 merges , and appear. The primes are , and . Each is essential ( alone covers 1, alone covers 2, alone covers 7), and
Example 3: four variables,
Column 1. Index 0: 0000 (0). Index 1: 0001 (1), 0010 (2). Index 2: 0011 (3), 0101 (5). Index 3: 0111 (7), 1011 (11). Index 4: 1111 (15).
Column 2 (ten merges, every minterm checked): ; ; ; ; ; ; ; ; ; .
Column 3 (every column-2 string checked):
| Quad | Formed by | Term |
|---|---|---|
| with , and with | ||
| with , and with | ||
| with , and with |
Each quad is produced twice; it is recorded once. No two quads merge, so there are three prime implicants.
Stage B (columns 1, 3, 7, 11, 15 only):
| PI | 1 | 3 | 7 | 11 | 15 |
|---|---|---|---|---|---|
| * | * | * | * | ||
| * | * | * | |||
| * | * |
Columns 11 and 15 have a single star: is the only essential prime. It leaves column 1, covered by or at equal cost. So there are two minimal SOPs, and , each with 4 literals. They differ only on don't-care inputs: makes a 1, makes and 1s.
Important properties and observations
- Combine only equal dash patterns; mismatched dashes mean different subcube orientations.
- A cube of minterms is generated by different merges in the last column; record it once.
- Essential primes are exactly those with a private onset column.
- Multiple minimum covers may exist; any minimum literal SOP is a correct answer.
- Two minimal SOPs that use don't-cares differently are different functions on the don't-care rows, and both are correct.
Common misconceptions.
- "Don't-care columns appear in the chart." They must not.
- "All primes are needed." Only a cover; extras inflate the expression.
- "QM and K-map can disagree on the minimum." They minimize the same cost; their lists of primes are identical.
- "Strings in the same index group can combine." They have the same number of 1s, so they differ in at least two positions.
- "No essential prime means no minimum exists." A cyclic chart still has minimum covers; Petrick's method finds them.
GATE examination perspective
- COMBINATION TABLE. Show check marks and dashes carefully; questions ask how many entries a column has or which strings stay unchecked.
- PRIME AND ESSENTIAL COUNTS. Count primes after Stage A including those formed with don't-cares; count essentials from onset columns only.
- CHART. Strike essentials first, then apply dominance; read what remains as a small covering problem.
- DON'T-CARES. In Stage A only.
- CYCLIC CHARTS. A chart with two stars in every column has no essential prime. Apply dominance and solve the residual covering problem; column star counts alone establish neither cyclicity nor the number of optimum covers. For example, rows A={1,2}, B={1}, C={2} give two stars per column but a unique minimum-row cover {A}.
- COMPARE OPTIONS. Evaluate each option's onset against the specified minterms, ignoring don't-care rows.
Summary
Sources
- W. V. Quine, "The Problem of Simplifying Truth Functions", American Mathematical Monthly 59(8), 1952, pp. 521 to 531, DOI 10.1080/00029890.1952.11988183.
- E. J. McCluskey, "Minimization of Boolean Functions", Bell System Technical Journal 35(6), 1956, pp. 1417 to 1444, DOI 10.1002/j.1538-7305.1956.tb03835.x.
- M. Morris Mano, M. D. Ciletti, Digital Design, 5th ed., Pearson, 2013: Chapter 3, Sections 3.2 to 3.5 (map method, prime implicants, don't-care conditions), the companion treatment of the same covering problem.