3.1.13 · D4Boolean Algebra & Logic Gates

Exercises — Quine-McCluskey method

4,053 words18 min readBack to topic
Recall One-line refresher of the whole method

Group minterms by number of 1s → Compare adjacent groups → Combine each Hamming-1 pair → Chart prime implicants against minterms → Choose essential PIs first, then a minimal cover for the rest. Anything never ticked is a prime implicant.

Dash vs tick — the two different marks (why each exists):

  • You put a ==dash -== in the new, combined term at the one bit-position where the two parents disagreed. That dash records "this variable just cancelled via and no longer appears." The dash lives on the child.
  • You put a tick ✓ on each of the two parent terms you just used. The tick records "I was absorbed into a bigger group, so I am not prime by myself." The tick lives on the parents.

So every successful combine leaves three marks: one new dashed child + two ticked parents. Un-ticked survivors at the end are the prime implicants.

Figure 1 — the tick bookkeeping (alt-text). Two white minterm cards 000 (m0) and 001 (m1) each receive a green ✓ and feed a lavender arrow into a combined card 00- (m0,m1); a lone mint card 111 (no partner) gets no ✓ and is labelled "PRIME". Caption idea: ticked = used = not prime; un-ticked = prime.

Figure — Quine-McCluskey method

Notation reminders (so no symbol is unearned)

Figure 2 — size-2 pass feeds the size-4 pass (alt-text). Two dashed size-2 cards 000- and 001- sit on the left; a lavender arrow merges them into a size-4 card 00-- on the right, with the newly cancelled bit-position circled. Caption idea: matching dash column + one differing bit → a bigger group with a second dash.

Figure — Quine-McCluskey method

Figure 3 — edges and faces of the Boolean cube (alt-text). A cube of 8 vertices labelled by 3-bit codes; two parallel highlighted edges (each a size-2 term sharing the same missing direction) span a shaded face (the size-4 term). Caption idea: parallel edges one step apart merge into a face; skew edges cannot.

Figure — Quine-McCluskey method

Level 1 — Recognition

L1.1 — Which pairs can combine?

For each pair of 4-bit minterms, state yes/no they can be combined in QM, and if yes give the resulting pattern. (a) & (b) & (c) & (d) &

Recall Solution

Count differing bits (Hamming distance). Combine only if distance ; the differing position becomes -.

  • (a) vs differ only in bit (position 2). Distance YES0-11.
  • (b) vs differ in bits and . Distance NO.
  • (c) vs differ only in bit . Distance YES101-.
  • (d) vs differ in all four bits. Distance NO.

L1.2 — Decode the pattern

Decode these patterns into Boolean terms, variable order . (a) 1-0- (b) -011 (c) --00

Recall Solution

Read each column: plain letter, barred letter, - drop it.

  • (a) 1-0-: .
  • (b) -011: .
  • (c) --00: .

L1.3 — How many minterms does a term cover?

A product term with total variables but only literals written down covers how many minterms? Apply to with .

Recall Solution

Each missing variable (a dropped one) doubles the coverage, because it can be or freely. With variables and literals, the number of dropped variables is , so coverage . For : , literals , dropped → covers minterms. (Indeed it covered in the parent note.)


Level 2 — Application

L2.1 — Full QM on a 3-variable function

Minimize .

Recall Solution

Group by 1s: {0=000} | {1=001, 4=100} | {5=101}. Combine (size-2):

  • : vs 00-
  • : vs -00
  • : vs -01
  • : vs 10-

(Every one of the four size-2 terms got a ✓ — meaning each will be absorbed in the next pass, so none is prime yet.) Combine (size-4): 00- & 10- share dash in position and differ only in bit -0- (covers ). Similarly -00 & -01 share dash in , differ only in -0- (same term). So the whole function collapses to one prime implicant. Decode -0- (order ): only survives → . Sanity check: in binary are exactly the rows where . ✔

L2.2 — Full QM on a 4-variable function

Minimize .

Recall Solution

Group by 1s: {0=0000} | {2=0010, 8=1000} | {10=1010}. Combine (size-2):

  • 00-0 ; -000 ; -010 ; 10-0. Combine (size-4): 00-0 & 10-0 share dash in , differ only in -0-0. Also -000 & -010 share dash in , differ only in -0-0 (same). One PI. Decode -0-0 (order ): . Check: are exactly the rows with and . ✔

Level 3 — Analysis

L3.1 — Build the PI chart and find EPIs

Minimize .

Recall Solution

Group by 1s: {0=0000} | {1=0001, 2=0010, 4=0100} | {3=0011, 5=0101}. Combine (size-2):

  • 000- ; 00-0 ; 0-00
  • 00-1 ; 0-01 ; 001- ; 010-

Combine (size-4):

  • 000- & 001- share dash in , differ only in 00-- (covers ).
  • 000- & 010- share dash in , differ only in 0-0- (covers ).
  • 00-0 & 00-1? 00-0 covers , 00-1 covers ; dash positions differ ( vs ) — cannot merge.
  • 0-01 & 00-1? dash positions differ — cannot.

Un-ticked survivors → prime implicants:

  • 00-- covers
  • 0-0- covers

PI chart (✗ = covered):

PI 0 1 2 3 4 5

EPI hunt (scan columns): are covered only by → essential. covered only by → essential. Both PIs are essential. (You could also factor to — same logic, see Boolean Algebra Laws.)

L3.2 — A function with a non-essential PI

Minimize and show why one PI can be dropped. Recompute the PIs from scratch here (don't borrow the parent).

Recall Solution

Group by 1s: {0=000} | {1=001, 2=010} | {5=101, 6=110} | {7=111}. Combine (size-2): compare adjacent groups only.

  • 00- ✓ ; 0-0
  • -01 ✓ ; -10
  • 1-1 ✓ ; 11-

Combine (size-4): for two size-2 terms to merge they need dashes in the same column and differ in one bit. Check pairs:

  • 00- & 0-0? dash positions differ ( vs ) → no.
  • -01 & -10? both dash in , but they differ in two remaining bits ( and ) → no.
  • 1-1 & 11-? dash positions differ ( vs ) → no.
  • every other pair fails one test similarly. No size-4 term exists.

So all six size-2 terms are prime implicants: 00-, 0-0, -01, -10, 1-1, 11-. PI chart:

PI 0 1 2 5 6 7

EPI hunt: every column has ✗'s → no essential PI! This is a "cyclic" chart, solved with Prime Implicants and Petrick's Method or by inspection. Pick a minimal cover: choose , , — union , all six. Three terms. Why a PI is dropped: , , are all valid prime implicants, but the three we picked already cover everything, so the other three are redundant.


Level 4 — Synthesis

L4.1 — QM with don't-cares

Minimize .

Recall Solution

Include don't-cares while combining (they can enlarge groups) but do not give them chart columns. Minterms+dc in binary: . Group by 1s: {0} | {1,2} | {3,5} | {7,11} | {15}. Combine (size-2):

  • 000- ; 00-0 ; 00-1 ; 0-01 ; 001-
  • 0-11 ; -011 ; 01-1 ; -111 ; 1-11

Combine (size-4):

  • 000- & 001-00--
  • 00-1 & 01-1? dash in both, differ only in 0--1
  • 0-11 & 1-11--11
  • 0-11 & -011? dash positions differ — no.

Combine (size-8): none share a matching double-dash and differ by one bit. Prime implicants (un-ticked survivors): 00--, 0--1, --11. PI chart — real minterms only :

PI 1 3 7 11 15

EPI hunt: are covered only by essential. After picking , it already covers ; the only remaining required minterm is . Now is covered by two PIs, and each has exactly 2 literals, so neither is "cheaper" on literal count. Both give an equally minimal 2-term, 4-literal answer. We simply pick one; say . (The alternative is equally valid and equally minimal — this is a genuine tie, and that's a legitimate outcome of QM, not an error.) Check real minterms: , ; union over the required set ✔. (Don't-cares may or may not be — that's allowed.)

L4.2 — Design a function from a spec

"Output is exactly when a 3-bit number is odd or greater-than-or-equal-to 6." Write the minterm list, run QM, give minimal SOP.

Recall Solution

as a number ( is MSB). Odd numbers: . Numbers : . Union of required . Group by 1s: {1=001} | {3=011, 5=101, 6=110} | {7=111}. Combine (size-2):

  • 0-1 ; -01 ; -11 ; 1-1 ; 11-

Combine (size-4):

  • 0-1 & 1-1 share dash in , differ in --1
  • -01 & -11 share dash in , differ in --1 (same term)

Un-ticked survivors: --1 and 11-. PI chart (columns = required minterms ):

PI 1 3 5 6 7

EPI hunt (scan columns):

  • each have exactly one ✗ (only under ) → is essential.
  • has exactly one ✗ (only under ) → is essential.
  • is covered by both, but both are already forced in, so it is automatically covered.

Selection: both PIs are essential, so both go in; nothing is left to choose and no PI is redundant. Coverage check: , ; union = all required. ✔ Read plainly: " if the number is odd () or its top two bits are both (i.e. or )" — exactly the spec. See Logic Gate Minimization for the 2-gate circuit.


Level 5 — Mastery

L5.1 — Cyclic chart via Petrick's method

Minimize . Show that the chart is cyclic and solve it algebraically.

Recall Solution

Group by 1s: {1=001,2=010,4=100} | {3=011,5=101,6=110}. Combine (size-2):

  • 0-1 ; -01 ; 01- ; -10 ; 10- ; 1-0

Combine (size-4): no two share a dash position and differ in one bit (e.g. 0-1 & 10- have dashes in different columns). All six size-2 terms are prime. Label the PIs (order ):

  • =0-1
  • =-01
  • =01-
  • =-10
  • =10-
  • =1-0

PI chart (columns ):

PI 1 2 3 4 5 6

Every column has exactly two ✗'s → cyclic, no EPI. Petrick's method — the WHY. Each minterm must be covered, so for each column we write the sum (OR) of the PIs that cover it; the whole cover must satisfy all columns, so we take the product (AND) of those sums: Multiply out, using and absorption . The smallest surviving products each have 3 PIs; one is . Check against the chart: ✓, ✓, ✓, ✓, ✓, ✓. All six columns covered with three PIs — and no 2-PI product survives (each PI covers only 2 columns, so 2 PIs reach at most 4 of the 6 minterms). Hence 3 is minimal. (By the cube's symmetry is an equally minimal alternative: — another genuine tie.)

L5.2 — Compare with a Karnaugh map

Minimize (parent's Example 1) by K-map, and confirm it equals the QM answer .

Recall Solution

Fill a 4-var K-map (rows , cols in Gray order ):

1(0) 1(1) 0(3) 1(2)
0(4) 1(5) 1(7) 1(6)
0(12) 0(13) 0(15) 1(14)
1(8) 1(9) 0(11) 1(10)

Visual groups:

  • Corners + edges : cells → the four corners of the region → .
  • column pattern: cells .
  • : cells . Union = all ten minterms. Identical to the QM result. ✔ The K-map "sees" the same groupings QM computes tabularly — two windows on the one combining law .

Figure 4 — QM answer confirmed on the K-map (alt-text). A 4-variable Karnaugh map (rows , columns in Gray order) with three coloured loops: a corner-wrapping loop over cells 0,1,8,9 labelled , a column loop over 2,6,10,14 labelled , and a small loop over 5,7 labelled . Caption idea: the same three groups QM found appear as visual loops.

Figure — Quine-McCluskey method

Recap flashcards

Recall Self-test

How many minterms does a 4-var term with 2 literals cover? ::: . In L4.1, why does turn out essential? ::: and are covered by no other PI. What makes a PI chart "cyclic"? ::: Every column is covered by PIs, so no essential PI exists. When are don't-cares dropped? ::: When building the PI chart — they get no columns; only required minterms do. Minimal SOP for (3 vars)? ::: . What does a tick ✓ next to a term mean? ::: It was absorbed into a bigger group, so it is not prime; only un-ticked terms are prime implicants. Difference between a dash and a tick? ::: A dash marks the cancelled bit on the NEW combined term; a tick marks each OLD parent term as "used, not prime".

Connections

  • Karnaugh Maps — L5.2 cross-checks QM against the visual method.
  • Prime Implicants and Petrick's Method — the tool for cyclic charts (L3.2, L5.1).
  • Sum of Products (SOP) · Boolean Algebra Laws · Logic Gate Minimization.