3.1.13 · D3Boolean Algebra & Logic Gates

Worked examples — Quine-McCluskey method

2,386 words11 min readBack to topic

Before we start, one reminder of the only rule that does any work here (from Boolean Algebra Laws):


The scenario matrix

Every QM problem you can be handed falls into one of these case classes. Each row is a "cell" we must cover with at least one worked example.

# Case class What makes it special Covered by
C1 Standard, EPIs cover all Textbook path; EPIs alone finish it Example 1
C2 Cyclic chart (no EPIs) Every minterm has ≥2 PIs → must choose Example 2
C3 EPIs + leftover EPIs picked, then remaining minterms need a secondary choice Example 3
C4 Don't-cares present Use to grow PIs but never cover them Example 4
C5 Degenerate: everywhere All minterms present → answer is Example 5
C6 Degenerate: everywhere No minterms → answer is Example 6
C7 Real-world word problem Translate English → truth table first Example 7
C8 Exam twist: mis-decode trap + 5 vars Position-order & literal-count trap Example 8

Example 1 — Case C1 (standard, EPIs finish)

Forecast: Guess how many terms survive. (Hint: minterms 0,2,4,6 are all even. Smell a big group.)

  1. Group by number of 1s. . Why this step? Grouping by 1-count means a Hamming-distance-1 neighbour must sit in the adjacent group — it limits comparisons and blocks illegal 2-bit merges automatically.

  2. Combine adjacent groups (size-2).

    • ✓✓
    • ✓✓
    • ✓✓
    • ✓✓
    • ✓✓

    Why this step? Each pair differs in one bit, so one variable cancels via .

  3. Combine again (size-4). Terms with a dash in the same position and differing in one bit:

    • : from and (both dash at ) → . Why this step? covers all four even minterms in one shot — that's the big group we forecast.
  4. List primes (never-ticked terms). After step 3, only was never absorbed into a quad. So:

  5. PI chart → EPIs.

    • is covered only by → EPI.
    • are covered only by → EPI.

    Both are essential, so:

Verify: covers , covers ; union = every requested minterm. ✔ Two terms, three literals — nothing smaller possible.


Example 2 — Case C2 (cyclic chart, no EPIs)

Forecast: This is the famous cyclic function. Guess whether any single PI is essential. (It won't be — every minterm has two suitors.)

  1. Group by 1s. .

  2. Combine (size-2).

    Why this step? Each is a valid Hamming-1 merge. No size-4 combine is possible (no two share a dash position and differ in one bit), so all six are prime implicants.

  3. Build the PI chart and scan columns for essentials.

Figure — Quine-McCluskey method

Why this step? Look at the chart: every column has exactly two ✗ marks. No minterm is covered by a lone PI → no essential prime implicants. The chart is cyclic: this is the case the parent note never showed.

  1. Choose a minimal cover (Petrick idea). Because nothing is forced, we hunt for the smallest subset covering all 6. Notice the six PIs form a ring; picking alternating ones works. Take: Coverage: , , → all six. The other alternating triple is equally minimal — this function has two minimal SOPs. Why this step? With no EPIs you must decide; Petrick's method formalises finding the smallest such subset.

Verify: . ✔ Three terms, six literals; two literals per term is the floor here, so minimal. ✔


Example 3 — Case C3 (EPIs first, then a leftover choice)

Forecast: Guess: will the whole thing collapse into two clean 4-groups, or leave a stray?

  1. Group by 1s. where .

  2. Combine (size-2).

    • ; ; ;
    • ; ; ;
  3. Combine (size-4).

    • Why this step? These are the two clean quads. Every original minterm got absorbed, so these two are the only primes.
  4. PI chart.

    • covers ; covers .
    • is covered only by → EPI. only by → EPI. Both essential; together they cover all 8. No leftover after all — the two EPIs finish it.

Verify: , ; union = all 8 minterms. ✔ (This is the XNOR of and : — a nice sanity link to Logic Gate Minimization.)


Example 4 — Case C4 (don't-cares)

Forecast: Don't-cares are free 1s to combine with, but you never have to cover them. Guess: can we grab a single term covering all of ?

  1. Bring don't-cares into the grouping. Treat as available 1s: . Why this step? Including while combining can grow bigger PIs — that's their only benefit.

  2. Key merges. The required minterms all have . And (with help of don't-cares ) form ; then bring , , , . Chasing the family:

    • (uses )
    • … no , skip.
  3. Prime implicants that cover the required set. Together: covers (required) (don't-care, ignored). covers . Why this step? and are only reachable via ; only via → both EPIs.

Verify: Required minterms only. , ; union . ✔ Don't-cares were never covered (both give here) and that's perfectly legal. ✔


Example 5 — Case C5 (degenerate: function is always 1)

Forecast: All four rows of a 2-variable truth table are 1. Guess the answer before doing any tabulation.

  1. Group & combine. .
    • ; ; ; .
  2. Combine again. both positions dashed. Why this step? A term with every variable cancelled means "no variable matters" — the constant .

Verify: decodes to the empty product = . Output is 1 for all inputs, matching . ✔ This is the limiting case: full minterm set ⇒ tautology.


Example 6 — Case C6 (degenerate: function is always 0)

Forecast: No minterm is 1. What's there even to combine?

  1. List minterms. There are none. The grouping table is empty. Why this step? QM combines 1-rows; with zero of them, step 1 produces nothing.
  2. Result.

Verify: An empty SOP (sum of no terms) is by definition, and the truth table is all-0. ✔ The mirror image of Example 5.


Example 7 — Case C7 (real-world word problem)

Forecast: Guess: does "emergency pressed" ever let the motor run in more than one situation?

  1. Translate English → conditions. when:

    • (door closed, no overload, no emergency) → .
    • (door open, no overload, emergency pressed) → . All other rows: motor off. Why this step? You must convert the sentence into a truth table before QM can touch it — QM has no idea what "elevator" means.
  2. Minterm list: .

  3. Group & combine. . Groups differ by two bits ( vs : bits and both change) → cannot combine. Why this step? Hamming distance is 2, so no variable cancels. Both minterms are already prime.

  4. Decode.

    • .
    • .

Verify (in English + logic): Both terms contain — motor never runs on overload, as required. First term = all-safe idle-close; second = the emergency-open creep. No other input pattern gives 1. Only 2 terms because the two run-conditions differ in 2 variables and refuse to merge. ✔


Example 8 — Case C8 (exam twist: 5 vars + decode trap)

Forecast: Four minterms, all with . Guess how big the group gets.

  1. Binary (order , 5 bits). .

  2. Group by 1s. .

  3. Combine (size-2).

    • ; ; ; .
  4. Combine (size-4). Same-dash-position + one-bit-difference:

    • . Why this step? Two variables ( and ) cancel simultaneously — the group spans all four.
  5. Decode -000- (order ). Dash at (drop), , dash at (drop): Why this step (the trap): a rushed reader might write by reading the first three bits. No — the dashed columns ( and ) are the ones that disappear; the surviving literals come from the fixed s in .

Verify: = "1 whenever , regardless of " → each → input rows → minterms . ✔ Exactly our set, one term, three literals — collapsed from four minterms.


Recap of the matrix

Recall Which example hit which cell?

C1 standard ::: Example 1 () C2 cyclic / no EPI ::: Example 2 (two valid minimal SOPs) C3 EPIs finish ::: Example 3 (XNOR: ) C4 don't-cares ::: Example 4 () C5 always-1 degenerate ::: Example 5 () C6 always-0 degenerate ::: Example 6 () C7 word problem ::: Example 7 () C8 5-var + decode trap ::: Example 8 ()


Connections

  • Quine-McCluskey method — the parent algorithm these examples exercise.
  • Prime Implicants and Petrick's Method — how to choose when the chart is cyclic (Example 2).
  • Karnaugh Maps — the same adjacency, drawn instead of tabulated.
  • Sum of Products (SOP) — the output form of every answer above.
  • Boolean Algebra Laws — the combining theorem doing all the work.
  • Logic Gate Minimization — why fewer literals means cheaper hardware.

Flashcards

When a QM chart has no essential prime implicants, what is it called and what do you do?
A cyclic chart; pick a minimal cover by inspection or Petrick's method (multiple minimal SOPs may exist).
If every minterm () is present, what is the minimized function?
(all variables cancel).
If the minterm set is empty, what is the minimized function?
.
How do don't-cares affect the PI chart?
They may be used while combining to grow PIs, but they get NO column in the chart and need not be covered.
Decode -000- in ABCDE order.
Dash and drop; .