K-Maps & Boolean Minimisation
Karnaugh Maps – the fastest method to simplify Boolean functions. Master prime implicants, essential prime implicants, and dont-care conditions for 1-2 marks in GATE CS every year.
Last updated: April 2026 | GATE CS 2024-2026 syllabus
Key Takeaways
- A K-map is a visual representation of a truth table arranged so adjacent cells differ in exactly one variable (Gray code order).
- Groups must be powers of 2 (1, 2, 4, 8, 16); larger groups give simpler expressions with fewer literals.
- A prime implicant (PI) is a maximal group of 1s; an essential prime implicant (EPI) covers at least one minterm covered by no other PI.
- Every minimal SOP must contain all EPIs; remaining minterms are covered with the minimum additional PIs.
- Dont-care (X) cells may be included in groups to create larger groups but need not be covered.
- For minimal POS, group 0s instead of 1s; each group gives one complemented sum term.
- K-maps wrap around – top row is adjacent to bottom row, left column is adjacent to right column.
1. Why K-Maps?
Algebraic Boolean minimisation is error-prone – it depends on recognising which identity to apply next. K-maps provide a systematic, visual alternative. By arranging minterms so that adjacent cells differ in exactly one variable, you can directly read off the largest possible groupings – which correspond to minimal product terms.
K-maps work well for functions up to 4-5 variables. Beyond that, the Quine-McCluskey tabular method is used.
2. K-Map Layout and Gray Code Ordering
Variables are assigned to rows and columns in Gray code order (00, 01, 11, 10 – not binary order). This ensures any two adjacent cells differ in exactly one bit.
2-Variable K-Map (A, B)
| B=0 | B=1 | |
|---|---|---|
| A=0 | m0 (00) | m1 (01) |
| A=1 | m2 (10) | m3 (11) |
3-Variable K-Map (A, BC)
| A \ BC | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 0 | m0 | m1 | m3 | m2 |
| 1 | m4 | m5 | m7 | m6 |
Note the column order: 00, 01, 11, 10 – Gray code, not 00, 01, 10, 11.
4-Variable K-Map (AB, CD)
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | m0 | m1 | m3 | m2 |
| 01 | m4 | m5 | m7 | m6 |
| 11 | m12 | m13 | m15 | m14 |
| 10 | m8 | m9 | m11 | m10 |
The 4-variable K-map wraps in both directions: top to bottom and left to right. Corners m0, m2, m8, m10 form a valid group of 4.
3. Grouping Rules
- Groups must contain 1, 2, 4, 8, or 16 cells (powers of 2 only).
- All cells in a group must be 1 (or dont-care X when used to enlarge a group).
- Groups must be rectangular – L-shapes and other irregular shapes are NOT allowed.
- The map wraps around – top and bottom rows are adjacent; left and right columns are adjacent.
- Make groups as large as possible – larger groups eliminate more variables.
- Each 1 must be covered by at least one group – overlapping is allowed and often needed.
- Fewer, larger groups leads to fewer product terms and a simpler expression.
What Each Group Size Eliminates
| Group Size | Variables Eliminated | Literals Remaining (4-var) |
|---|---|---|
| 1 cell (20) | 0 | 4 |
| 2 cells (21) | 1 | 3 |
| 4 cells (22) | 2 | 2 |
| 8 cells (23) | 3 | 1 |
| 16 cells (24) | 4 | 0 (constant 1) |
4. Prime Implicants and Essential Prime Implicants
Prime Implicant (PI): A group of 1s (and optionally dont-cares) that cannot be combined with any other adjacent group to form a larger valid group. It is maximal – you cannot make it bigger.
Essential Prime Implicant (EPI): A PI that is the only PI covering at least one particular minterm. It MUST appear in every minimal SOP cover.
Redundant PI: A PI all of whose minterms are already covered by EPIs or other selected PIs. It can be omitted.
Procedure to Find Minimal SOP
- Plot all minterms (and dont-cares) on the K-map.
- Find all prime implicants – all maximal groups of 1s.
- Identify essential prime implicants – PIs that uniquely cover at least one minterm.
- Include all EPIs in the cover.
- Check if all minterms are covered. If not, add the minimum number of additional PIs to cover remaining minterms.
- Write the SOP: one product term per group, using only the literals that stay constant across the group.
Reading a Product Term from a Group
- Variable = 0 for every cell in the group: include it complemented (A')
- Variable = 1 for every cell in the group: include it uncomplemented (A)
- Variable is mixed (0 and 1 across cells): omit it – this variable is eliminated
5. Dont-Care Conditions
Some input combinations either can never physically occur (e.g., BCD digits 10-15 never appear in valid BCD), or occur but the output value does not matter to the system. These are marked X in the K-map.
Example – BCD to Excess-3
BCD input A, B, C, D – valid minterms: 0-9; dont-cares: 10-15. The dont-cares allow groups of 4 or 8 that would be impossible with only the 10 valid minterms, giving simpler SOP expressions for each output bit.
6. Minimal POS from K-Maps
To find the minimal Product of Sums (POS):
- Group the 0s (maxterms) instead of the 1s – same grouping rules apply.
- Each group gives one sum term, with the variables complemented compared to the SOP rule:
- Variable = 0 for all cells in the group: include it uncomplemented in the sum (e.g., A)
- Variable = 1 for all cells in the group: include it complemented in the sum (e.g., A')
- Variable mixed: omit from the sum term
- Multiply all sum terms together.
7. GATE CS Solved Examples
Example 1 – Find Minimal SOP (GATE CS 2019 style)
Function: F(A,B,C,D) = Σm(0, 1, 3, 5, 7, 8, 9, 11, 15)
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 (m0) | 1 (m1) | 1 (m3) | 0 (m2) |
| 01 | 0 (m4) | 1 (m5) | 1 (m7) | 0 (m6) |
| 11 | 0 (m12) | 0 (m13) | 1 (m15) | 0 (m14) |
| 10 | 1 (m8) | 1 (m9) | 1 (m11) | 0 (m10) |
Prime Implicants:
- Group {m0, m1, m8, m9}: A mixed, B=0, C=0, D mixed → PI1 = B'C'
- Group {m1, m3, m9, m11}: A mixed, B=0, C mixed, D=1 → PI2 = B'D
- Group {m3, m7, m11, m15}: A mixed, B mixed, C=1, D=1 → PI3 = CD
- Group {m5, m7}: A=0, B=1, C mixed, D=1 → PI4 = A'BD
EPIs: m0 only in PI1, m5 only in PI4, m15 only in PI3. All three are EPIs. Together they cover all minterms.
Example 2 – Dont-Care Minimisation (GATE CS 2018 style)
Function: F(A,B,C,D) = Σm(0, 2, 8, 10) + d(5, 7, 13, 15)
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 1 | 0 | 0 | 1 |
| 01 | 0 | X | X | 0 |
| 11 | 0 | X | X | 0 |
| 10 | 1 | 0 | 0 | 1 |
Four-corner group {m0, m2, m8, m10}: D=0, B=0 for all, A and C mixed → B'D'. No larger group possible.
Example 3 – Number of Prime Implicants (GATE CS 2021)
Function: F(A,B,C,D) = Σm(1,3,5,7,9,11,13,15). How many prime implicants?
| AB \ CD | 00 | 01 | 11 | 10 |
|---|---|---|---|---|
| 00 | 0 | 1 | 1 | 0 |
| 01 | 0 | 1 | 1 | 0 |
| 11 | 0 | 1 | 1 | 0 |
| 10 | 0 | 1 | 1 | 0 |
One group of 8 covering all 1s: D=1 for all, all other variables mixed → D.
8. Quine-McCluskey Method Overview
For functions with 6+ variables, K-maps become impractical. The Quine-McCluskey (QM) algorithm automates prime implicant finding:
- List all minterms in binary, grouped by the number of 1-bits.
- Combine pairs from adjacent groups that differ in exactly one bit position – mark the differing bit with a dash.
- Repeat combining – combine entries that have dashes in the same positions and differ in one more bit.
- All terms that could not be combined are prime implicants.
- Build a prime implicant chart – rows are PIs, columns are original minterms. Select EPIs and minimum additional PIs.
9. Common Mistakes
Mistake 1 – Using non-power-of-2 group sizes
Error: Creating a group of 3 or 6 cells.
Root cause: Confusing adjacent cells with any connected cells.
Fix: Groups must be 1, 2, 4, 8, or 16. When you have 3 adjacent 1s, form the best overlapping power-of-2 groups to cover all three.
Mistake 2 – Forgetting the map wraps around
Error: Missing groups that span the top-bottom or left-right edges.
Root cause: Treating the K-map as a flat grid instead of a torus.
Fix: Always check if corner cells and edge rows/columns can form wrap-around groups. Common miss: the four-corner group {m0, m2, m8, m10} = B'D'.
Mistake 3 – Treating dont-cares as required minterms
Error: Insisting that every X cell must be covered by a group.
Root cause: Misreading “can be used as 1” as “must be covered.”
Fix: Dont-cares are optional. Use them only when they allow you to enlarge a group. You can leave X cells uncovered.
Mistake 4 – Not finding all prime implicants before selecting the cover
Error: Greedily selecting the first large group and moving on, missing other PIs that give a smaller cover.
Root cause: Rushing the procedure.
Fix: Enumerate ALL prime implicants first. Then identify EPIs and find the minimum cover. This two-phase approach guarantees minimality.
Mistake 5 – Inverting the POS variable rule
Error: When grouping 0s for POS, applying the same variable-reading rule as SOP.
Root cause: Forgetting that the POS rule is complemented relative to SOP.
Fix: In POS, a variable that is 0 throughout the group appears uncomplemented in the sum term; a variable that is 1 throughout appears complemented. This is the dual of the SOP rule.
10. Frequently Asked Questions
What is the difference between a prime implicant and an essential prime implicant?
A prime implicant (PI) is a maximal group of 1s that cannot be enlarged further. An essential prime implicant (EPI) is a PI that is the only PI covering at least one specific minterm. EPIs must appear in every minimal SOP expression. Non-essential PIs may or may not be needed depending on the remaining coverage.
How do dont-care conditions affect K-map minimisation?
Dont-cares (X) may be treated as 1s to enlarge groups, reducing the literal count of product terms. They are optional – you are not required to cover them. Never create a group consisting only of dont-cares, as that group covers no required minterm.
Can K-maps be used to find minimal POS expressions?
Yes. Group the 0s in the K-map using the same power-of-2 grouping rules. Each group of 0s gives one sum term. Variables that are 0 throughout appear uncomplemented; variables that are 1 throughout appear complemented; variables that vary are omitted. The POS is the AND of all sum terms.
What is the Quine-McCluskey method and when is it used instead of K-maps?
The Quine-McCluskey (QM) method is a tabular algorithm that systematically finds all prime implicants by repeatedly combining minterms that differ in one bit. It is used for 6+ variable functions where K-maps are impractical. In GATE CS, conceptual understanding of QM is more important than full computation.