K-Map Structure and Prime Implicants: A Worked 4-Variable Example for GATE
Learn how a 4-variable K-map is laid out, why Gray-code adjacency matters, and how one eight-minterm example leads to three PIs, two EPIs, and a minimum SOP.
KnowledgeGate Team
Exam prep & CS education

You may know that adjacent 1s should be grouped and still lose the solution by placing minterms in binary order, missing edge wraparound, or calling every legal group a prime implicant. A 4-variable K-map has a visual structure, and implicants, prime implicants, and essential prime implicants are distinct concepts. The minimum SOP follows from the minterm list in the worked example. Draw the map, list every PI, find the EPIs, and reject a redundant PI without guessing.
Related reading: K-map minimization and Prime implicant MCQs.
K-Map structure: why the cells follow Gray-code order
For F(A,B,C,D), label the rows AB and the columns CD. Use Gray-code order on both axes: 00, 01, 11, 10.
|
|
|
|
|
|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Consecutive labels differ in exactly one bit, so horizontal and vertical neighbours differ in one variable. Grouping eliminates that changing variable. Diagonal cells are not adjacent.
The first and last columns are adjacent, as are the first and last rows. The four corners therefore form one legal 4-cell group. Think of opposite edges as joined, not as hard borders. Use CS Fundamentals for Exams & Placements as the broader subject route.

Implicant, prime implicant and essential prime implicant
An implicant is a valid product term covering only 1-cells in an SOP map.
A prime implicant, or PI, cannot expand into a larger valid power-of-two group.
An essential prime implicant, or EPI, covers at least one minterm covered by no other PI.
Every EPI is a PI, and every PI is an implicant. The reverse is false. Test “largest possible” locally: a 2-cell group is prime only if no valid 4-cell group contains it.
On a 4-variable map, one cell gives 4 literals, 2 cells give 3, 4 cells give 2, 8 cells give 1, and all 16 cells give the constant 1. In general, grouping 2^k cells removes the k variables that change inside the group.
Grouping rules that preserve the Boolean function
Group only 1s and optional don't-cares.
Use rectangles containing
1, 2, 4, 8, ...cells.Make each group as large as possible and cover every required 1 at least once.
Allow overlap for larger groups or essential coverage.
Never include a 0 in an SOP group.
A 2-by-2 block and a 1-by-4 row are legal. A 3-cell strip is illegal. Diagonal cells cannot form a pair, but the four corners form a legal group of 4. A don't-care d may help create a larger group, but need not be covered.
To extract a product term, keep only constant variables. If B=0 and D=0 while A and C vary, the group is B'D'. For broader SOP/POS and don't-care comparisons, use Boolean Minimization: SOP vs POS, Don't-Cares, Essential PIs. The PI chart below instead shows exhaustive PI listing and EPI selection on one map.
Worked example: place eight minterms and find every PI
F(A,B,C,D) = Σm(0,1,2,5,8,9,10,13)
Place the 1s by Gray-code position, not binary column order.
|
|
|
|
|
|---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List every maximal group:
G1={m0,m2,m8,m10}contains the corners.B=0andD=0stay fixed, soG1=B'D'.G2={m1,m5,m9,m13}is theCD=01column.C=0andD=1stay fixed, soG2=C'D.G3={m0,m1,m8,m9}spans the joined top and bottom rows across columns00,01.B=0andC=0stay fixed, soG3=B'C'.
Each group is a PI because expanding it to 8 cells includes a 0. No 2-cell group is prime because every legal pair lies inside G1, G2, or G3.

Essential PIs, the coverage chart and the minimum SOP
The PI chart exposes columns with only one covering group.
Prime implicant |
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|
| X | X | X | X | ||||
| X | X | X | X | ||||
| X | X | X | X |
Read unique columns first. Only G1 covers m2,m10, so it is essential. Only G2 covers m5,m13, so it is essential. G3 covers no unique minterm, making it prime but not essential.
The two EPIs already cover all eight minterms. Therefore:
F = B'D' + C'D
Adding B'C' is valid but redundant. Continue with Prime Implicants & EPI Counting for GATE: Solved Maps for systematic PI counting and larger functions.
Verify the result instead of trusting the loops
m2=0010:B'D'=1andC'D=0, soF=1throughG1.m13=1101:B'D'=0andC'D=1, soF=1throughG2.m0=0000:B'D'=1, so this overlapping minterm givesF=1.m3=0011: bothB'D'andC'Dare0.m15=1111: both terms are0.
The selected cover has 2 product terms and 4 literals. B'D' + C'D + B'C' has 3 terms and 6 literals. It is equivalent but not minimum.
Common K-map and PI traps, then how exam-style questions test them
Trap | Repair |
|---|---|
Writing axis labels as | Use Gray-code order |
Missing edge or corner adjacency | Treat opposite edges as joined. |
Treating diagonal cells as adjacent | Pair only horizontal or vertical neighbours. |
Calling a smaller contained group prime | Expand it whenever a larger valid group contains it. |
Assuming every PI belongs in the minimum cover |
|
Representative questions ask for a minimum SOP, separate PI and EPI counts, a group's legality, a minimum PI-chart cover, or whether don't-cares reduce the expression.
Corners m0,m2,m8,m10 give B'D'. The map has 3 PIs but only 2 EPIs. G3 is prime but absent from the minimum cover. Practise with Boolean Algebra and K-Map MCQs: 12 Solved (GATE), then use the GATE Test Series: Mocks & Topic-wise Tests for timed testing.
K-Map structure and PIs: the short version and next step
Use Gray-code order. Group powers of two with wraparound. List every maximal group before looking for unique coverage. Select all EPIs first, then add only the PIs still needed.
Now redraw Σm(0,1,2,5,8,9,10,13) without looking at the diagram. Recover B'D', C'D, and B'C', then justify why B'D' + C'D is the minimum cover.
Keep learning

Functional Completeness in Digital Logic: NAND, NOR and Worked Examples
Learn what makes a Boolean operator set complete, how NAND and NOR recover a standard basis, and how to verify a four-gate NAND construction.

Boolean Function Counts: Formulas, Worked Examples and Exam Traps
Build the master Boolean-function formula from output choices, then learn how common restrictions change the count through combinations, pairing and inclusion-exclusion.

Analog-Digital Conversion Basics: ADC, DAC, Worked Examples and Exam Patterns
Build ADC and DAC basics from one consistent transfer model, then practise code selection, reconstruction error, flash and SAR conversion, and bit-depth calculations.

Universal Realization with NAND and NOR Gates: Concepts, Worked Example and Exam Patterns
Learn why NAND and NOR are universal, then implement one three-variable function using four NAND gates and four NOR gates with verified input traces.