De Morgan's Laws

Push a negation through any expression and see both forms side by side.

Complement anything — a product, a sum, a whole sum of products — and the negation is pushed inward one named law at a time.

Warning:

Check how this was read

  • Read "AB" as A · B — 2 variables ANDed together. Declare "AB" as a variable name if you meant one variable.

read as ¬((A · B) + C)

Notation ▾

' is NOT and binds to the single item before it, so (A+B)' complements the whole group and AB' is A·(B′). The overbar is a grouping symbol — bracket whatever it is meant to cover. The full notation and precedence rules are below.

Toward the variables, until every complement sits on a single letter — negation normal form.

Start from a worked example

What you typed, read back

¬((A · B) + C)

Where each bar ends — the extent of a complement is its operand, and this is the reading that was used:

  • the prime covers A · B + C — all of it
Warning:

Where does the bar end?

(A·B)′ and A·B′ are different functions: the first complements the whole product, the second only B. Postfix ' binds to the single item before it, so bracket whatever the bar is meant to cover. Both readings have their own worked example — (A·B)′ and (A + B)′.

The answer

Negation normal form

(A′ + B′) · C′

Checked against all 8 input combinations2 named steps

This is a normalisation, not a minimisation. Pushing negations in stops as soon as every complement sits on a variable; the minimal forms are below, and where they differ from the answer above neither is wrong — they answer two different questions.

Pushing the negation in

Every line of the working, with the law that produced it
#Working lineLaw
0(A · B + C)′start
1(A · B)′ · C′De Morgan (A + B)' = A'·B'
2(A′ + B′) · C′De Morgan (A·B)' = A' + B'

Now in negation normal form: every prime sits on a single variable, which is the engine’s own stopping rule.

Step by step

  1. Step 1De Morgan(A + B)' = A'·B'

    with A = A · B, B = C

    (A · B + C)′becomes(A · B)′ · C′

    Method: De Morgan's laws; Shannon, A Symbolic Analysis of Relay and Switching Circuits (1938)

You are already at the first step.1 of 2 showing. The whole derivation is in the table above either way.

The check, row by row

De Morgan is the law students most want to check rather than take on faith, and the check costs 8 rows.

What you typed against the result, on every input combination
ABCbeforeafteragree?
00011agree
00100agree
01011agree
01100agree
10011agree
10100agree
11000agree
11100agree

Both laws, always

The two forms are learned as a pair and half the errors are applying the wrong one, so the page states both whichever one your expression needed.

  • (A · B)′ = A′ + B′
  • (A + B)′ = A′ · B′

Break the bar, change the sign. Break the overbar over the whole expression into two overbars over the parts, and flip the operator between them. Both are proved row by row below.

Bubble pushing — the same law, drawn

Change the body (AND ↔ OR) and toggle the bubble on every input and on the output. Seeing the bubbles move is the explanation, and it is why NAND and NOR are universal.

Before — the expression as you typed it

Logic gate schematic for Y = (A · B + C)′, drawn with IEEE 91-1984 distinctive shapes Logic gate schematic. 3 inputs: A, B and C. 3 gates: 1 AND, 1 OR and 1 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 3 gates. A B C Y
Logic gate schematic for Y = (A · B + C)′, drawn with IEC 60617-12 rectangular symbols Logic gate schematic. 3 inputs: A, B and C. 3 gates: 1 AND, 1 OR and 1 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 3 gates. A B C & ≥1 1 Y
Distinctive shape — ANSI/IEEE Std 91-1984Rectangular shape — IEC 60617-12 (constructed metrics)IEC 60617-12:1997 is a paid standard and its per-symbol dimensions are not public. These rectangular symbols follow the published module-grid construction (module M = 6.5 units, so 4M = 26 matches the IEEE body height; line width M/10; qualifying symbol top-centre; connection pitch 2M; negation circle radius M/2 tangent outside the outline). The shapes and qualifying symbols are standard; the exact metrics are our construction, not a quotation.

Circuit description and netlist

Logic gate schematic. 3 inputs: A, B and C. 3 gates: 1 AND, 1 OR and 1 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 3 gates.

The circuit computes Y = (A · B + C)′, read as ¬((A · B) + C).

Netlist for Y: every gate, its inputs and the expression it carries — Before — the expression as you typed it
GateTypeInputsOutput expression
g0ANDA, BA · B
g1ORg0, CA · B + C
g2NOTg1(A · B + C)′

Double bubble inserted — two inversions on a wire cancel

Logic gate schematic for Y = ((A · B)′′ + C′′)′, drawn with IEEE 91-1984 distinctive shapes Logic gate schematic. 3 inputs: A, B and C. 7 gates: 1 AND, 1 OR and 5 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 5 gates. A B C Y
Logic gate schematic for Y = ((A · B)′′ + C′′)′, drawn with IEC 60617-12 rectangular symbols Logic gate schematic. 3 inputs: A, B and C. 7 gates: 1 AND, 1 OR and 5 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 5 gates. A B C & 1 1 1 1 ≥1 1 Y
Distinctive shape — ANSI/IEEE Std 91-1984Rectangular shape — IEC 60617-12 (constructed metrics)IEC 60617-12:1997 is a paid standard and its per-symbol dimensions are not public. These rectangular symbols follow the published module-grid construction (module M = 6.5 units, so 4M = 26 matches the IEEE body height; line width M/10; qualifying symbol top-centre; connection pitch 2M; negation circle radius M/2 tangent outside the outline). The shapes and qualifying symbols are standard; the exact metrics are our construction, not a quotation.

Circuit description and netlist

Logic gate schematic. 3 inputs: A, B and C. 7 gates: 1 AND, 1 OR and 5 NOT. The output Y is driven by a NOT gate. The longest signal path passes through 5 gates.

The circuit computes Y = ((A · B)′′ + C′′)′, read as ¬(¬¬(A · B) + ¬¬C).

Netlist for Y: every gate, its inputs and the expression it carries — Double bubble inserted — two inversions on a wire cancel
GateTypeInputsOutput expression
g0ANDA, BA · B
g1NOTg0(A · B)′
g2NOTg1(A · B)′′
g3NOTCC′
g4NOTg3C′′
g5ORg2, g4(A · B)′′ + C′′
g6NOTg5((A · B)′′ + C′′)′

After — the pushed-in form

Logic gate schematic for Y = (A′ + B′) · C′, drawn with IEEE 91-1984 distinctive shapes Logic gate schematic. 3 inputs: A, B and C. 5 gates: 1 AND, 1 OR and 3 NOT. The output Y is driven by an AND gate. The longest signal path passes through 3 gates. A B C Y
Logic gate schematic for Y = (A′ + B′) · C′, drawn with IEC 60617-12 rectangular symbols Logic gate schematic. 3 inputs: A, B and C. 5 gates: 1 AND, 1 OR and 3 NOT. The output Y is driven by an AND gate. The longest signal path passes through 3 gates. A B C 1 1 1 ≥1 & Y
Distinctive shape — ANSI/IEEE Std 91-1984Rectangular shape — IEC 60617-12 (constructed metrics)IEC 60617-12:1997 is a paid standard and its per-symbol dimensions are not public. These rectangular symbols follow the published module-grid construction (module M = 6.5 units, so 4M = 26 matches the IEEE body height; line width M/10; qualifying symbol top-centre; connection pitch 2M; negation circle radius M/2 tangent outside the outline). The shapes and qualifying symbols are standard; the exact metrics are our construction, not a quotation.

Circuit description and netlist

Logic gate schematic. 3 inputs: A, B and C. 5 gates: 1 AND, 1 OR and 3 NOT. The output Y is driven by an AND gate. The longest signal path passes through 3 gates.

The circuit computes Y = (A′ + B′) · C′, read as ((¬A + ¬B) · ¬C).

Netlist for Y: every gate, its inputs and the expression it carries — After — the pushed-in form
GateTypeInputsOutput expression
g0NOTAA′
g1NOTBB′
g2ORg0, g1A′ + B′
g3NOTCC′
g4ANDg2, g3(A′ + B′) · C′
View as a truth table

The same function as index lists

  • Σm(0, 2, 4)
  • ΠM(1, 3, 5, 6, 7)

Complementing turns a sum of products into a product of sums and back. Both lists, written out term by term.

Minimal forms

Minimal SOP

A′ · C′ + B′ · C′

2 terms · 4 literals · verified exactthis minimal form is uniquePermalink to this form

Minimal POS

C′ · (A′ + B′)

2 terms · 3 literals · verified exactthis minimal form is uniquePermalink to this form

POS is cheaper here — 2 terms · 3 literals as a product of sums against 2 terms · 4 literals as a sum of products.

Why you can trust the count

Two pipelines run over the same prime-implicant chart. The walkthrough uses essential primes, then minterm (“row”) dominance, then implicant (“column”) dominance, then Petrick’s method — the sequence a textbook shows, which reaches one correct answer.

The list of every minimum cover is produced by a second pipeline that uses essentials and minterm dominance only. Essential-prime extraction is safe for enumeration and minterm dominance is safe; implicant dominance is not — striking out a dominated prime discards every cover that used it, and some of those cost exactly the minimum.

So the walkthrough answers “what is an optimum?” and the list answers “what are all the optima?”. Both are shown because the textbook shows the first and the truth is the second.

Notation and operator precedence used here

· is AND, + is OR, a prime is NOT, is XOR and is XNOR. In the field, + is OR, juxtaposition and * are AND, ' is NOT, ^ is XOR, @ is XNOR, -> is implication and <-> is the biconditional. Precedence runs, highest to lowest: ( ) → NOT → AND → XOR / XNOR → NAND / NOR → OR → IMPLIES (right-associative) → IFF. The fully parenthesised reading is echoed back on every keystroke.

The overbar is a grouping symbol, and this page leans on that harder than any other. Its extent is its operand, and plain text cannot express that — so type ' or ¬( … ), and overbars are drawn on output only. Half of all De Morgan errors are really overbar-extent errors: (A·B)′ and A·B′ are different functions, and a hand-written bar that stops in the wrong place is the reason.

Postfix ′ binds to the single item immediately before it — a variable, a parenthesised group, or another prime. So AB' is A·(B′), (A+B)' complements the whole group, and A'' is A. And | means OR here, never the Sheffer stroke: in pure logic notation the bar is NAND, in every programming language it is OR, and that is the reading almost everyone arrives with. NAND is or the word NAND.

The two laws

(A · B)′ = A′ + B′

Not (both) is (not one) or (not the other).

(A + B)′ = A′ · B′

Not (either) is (not one) and (not the other).

The mnemonic that actually works: break the bar, change the sign. Break the overbar over the whole expression into two overbars over the parts, and flip the operator between them. The page opens on (AB + C)', which needs both laws in order — (A · B)′ · C′ by De Morgan, then (A′ + B′) · C′ by De Morgan — and lands on (A′ + B′) · C′.

The proof

Two proofs, because two audiences want different ones. By truth table is complete and checkable in ten seconds: four rows for each law, both columns and an agreement column. Every row below was computed by the engine when this page was built, and a law whose two sides stopped agreeing would fail the build rather than appear here as a false proof.

(A·B)′ = A′ + B′ — checked over all 4 assignments
AB(A · B)′A′ + B′agree?
0011agree
0111agree
1011agree
1100agree
(A + B)′ = A′·B′ — checked over all 4 assignments
AB(A + B)′A′ · B′agree?
0011agree
0100agree
1000agree
1100agree

By uniqueness of the complement is the proof that generalises. To show A′ + B′ is the complement of A·B, show (A·B) + (A′ + B′) = 1 and (A·B) · (A′ + B′) = 0 — both verified at build time. Since an element of a Boolean algebra has exactly one complement, the two are equal.

That proof extends to any number of operands by induction on associativity, which a four-row table cannot do: (a₁ · a₂ · … · aₙ)′ = a₁′ + a₂′ + … + aₙ′ and (a₁ + a₂ + … + aₙ)′ = a₁′ · a₂′ · … · aₙ′. The three-operand case is verified in both directions: (A · B · C)′ is A′ + B′ + C′, and (A + B + C)′ is A′ · B′ · C′. A four-input NAND is therefore one gate, not a chain of two-input ones.

Why the bar is not distributive

Wrong: (A + B)′ = A′ + B′. A complement is not a factor and does not distribute over the operator underneath it — the operator itself changes. One disagreeing row is a proof and a paragraph is not: A = 0, B = 1 gives (A + B)′ = 0 but A′ + B′ = 1.

Right: (A + B)′ = A′ · B′.

Bubble pushing

De Morgan drawn instead of written — the same law, applied to a schematic. Four rewrites on the diagram:

  1. Two bubbles on one wire annihilate. That is Involution, drawn.
  2. A gate with an output bubble is the other gate with input bubbles. A NAND is an OR with both inputs inverted; a NOR is an AND with both inputs inverted.
  3. A two-level AND–OR network becomes NAND–NAND by inserting a bubble pair on every AND→OR wire. Nothing changes: each pair cancels.
  4. The dual holds for OR–AND, which becomes NOR–NOR the same way.

This is what makes NAND and NOR universal, and it is why IEEE Std 91 gives every gate an alternative symbol. Draw any expression and watch the bubbles move.

De Morgan in code

!(a && b) is !a || !b, and !(a || b) is !a && !b. Getting it wrong is a real bug, not only a lost mark — inverting a compound guard by adding one ! at the front and leaving the operator alone is one of the most common conditional errors there is.

Note that | in this toolkit is OR, never the Sheffer stroke. In pure logic notation the bar is NAND; in every programming language it is OR, and that is the reading almost everyone arrives with.

De Morgan for sets and for quantifiers

The same shape holds for set complement — (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ and (A ∩ B)ᶜ = Aᶜ ∪ Bᶜ — and for quantifiers — ¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x) — because all three are Boolean algebras or behave like them. This is a digital-logic tool and not a set-theory one: the paragraph is here because those searches land here, and it does not pretend to be more. The truth-table generator handles the propositional half of that syllabus.

Where the complement is not the dual

The dual swaps · with + and 0 with 1 and leaves the literals alone. The complement does that and complements every literal: f ᵈ(x) = f′(x′), which is not f′. Confusing them is why a minimal POS must be derived by minimising the OFF-set and De Morganing each cube, and never by dualising the minimal SOP. Duality, in full.

Limits, stated plainly

The tool pushes negations through AND, OR, XOR, XNOR, NAND, NOR, implication and the biconditional. The derived operators are expanded to their definitions first, and the page names that step rather than performing it silently — so (A ⊕ B)′ begins with Definition of XOR and only then applies De Morgan.

The step-by-step derivation is limited to 6variables. Above that the answer, the truth-table check and the minimal forms are still exact — the answer comes from the engine's pushNegationsIn, which has no variable limit — and the page says so where the steps would have been rather than truncating quietly.

It does not minimise unless you ask. Negation normal form and minimal SOP are different destinations: this page opens on (AB + C)', whose NNF is (A′ + B′) · C′, whose minimal SOP is A′ · C′ + B′ · C′ and whose minimal POS is C′ · (A′ + B′) — with Σm(0, 2, 4) and ΠM(1, 3, 5, 6, 7). All of those numbers are computed by the engine at build time.

Worked examples

Sources

  • De Morgan, Augustus. Formal Logic: or, The Calculus of Inference, Necessary and Probable. London: Taylor and Walton, 1847.
  • De Morgan, Augustus. “On the Syllogism, No. III, and on Logic in General.” Transactions of the Cambridge Philosophical Society 10 (1858): 173–230.
  • Boole, George. An Investigation of the Laws of Thought, on Which are Founded the Mathematical Theories of Logic and Probabilities. London: Walton and Maberly, 1854.
  • Huntington, Edward V. “Sets of Independent Postulates for the Algebra of Logic.” Transactions of the American Mathematical Society 5, no. 3 (1904): 288–309. doi:10.2307/1986459 — uniqueness of the complement, which is the proof used here.
  • Shannon, Claude E. “A Symbolic Analysis of Relay and Switching Circuits.” Transactions of the American Institute of Electrical Engineers 57, no. 12 (December 1938): 713–723. doi:10.1109/T-AIEE.1938.5057767 — the switching-circuit reading, which is bubble pushing.
  • Sheffer, Henry M. “A Set of Five Independent Postulates for Boolean Algebras, with Application to Logical Constants.” Transactions of the American Mathematical Society 14, no. 4 (1913): 481–488. doi:10.2307/1988701 — for the note that | is OR here and not the Sheffer stroke.
  • IEEE. IEEE Standard Graphic Symbols for Logic Functions. IEEE Std 91-1984 — the alternative (bubbled) gate symbols the gate-level view draws.