EngineerPlay

Boolean algebra laws and Karnaugh map rules

De Morgan's law says (X·Y)′ = X′ + Y′ and (X + Y)′ = X′·Y′: flip every AND and OR and complement every letter. To simplify, use laws such as X + X·Y = X, or group the 1s of a Karnaugh map in rectangles of 1, 2, 4 or 8 cells and keep only the letters that stay the same in each group.

The formulas

FormulaWhat it givesSymbols
(X·Y)′ = X′ + Y′, (X + Y)′ = X′·Y′, X″ = XDe Morgan's lawX, Y = any letters or expressions; ′ = complement (NOT). Push the complement inside: AND becomes OR, OR becomes AND, every part is complemented, and a double complement cancels (X″ = X)
000, 001, 010, 011 → A′A group of 1s in a Karnaugh map as a product termCells are written as bits in the order A, B, C. A group of 1, 2, 4 or 8 cells (a rectangle, may wrap round the edges, Gray-code order) keeps only the letters that stay the same across it: here A = 0 in all four cells, so the term is A′. Add (OR) the group terms
X + X·Y = X, X·(X + Y) = XThe absorption lawX, Y = any letters or expressions; the extra term containing X is absorbed
X + 0 = X, X·1 = X, X + 1 = 1, X·0 = 0The identity and null lawsX = any letter or expression; + is OR, · is AND. Adding 0 or multiplying by 1 changes nothing
X + X = X, X·X = X, X + X′ = 1, X·X′ = 0The idempotent and complement lawsX′ = the complement of X (1 becomes 0 and 0 becomes 1); a letter with its own complement gives 1 for OR and 0 for AND
X + X′·Y = X + Y, X·(X′ + Y) = X·YAbsorbing a complemented letterX, Y = any letters or expressions; X′ drops out because it is 1 only when X is 0
X·Y + X·Y′ = X, X·Y + X′·Y = Y, (X + Y)·(X + Y′) = XCombining two terms that differ in one letterX, Y = any letters or expressions. Take out the shared part: X·(Y + Y′) = X·1 = X. This is why two neighbouring cells in a Karnaugh map merge
000, 010 → A + CA group of 0s in a Karnaugh map as a sum termCells as bits in the order A, B, C. A and C stay 0 across the group, and each kept letter is complemented, so the group of 0s gives the sum A + C. Multiply (AND) the sums to get the product of sums
n_AND + n_OR = nThe gate count of a sum of productsn_AND = terms with 2 or more letters (one AND gate each), n_OR = 1 when there are 2 or more terms (else 0), n = gates in all; complemented inputs are free

Worked example

This example is made by the same code as the practice questions. Open the working to see every step.

Group the 1s in this Karnaugh map. Which is the minimal sum of products?

Karnaugh map with 3 variablesLabels shown, in drawing order: BC, A, 00, 01, 11, 10, 0, 1, 0, 1.BCA000111100111110011
Show the working
  1. The 1s are in cells 000, 001, 010, 011, 110, 111 (bits in the order A, B, C).
  2. Group them in rectangles of 1, 2, 4 or 8 cells, as large and as few as possible, wrapping round the edges. Each group keeps only the letters that stay the same across its cells: 000, 001, 010, 011 → A′; 010, 011, 110, 111 → B.
  3. Add (OR) the group terms together. Answer: A′ + B.

Common mistakes

These are the wrong answers the practice questions offer, and the slip that leads to each.

Questions

What is the formula for De Morgan's law?

(X·Y)′ = X′ + Y′, (X + Y)′ = X′·Y′, X″ = X. Symbols: X, Y = any letters or expressions; ′ = complement (NOT). Push the complement inside: AND becomes OR, OR becomes AND, every part is complemented, and a double complement cancels (X″ = X).

What is the formula for a group of 1s in a Karnaugh map as a product term?

000, 001, 010, 011 → A′. Symbols: Cells are written as bits in the order A, B, C. A group of 1, 2, 4 or 8 cells (a rectangle, may wrap round the edges, Gray-code order) keeps only the letters that stay the same across it: here A = 0 in all four cells, so the term is A′. Add (OR) the group terms.

What is the formula for the absorption law?

X + X·Y = X, X·(X + Y) = X. Symbols: X, Y = any letters or expressions; the extra term containing X is absorbed.