Digital logic · Part 20 of 36

Boolean algebra and minimisation

Intermediate 17 min

Rules of Boolean algebra, De Morgan’s laws, sum-of-products from truth tables and Karnaugh maps for minimising logic.

What you will learn

  • You can apply Boolean identities and De Morgan’s laws.
  • You can write a sum-of-products expression from a truth table.
  • You can minimise functions of up to four variables with a Karnaugh map.

Before this: Binary numbers and logic gates

Algebra with two values

George Boole published the algebra of true and false in 1854; Claude Shannon showed in his 1937 master's thesis that it describes relay switching circuits. With variables that are 0 or 1, AND (·), OR (+) and NOT (¬ or a bar), these identities hold:

LawAND formOR form
IdentityA · 1 = AA + 0 = A
NullA · 0 = 0A + 1 = 1
IdempotentA · A = AA + A = A
ComplementA · ¬A = 0A + ¬A = 1
AbsorptionA · (A + B) = AA + A · B = A
DistributiveA · (B + C) = A·B + A·CA + B·C = (A + B) · (A + C)

Note the last one: unlike ordinary algebra, OR distributes over AND too.

Two switches in series and two in parallel each lighting a bulb

De Morgan's laws

¬(A · B) = ¬A + ¬B and ¬(A + B) = ¬A · ¬B

"Not (A and B)" is "not A or not B". In circuits: a NAND gate is an OR gate with inverted inputs. De Morgan lets you move inversions around and implement any function with only NAND (or only NOR) gates.

From truth table to expression

Every truth table can be written as a sum of products (SOP): one AND term (a minterm) for each row where the output is 1, all ORed together.

Example — a "majority" function of three inputs (1 when at least two inputs are 1) is 1 in rows 011, 101, 110 and 111:

F = ¬A·B·C + A·¬B·C + A·B·¬C + A·B·C

Correct, but costly: four 3-input ANDs and a 4-input OR.

A staircase light with a switch at the bottom and a switch at the top both controlling one lamp

Karnaugh maps

A Karnaugh map arranges the truth table in a grid whose neighbouring cells differ in exactly one variable (rows and columns in Gray code order: 00, 01, 11, 10). Adjacent 1s can be grouped in rectangles of 1, 2, 4 or 8 cells; each group becomes one simpler product term, because the variable that changes inside the group drops out. Groups may wrap around the edges and overlap.

For the majority function the map gives three groups of two, so:

F = A·B + A·C + B·C

— three 2-input ANDs and one OR. Rules: make groups as large as possible, use as few groups as possible, and cover every 1. Don't-care cells (input combinations that never happen) may be included in groups when that helps.

A three-variable Karnaugh map for the majority function with three overlapping groups
Three groups of two: F = AB + AC + BC

Beyond hand methods

K-maps work up to four (sometimes five or six) variables. Software uses the Quine–McCluskey algorithm (exact, exponential) or heuristics like Espresso for larger functions; FPGA and chip design tools do this automatically when they synthesise your code. Ohmforge's logic minimiser shows the prime implicants and the minimal cover for your own truth tables.

Minimal two-level logic is not always the best real circuit: shared terms, multi-level logic, speed and power all play a role. But understanding minimisation lets you read what the tools produce.

Key points

  • Boolean algebra: identity, null, complement, absorption and both distributive laws.
  • De Morgan: ¬(A·B) = ¬A + ¬B and ¬(A + B) = ¬A·¬B.
  • Any truth table → sum of minterms; then minimise.
  • Karnaugh maps group adjacent 1s (Gray-code order) in blocks of 1, 2, 4, 8; don't-cares help.
  • Tools use Quine–McCluskey and Espresso; Ohmforge's minimiser shows prime implicants.

Flashcards

Question: State De Morgan’s first law.
Answer: ¬(A · B) = ¬A + ¬B.
Question: Simplify A + A · B.
Answer: A (absorption).
Question: Why are Karnaugh map rows ordered 00, 01, 11, 10?
Answer: Gray code — neighbours differ in exactly one variable.
Question: What is the minimal majority function of A, B, C?
Answer: AB + AC + BC.

Check yourself

Think about your answer, then open it. In the app the quiz is interactive, earns points and brings back what you missed.

  1. What is ¬(A + B) by De Morgan?

    • ¬A · ¬B
    • ¬A + ¬B
    • A · B
    • ¬A + B
    Show the answer

    ¬A · ¬B

    The complement of an OR is the AND of the complements.

    Source: Harris & Harris, 2.3.3

  2. Simplify A · (A + B).

    • A
    • B
    • A · B
    • A + B
    Show the answer

    A

    Absorption law.

    Source: Harris & Harris, 2.3

  3. How many cells does a Karnaugh map for four variables have?

    Show the answer

    16

    2⁴ = 16 cells.

    Source: Harris & Harris, 2.7

  4. Which group sizes are allowed in a Karnaugh map?

    • 1
    • 2
    • 3
    • 4
    Show the answer

    1; 2; 4

    Groups must be powers of two: 1, 2, 4, 8 …

    Source: Harris & Harris, 2.7

Sources

Facts checked on 2026-11-30. Skillgrove lessons are free learning material — no certificate and no accreditation.