Karnaugh map grouping rule: adjacent cells drop the variable that changes
The Karnaugh map grouping rule: adjacent cells with the same value combine into one term that omits the variable changing between them, (A AND B) OR (A AND NOT B) = A.
Adjacent cells with the same value combine into one term that omits the input that changes between them.
Two minterms that differ in exactly one variable can be merged, because that variable takes both values across the pair and therefore does not matter: (A AND B) OR (A AND NOT B) is A AND (B OR NOT B), and the complement and identity laws finish the job. A Karnaugh map arranges cells in Gray-code order so that such pairs sit next to each other (including across the edges), and a rectangle of 2, 4, 8 or 16 cells merges that many minterms by dropping one, two, three or four variables.
This is the law the engine applies when it derives an expression from a cover of the map: each group becomes one product term, the groups are OR-ed, and the result is checked for equivalence against the original on every row. A group that is not a legal rectangle (wrong size, wrong shape, a cell with value 0) is reported, not silently accepted.
The algebraic identity is proved below; the Karnaugh map solver shows the same rule applied to a whole map, with the suggested cover and the derived expression.
Statement
(A AND B) OR (A AND NOT B) = A Proof by truth table: (A AND B) OR (A AND NOT B) = A
| # | A | B | lhs | rhs |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | FALSE | FALSE |
| 2 | TRUE | FALSE | TRUE | TRUE |
| 3 | TRUE | TRUE | TRUE | TRUE |
The same law in four notations
(A AND B) OR (A AND NOT B)(A && B) || (A && !B)(A ∧ B) ∨ (A ∧ ¬B)(A·B) + (A·B')\left(A \cdot B\right) + \left(A \cdot \overline{B}\right)AAAAAThe common slip
Grouping diagonal cells. Only cells that differ in one variable are adjacent, and on a Gray-code map that means horizontal or vertical neighbours, with wraparound; a diagonal pair differs in two variables and merges nothing.
Questions
Why do groups have to be powers of two?
Each variable dropped doubles the number of cells covered by the term, so a term that drops k variables covers exactly 2 to the k cells. A group of 3 or 6 cells does not correspond to any single product term.
What about don't-care cells?
A cell no admissible input reaches may be treated as 1 or 0, whichever makes a group larger. The engine marks such cells only when assumptions prove the cell unreachable, and the derived expression is then labelled equivalent within the assumptions.
Related
Guides
Lesson that teaches this
Pitfalls
Tools
- Boolean algebra calculator and simplifier with steps (every law named and verified)
- Logical equivalence checker: two expressions, exact verdict, counterexample
Practice
- Karnaugh map exercises with answers: 2 variables
- Karnaugh map exercises with answers: 3 variables
- Karnaugh map exercises with answers: 4 variables
See also
- Karnaugh map solver: 2 to 4 variables, groups, SOP and POS, don’t-cares from assumptions
- Lesson 11: Karnaugh maps (advanced, 15 min)
- Karnaugh map (K-map): meaning and examples
- Four-variable K-map: Σm(0, 2, 5, 7, 8, 10, 13, 15) simplified
- Prime implicants and essential prime implicants on a K-map
Laws
Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.