3.05 Karnaugh Map (K-Map) Optimization & Don’t Care States
What is a Karnaugh Map?
A Karnaugh Map (K-map) is a graphical method used to simplify Boolean expressions without relying on algebraic manipulation. It organizes minterms or maxterms into a grid where adjacent cells differ by exactly one variable (satisfying the Gray Code adjacency property). This layout allows algebraic simplification () to be executed visually.
1. K-Map Grid Layouts (2, 3, and 4 Variables)
The rows and columns are indexed using Gray Code (00, 01, 11, 10 instead of binary 00, 01, 10, 11) to ensure adjacent cells differ by only one variable.
A. 3-Variable K-Map (8 Cells)
- Map dimensions: .
- Variables: (vertical), (horizontal).
BC
A \ 00 01 11 10
+----+----+----+----+
0 | m0 | m1 | m3 | m2 |
+----+----+----+----+
1 | m4 | m5 | m7 | m6 |
+----+----+----+----+B. 4-Variable K-Map (16 Cells)
- Map dimensions: .
- Variables: (vertical), (horizontal).
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | m0 | m1 | m3 | m2 |
+----+----+----+----+
01 | m4 | m5 | m7 | m6 |
+----+----+----+----+
11 | m12| m13| m15| m14|
+----+----+----+----+
10 | m8 | m9 | m11| m10|
+----+----+----+----+2. The Step-by-Step Grouping Rules
To simplify an SOP expression, place 1s in the cells corresponding to the minterms, and 0s for maxterms (for POS). Unused cells are filled with 0 (or 1).
The Adjacency Rules:
- Power of 2 Rule: Group sizes must be powers of 2 (i.e., loops of 1, 2, 4, 8, or 16 cells). No loops of 3, 5, or 6 cells are allowed.
- Standard Group Names:
- Pair (2 cells): Eliminates 1 variable.
- Quad (4 cells): Eliminates 2 variables.
- Octet (8 cells): Eliminates 3 variables.
- Adjacency Wrapping: The edges of the map wrap around.
- The left-most column is adjacent to the right-most column.
- The top-most row is adjacent to the bottom-most row.
- Overlapping Groups: The same
1can be used in multiple loops to make other loops as large as possible. Larger groups yield fewer literals! - Redundant Groups: Avoid loops where all contained
1s are already covered by other essential loops.
The 4-Corner Trick
In a 4-variable K-map, the four corner cells () are physically adjacent to each other. They can be grouped together into a single Quad that simplifies directly to:
The Don’t Care () Rules:
In physical hardware (e.g., BCD decoders), some input combinations can never occur. These invalid states are called Don’t Cares and are marked as X in the grid.
- You may treat
Xas a1if it helps enlarge a group of1s. - You may treat
Xas a0(leave it uncovered) if it does not help enlarge a group. - You never need to loop isolated
Xcells that do not cover any active1s.
3. Prime Implicants (PI) vs. Essential Prime Implicants (EPI)
When grouping, you must distinguish between candidate loops and mandatory loops:
- Prime Implicant (PI): A product term obtained by combining the maximum possible number of adjacent cells in the map. (It is a loop that cannot be doubled in size).
- Essential Prime Implicant (EPI): A Prime Implicant that contains at least one
1that is not covered by any other Prime Implicant. - Redundant Prime Implicant (RPI): A loop containing
1s that are completely covered by other select PIs.
Minimization Strategy
- Find all Prime Implicants on the map (loop all possible maximum groups).
- Identify Essential Prime Implicants (look for
1s that are only part of a single loop).- Add all EPIs to the final Boolean expression.
- Cover any remaining uncovered
1s using the largest possible remaining PIs.
3.1 Differences: Prime Implicants (PI) vs. Essential Prime Implicants (EPI)
| Feature | Prime Implicant (PI) | Essential Prime Implicant (EPI) |
|---|---|---|
| Definition | A maximal group of adjacent cells (cannot be combined into a larger group). | A Prime Implicant that covers at least one 1 not covered by any other PI. |
| Inclusion in Expression | May or may not be included in the final minimized expression. | MUST be included in the final minimized expression. |
| Uniqueness of Coverage | All of its 1s can potentially be shared with other groups. | Contains at least one “unique 1” that is only coverable by this specific loop. |
| Identification Method | Circle the largest possible cell groups (). | Look for circled 1s that are covered by only a single loop. |
| Role in Logic Minimization | Forms the pool of candidate terms for logic minimization. | Serves as the starting foundation terms for the final logic cover. |
4. Worked Exam Examples
Every example below is a verbatim past year question, not an invented one. Work them in order — Example 1 teaches the grid mechanics, Examples 2–4 are the questions that actually recur.
Example 1: 4-Variable SOP Minimization with Corners (method demo)
Question: Simplify the Boolean function .
The K-Map Grid:
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | 1 | 0 | 0 | 1 | <- m0, m2 are 1s
+----+----+----+----+
01 | 0 | 1 | 1 | 0 | <- m5, m7 are 1s
+----+----+----+----+
11 | 0 | 1 | 1 | 0 | <- m13, m15 are 1s
+----+----+----+----+
10 | 1 | 0 | 0 | 1 | <- m8, m10 are 1s
+----+----+----+----+Grouping Analysis:
- The Corner Quad: Minterms form a 4-corner group.
- Vertical transition (): and remains constant.
- Horizontal transition (): and remains constant.
- Term 1:
- The Center Quad: Minterms form a center group.
- Vertical transition (): and remains constant.
- Horizontal transition (): and remains constant.
- Term 2:
Example 2: SOP and POS from the Same Map, with Don’t Cares
Worked Exam Problem (PYQ 2016 — 13 marks)
Question (verbatim): Minimize the following function in both SOP and POS forms using K-maps.
This is the flagship K-map question: one map, two answers. Plot the 1s and the Xs once, then read the map twice — group the 1s for SOP, group the 0s for POS.
The K-Map Grid
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | 0 | 1 | 1 | 0 | m0=0, m1=1, m3=1, m2=0
+----+----+----+----+
01 | 1 | X | 1 | 0 | m4=1, m5=X, m7=1, m6=0
+----+----+----+----+
11 | X | X | X | X | m12..m15 all don't care
+----+----+----+----+
10 | 0 | 0 | 1 | 0 | m8=0, m9=0, m11=1, m10=0
+----+----+----+----+Part A: Minimal SOP — group the 1s
- Column quad : the whole column ( is an used as
1). stays constant - Quad : rows ; columns ( is an used as
1). - Quad : rows ; columns (three of the four cells are s).
All three are essential — can only be covered by , only by , only by .
Part B: Minimal POS — group the 0s
Group the 0s to obtain , then complement with De Morgan. Don’t cares may be reused freely as 0s here — a cell you treated as 1 for SOP may be treated as 0 for POS, and that is not a contradiction.
- Four corners : ; .
- Column quad : the whole column.
- Quad : ; .
Applying De Morgan ():
Verify a POS answer in 20 seconds
Substitute any two minterms and any two “zero” cells. For (): ✓. For (): ✓. If both behave, your complement step was almost certainly right.
Example 3: Two Standard Four-Variable Simplifications
Worked Exam Problem (PYQ 2022 — 10 marks; 2023 — 08 marks)
Question (verbatim): Simplify the following Boolean expressions, using four-variable maps: (i) (ii)
Part (i): Expand to minterms first
An expression given in non-canonical SOP must be expanded before plotting. Each missing variable doubles the number of minterms a term contributes:
| Term | Missing variables | Minterms |
|---|---|---|
| none | ||
| none | ||
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | 1 | 0 | 0 | 1 |
+----+----+----+----+
01 | 0 | 1 | 1 | 1 |
+----+----+----+----+
11 | 0 | 0 | 1 | 0 |
+----+----+----+----+
10 | 1 | 0 | 0 | 1 |
+----+----+----+----+Grouping:
- Four corners
- Pair : ; .
- Pair : ; .
- Pair : ; .
, and are mutually non-adjacent and each reaches the map only through , so four terms is genuinely the minimum here.
(Substituting for gives an equally minimal 11-literal answer — both are accepted.)
Part (ii):
yz
wx \ 00 01 11 10
+----+----+----+----+
00 | 1 | 1 | 0 | 0 |
+----+----+----+----+
01 | 1 | 1 | 1 | 1 |
+----+----+----+----+
11 | 0 | 0 | 0 | 0 |
+----+----+----+----+
10 | 1 | 1 | 0 | 0 |
+----+----+----+----+- Full row
- Quad (top and bottom rows wrap): ; .
Example 4: 4-Variable SOP with Don’t Cares (method demo)
Question: Simplify the Boolean function .
The K-Map Grid:
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | X | 1 | 1 | X | <- m0, m2 are Xs; m1, m3 are 1s
+----+----+----+----+
01 | 0 | X | 1 | 0 | <- m5 is X; m7 is 1
+----+----+----+----+
11 | 0 | 0 | 1 | 0 | <- m15 is 1
+----+----+----+----+
10 | 0 | 0 | 1 | 0 | <- m11 is 1
+----+----+----+----+Grouping Analysis:
- Column Quad: The entire right-middle column contains all
1s.- Horizontal position is remains constant.
- Term 1:
- Top-Left Quad (using at 5): The cells form a quad. Cell is a Don’t Care (), which we treat as a
1to enlarge the group.- Vertical transition (): and remains constant.
- Horizontal transition (): and remains constant.
- Term 2:
- The Unused Don’t Cares: Cells and are left uncovered since all
1s are already covered. Treating them as1s would only create a redundant term ().
Example 5: POS Minimization (Grouping 0s) (method demo)
Question: Simplify into Product-of-Sums (POS) form.
To find the minimized POS expression, we map the 0s of on the K-map, simplify for , and then apply De Morgan’s Law.
The K-Map Grid (showing 0s):
CD
AB \ 00 01 11 10
+----+----+----+----+
00 | 0 | 1 | 1 | 0 | <- m0, m2 are 0s
+----+----+----+----+
01 | 0 | 1 | 1 | 0 | <- m4, m6 are 0s
+----+----+----+----+
11 | 1 | 1 | 1 | 1 | <- No 0s in this row
+----+----+----+----+
10 | 1 | 1 | 0 | 0 | <- m10, m11 are 0s
+----+----+----+----+Grouping 0s for :
- Vertical Quad of 0s: Cells form a vertical quad on the outer columns.
- Vertical transition (): and remains constant.
- Horizontal transition (): and remains constant.
- Term 1 ():
- Horizontal Pair of 0s: Cells form a horizontal pair.
- Vertical position is remains constant.
- Horizontal transition (): and remains constant.
- Term 2 ():
- Vertical Pair of 0s (Wrapping): Cells wrap from top to bottom.
- Vertical transition (): and remains constant.
- Horizontal position is remains constant.
- Term 3 ():
Combining for :
Applying De Morgan’s Law ():
5. 5-Variable K-Map Minimization (Three-Dimensional Adjacency) [Syllabus Week 5]
Foundational Concept (Outside Direct PYQ Scope)
5-variable K-maps represent a foundational concept in multi-variable logic minimization, but they have never appeared in ECE 2103 past year papers (which strictly test up to 4-variable K-maps). It is included here to provide complete theoretical foundation.
A 5-variable function requires minterms. Grouping variables across 32 cells requires a three-dimensional mapping strategy.
5.1 Plane Overlay Concept
Instead of a single 32-cell grid, we construct two standard 4-variable () K-maps side-by-side:
- Plane A = 0 (Left Grid): Contains minterms ( horizontal, vertical).
- Plane A = 1 (Right Grid): Contains minterms ( horizontal, vertical).
A = 0 (m0 - m15) A = 1 (m16 - m31)
BC BC
00 01 11 10 00 01 11 10
+---+---+---+---+ +---+---+---+---+
00 | m0| m1| m3| m2| 00 |m16|m17|m19|m18|
+---+---+---+---+ +---+---+---+---+
01 | m4| m5| m7| m6| 01 |m20|m21|m23|m22|
DE +---+---+---+---+ DE +---+---+---+---+
11 |m12|m13|m15|m14| 11 |m28|m29|m31|m30|
+---+---+---+---+ +---+---+---+---+
10 | m8| m9|m11|m10| 10 |m24|m25|m27|m26|
+---+---+---+---+ +---+---+---+---+5.2 Adjacency & Grouping Rules
- Grid Adjacency: Standard grouping rules (pairs, quads, octets, wrapping) apply individually to both the plane and the plane.
- Plane-Overlay Adjacency: Imagine the plane is stacked directly on top of the plane. Cells in the same row/column coordinates on both maps are adjacent.
- If a group of cells exists in the exact same position on both the and planes, they can be merged into a single group. The variable changes state () and is eliminated from the term.
- If a group exists only on the plane, the term must contain .
- If a group exists only on the plane, the term must contain .
Worked Example: 5-Variable Minimization
Question: Simplify the function .
Step 1: Plot the Planes
- On plane, plot 1s at: .
- On plane, plot 1s at: .
Step 2: Grouping Analysis
- Outer Row Quads (Plane Overlay):
- On plane, cells form a vertical-wrap quad on columns and rows . This quad simplifies to .
- On plane, the same positions are also filled with 1s, forming the identical quad .
- Overlay Merge: Merge these two quads. is eliminated Term 1: .
- Right-Side Quads (Plane Overlay):
- On plane, cells form a quad in columns and rows . This quad simplifies to .
- On plane, the same positions are also filled with 1s, forming the identical quad .
- Overlay Merge: Merge these two quads. is eliminated Term 2: .
6. Past Year Questions (PYQs)
PYQ Index for this note
Question (as asked) Years Marks Solved in Minimize in both SOP and POS using K-maps 2016 13 §4 Ex. 2 Simplify and using four-variable maps 2022, 2023 8–10 §4 Ex. 3 Find the simplest SOP of , where and 2018, 2022 7–10 3.04 Mathematical Conversions & Expansion of SOP and POS Give three possible ways to express with eight or fewer literals 2022 9 3.04 Mathematical Conversions & Expansion of SOP and POS is a simplified version of — are there don’t care conditions? If so, what are they? 2017, 2020 10–11 §3, and see note below Define and explain prime implicants 2018 5 §3 Pattern to notice: K-maps appear in essentially every paper, but rarely as a standalone “simplify this” question — they are the tool inside larger design questions (code converters, parity checkers, comparators). Marks are lost far more often on plotting (wrong Gray-code column order, forgetting to expand a non-canonical term) than on the grouping itself.
The reverse-engineering question (2017, 2020)
” is a simplified version of … are there any don’t care conditions?” is the one K-map question that runs backwards. You are given the answer and asked which extra cells must have been treated as
1to make that grouping legal.Method: expand both the original expression and the claimed simplification into minterms over the five variables. Any minterm covered by the simplified form but absent from the original is a don’t care condition. That difference set is the answer.
7. Related Notes
- 3.04 Mathematical Conversions & Expansion of SOP and POS — expanding non-canonical expressions into minterms before plotting
- 3.06 Tabular Method (Quine-McCluskey) & Prime Implicants — the numerical alternative when there are more than 4 variables
- 3.03 SOP, POS, Canonical & Standard Forms — the vocabulary (minterm, maxterm, canonical vs standard) this note assumes