Digital Electronics

3-Variable K-Map

By CourseTron Team ·  7 min read ·  Updated Oct 2026 💬 𝕏 in f
Table of Contents
    ? Print / Save as PDF

    In short: A 3-variable K-map is a 2×4 grid whose columns follow Gray code (00, 01, 11, 10) so that every pair of neighbouring cells differs in exactly one variable, which lets you spot and merge groups of 1, 2, 4 or 8 minterms into smaller product terms by eye.

    Why a K-map exists at all

    Boolean algebra can simplify any expression, but the algebra gives no hint about which identity to apply next. You can spend ten lines on a function that a trained eye reduces in ten seconds. Maurice Karnaugh, working at Bell Labs, published his chart in 1953 as a refinement of Edward Veitch's 1952 diagram. The idea is to draw the truth table so that logical adjacency becomes physical adjacency. Two minterms that differ in a single variable can be merged with the rule XY + XY′ = X, and on a K-map those two minterms sit side by side.

    For three variables the whole function fits in eight cells, which makes it the ideal place to build the intuition you will reuse on the 4-variable K-map. It is also a favourite in written interviews because it tests whether you really understand adjacency or have only memorised a drawing.

    Building the layout: rows, columns and Gray code

    Put variable A on the rows (0 and 1) and the pair BC on the columns. The columns must not run in binary order. They run 00, 01, 11, 10. Look at what changes between neighbours: 00 to 01 flips C, 01 to 11 flips B, 11 to 10 flips C. Exactly one bit moves each time. In plain binary, going from 01 to 10 flips two bits at once, so those two cells would be logically distant even though they sit next to each other on paper, and the grouping trick would silently break.

    3-variable K-map: minterm numbers and ABC values BC columns, Gray order → 00011110 A = 0A = 1 m0m1m3m2 m4m5m7m6 000001011010 100101111110 left and right edges are neighbours (wrap-around) CourseTron · coursetron.com
    Minterm m(k) sits where ABC equals k in binary. Note m3 before m2: that swap is the Gray code at work.

    Key fact: The map is a cylinder, not a rectangle. Column 00 and column 10 are adjacent, so m0 merges with m2 and m4 merges with m6.

    Watching the Gray code move

    The animation below walks across the columns and names the single variable that flips at each step. The last step, from 10 back to 00, is the wrap-around: B changes, nothing else.

    Gray code walk: one bit flips per step 00011110 00 → 01 : only C flips 01 → 11 : only B flips 11 → 10 : only C flips 10 → 00 : only B flips (wrap-around) Plain binary 01 → 10 would flip two bits at once, which breaks adjacency. CourseTron · coursetron.com
    The orange frame steps through 00, 01, 11, 10 and then wraps to 00.

    Grouping rules and what each group buys you

    Once the 1s are plotted, you circle rectangles of 1s whose size is a power of two. Bigger rectangles mean fewer literals, because every variable that takes both values inside the rectangle drops out of the term.

    Group sizeVariables eliminatedLiterals leftExample
    1 cell03m5 = AB′C
    2 cells12m1 + m5 = B′C
    4 cells21m1+m3+m5+m7 = C
    8 cells3constant 1all ones: F = 1

    The discipline is simple. Make every group as large as possible, use as few groups as possible, let groups overlap freely, and never circle a 0. Groups of three or six are illegal, because three cells cannot share a fixed pattern in all but some variables.

    Worked example 1: two equally good answers

    Take F(A,B,C) = Σm(0,1,2,5,6,7). Every group of four fails, since each candidate quad would include m3 or m4, which are zeros. So you settle for pairs, and the 1s form a ring around the map. The ring lets you cover them in two different ways, each with three terms.

    F = Σm(0,1,2,5,6,7): two minimal covers Cover 1 Cover 2 00011110 00011110 A=0A=1A=0A=1 1101 0111 1101 0111 F = A′B′ + BC′ + AC orange m0,m1 · purple m2,m6 · green m5,m7 F = A′C′ + B′C + AB orange m0,m2 (wrap) · purple m1,m5 · green m6,m7 CourseTron · coursetron.com
    Both covers use three two-cell groups, so both are minimal. Dashed boxes show one group split by the wrap-around.

    The two answers are logically identical and cost the same: three AND terms of two literals plus one three-input OR. A tool will pick whichever its heuristics reach first, and your exam answer is correct with either.

    Key fact: A minimal sum of products is not always unique. Different covers with the same literal count are equivalent, so never mark one as wrong just because it differs from the answer key.

    Worked example 2: don't-cares

    Suppose a decoder output must be 1 for inputs 1, 5 and 6, and inputs 2, 3 and 7 can never occur, so they are don't-cares: F = Σm(1,5,6) + d(2,3,7). Plot X in those three cells. Treat each X as a 1 only when it helps. The column C=1 holds m1, m3, m5, m7, a quad using the don't-cares 3 and 7, giving the single literal C. The row pair m2, m3, m6, m7 forms another quad giving B, and it covers m6. The result is F = B + C, one OR gate, instead of the three-term expression you would get by ignoring the don't-cares. That is how real design freedom turns into saved area.

    Reading the map the other way: product of sums

    To get a product-of-sums form, group the 0s instead and write each group as a sum with inverted literals. For the function above that gives F′ = B′C′ when you group zeros, so F = B + C again, by De Morgan. Choose sum of products for NAND-NAND mapping and product of sums for NOR-NOR; the ideas behind both are covered in SOP and POS forms.

    Where K-maps stop and tools take over

    Hand minimisation is practical to about five variables. Beyond that, synthesis tools such as Synopsys Design Compiler and Cadence Genus use algorithmic minimisers in the Espresso and Quine-McCluskey family, then map the result onto a standard-cell library with timing in mind. They also restructure logic for delay, not only literal count, so the netlist you get is rarely the textbook minimum. Still, the map teaches the one skill tools cannot replace: seeing why a result is right.

    One practical hazard is worth knowing. Two adjacent groups that do not overlap can produce a brief glitch, a static-1 hazard, when the input moves between them. In Example 1, Cover 1 has this problem between the AC and BC′ terms when A=1, C=1 switches while B=1. Adding the redundant consensus term AB removes the glitch, at the cost of one more gate. If you want to practise these trade-offs on real flows, the industry-style training at ChipXpert VLSI training builds on exactly this foundation.

    Common mistakes

    • Writing columns as 00, 01, 10, 11. This is the single most common error and makes the whole map wrong.
    • Forgetting the wrap-around group between column 00 and column 10.
    • Circling three or six cells, or a non-rectangular shape.
    • Stopping at pairs when a quad exists, which leaves an extra literal in the answer.
    • Reading the group label from the cell numbers instead of from the variables that stay constant.

    Ready to go further? The CourseTron digital electronics course continues through four-variable maps, hazards and sequential design.

    Master combinational logic with guided practice: join the CourseTron Digital Electronics course and minimise real circuits with confidence. Browse it at /courses.

    FAQ

    Why does a 3-variable K-map use Gray code?

    Gray code guarantees that neighbouring columns differ in only one variable, so adjacent 1s can be merged using XY + XY′ = X. Binary order would put non-adjacent minterms side by side.

    Can I group 3 or 6 cells together?

    No. Groups must be rectangles whose sizes are powers of two (1, 2, 4, 8). A group of three would not share a common pattern across a whole subcube.

    Is the minimal expression unique?

    Not always. Cyclic patterns, like Σm(0,1,2,5,6,7), have more than one minimal cover with the same cost, and any one of them is a valid answer.

    How do don't-cares help?

    You may treat each don't-care as 0 or 1, whichever enlarges a group. That often removes literals and gates without changing any specified output.

    Advertisement