boolean-algebra

De Morgan's Laws Explained: Simplifying Complex Circuits

Denny Denny
6 min read
A stunning 3D visualization of De Morgans Laws in digital logic: a NAND gate and an OR gate with inverted inputs shown as ...
Illustrating concepts from "De Morgan s Laws Explained: Simplifying Complex Circuits". Created with AI image generation.

De Morgan’s Laws are two rules that tell you how to push a NOT operation through an AND or an OR. They are among the most frequently used identities in Boolean algebra, and understanding them is essential before tackling circuit optimization, NAND/NOR universality, or any serious digital design work.

This article focuses on building a clear conceptual understanding of what the laws say, why they work, and how to apply them mechanically. For advanced applications — FPGA synthesis, CMOS gate optimization, and NAND-only implementations — see our companion article on applying De Morgan’s Laws in practice.

The Two Laws

Augustus De Morgan, a 19th-century mathematician, discovered two fundamental relationships between AND, OR, and NOT:

De Morgan’s First Law (NAND Equivalence)

AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}

In words: “The complement of a product equals the sum of the complements.” A NAND gate produces the same output as an OR gate whose inputs have been individually inverted.

De Morgan’s Second Law (NOR Equivalence)

A+B=AB\overline{A + B} = \overline{A} \cdot \overline{B}

In words: “The complement of a sum equals the product of the complements.” A NOR gate produces the same output as an AND gate whose inputs have been individually inverted.

De Morgan's First Law demonstration

De Morgan’s First Law: NAND = OR with inverted inputs. Both circuits produce identical outputs for every input combination.

Proving Both Laws with Truth Tables

A truth table is the definitive proof of logical equivalence. If two expressions produce the same output for every possible input, they are identical.

Proof of the First Law: AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}

ABABA \cdot BAB\overline{A \cdot B}A\overline{A}B\overline{B}A+B\overline{A} + \overline{B}Match?
0001111
0101101
1001011
1110000

Proof of the Second Law: A+B=AB\overline{A + B} = \overline{A} \cdot \overline{B}

ABA+BA + BA+B\overline{A + B}A\overline{A}B\overline{B}AB\overline{A} \cdot \overline{B}Match?
0001111
0110100
1010010
1110000

Both laws are proven: every row matches.

De Morgan's Second Law demonstration

De Morgan’s Second Law: NOR = AND with inverted inputs.

The “Break the Bar, Change the Sign” Method

Rather than memorizing the formulas, learn this mechanical three-step process. It works for any number of variables and any level of nesting.

The Three Steps

  1. Break the bar — Split the single negation bar so that each variable gets its own individual bar.
  2. Change the sign — Swap every AND (\cdot) for OR (++), and every OR (++) for AND (\cdot).
  3. Cancel double negations — Wherever you see X\overline{\overline{X}}, replace it with XX.

Worked Example 1: Two Variables

Transform A+B\overline{A + B}:

  • Break the bar: A\overline{A} ??? B\overline{B}
  • Change the sign (OR becomes AND): AB\overline{A} \cdot \overline{B}
  • No double negations to cancel.
  • Result: AB\overline{A} \cdot \overline{B}

Worked Example 2: Three Variables

Transform ABC\overline{A \cdot B \cdot C}:

  • Break the bar: A\overline{A} ??? B\overline{B} ??? C\overline{C}
  • Change the sign (AND becomes OR): A+B+C\overline{A} + \overline{B} + \overline{C}
  • Result: A+B+C\overline{A} + \overline{B} + \overline{C}

This generalizes to any number of inputs: X1X2Xn=X1+X2++Xn\overline{X_1 \cdot X_2 \cdot \ldots \cdot X_n} = \overline{X_1} + \overline{X_2} + \ldots + \overline{X_n}

Worked Example 3: Nested Expression (Multi-Level)

Transform (AB)+C\overline{(A \cdot B) + C}:

Apply De Morgan’s to the outer bar first (treat ABA \cdot B as a single term PP):

  • Break: AB\overline{A \cdot B} ??? C\overline{C}
  • Change sign (OR becomes AND): ABC\overline{A \cdot B} \cdot \overline{C}

Now apply De Morgan’s again to AB\overline{A \cdot B}:

  • AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}

Substitute back: (A+B)C(\overline{A} + \overline{B}) \cdot \overline{C}

Key rule for nested expressions: Always work from the outermost negation bar inward, one level at a time.

Worked Example 4: Double Negation Cleanup

Transform A+B\overline{\overline{A} + \overline{B}}:

  • Break: A\overline{\overline{A}} ??? B\overline{\overline{B}}
  • Change sign (OR becomes AND): AB\overline{\overline{A}} \cdot \overline{\overline{B}}
  • Cancel double negations: ABA \cdot B
  • Result: ABA \cdot B

Circuit-Level Meaning

De Morgan’s Laws are not just algebraic curiosities. Each law has a direct circuit interpretation:

Algebraic FormCircuit Equivalence
AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}A NAND gate = OR gate with inverted inputs (“bubbled OR”)
A+B=AB\overline{A + B} = \overline{A} \cdot \overline{B}A NOR gate = AND gate with inverted inputs (“bubbled AND”)

This means you can always substitute one gate type for another by moving the inversion bubbles. If you need an OR gate but only have NANDs, invert each input before the NAND:

A+B=ABA + B = \overline{\overline{A} \cdot \overline{B}}

Implementation: NOT A, NOT B, then NAND the results.

NAND Gate Universal Logic

Using De Morgan’s Law to build OR from NAND: invert both inputs, then NAND.

Common Mistakes to Avoid

Mistake 1: Forgetting to Change the Sign

The most frequent error is inverting each term but keeping the same operator:

  • Wrong: AB=AB\overline{A \cdot B} = \overline{A} \cdot \overline{B}
  • Correct: AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}

If you do not change AND to OR (or vice versa), you have not applied De Morgan’s Law — you have simply distributed the NOT incorrectly.

Mistake 2: Applying to an Incomplete Bar

The negation bar must cover the entire expression being transformed. If the bar only covers part of the expression, De Morgan’s Law only applies to that part.

  • AB\overline{A} \cdot B is NOT the same as applying De Morgan’s to AB\overline{A \cdot B}. The bar only covers AA here.

Mistake 3: Skipping Levels in Nested Expressions

With nested bars, you must work one level at a time, from the outside in. Trying to “break” all bars simultaneously leads to errors.

Verify It Yourself on digisim.io

Build both sides of De Morgan’s First Law and prove they produce identical outputs:

  1. Circuit A (NAND): Connect inputs A and B to an AND gate, then feed the AND output through a NOT gate.
  2. Circuit B (Bubbled OR): Pass A through a NOT gate and B through another NOT gate, then feed both inverted signals into an OR gate.
  3. Connect both outputs to separate OUTPUT_LIGHT components.
  4. Toggle A and B through all four combinations. Both lights will always match.

For a more detailed analysis, connect both outputs to an OSCILLOSCOPE_8CH and observe that the waveforms are identical.

Open the NAND Universal Logic Template

Try It Yourself

  1. Prove Law 2: Build A+B\overline{A + B} and AB\overline{A} \cdot \overline{B} side by side on digisim.io and verify they match for all inputs.
  2. Three-input NOR: Apply “Break the Bar, Change the Sign” to simplify A+B+C\overline{A + B + C}. (Answer: ABC\overline{A} \cdot \overline{B} \cdot \overline{C})
  3. Nested challenge: Simplify XYZ\overline{\overline{X} \cdot \overline{Y} \cdot \overline{Z}} to its simplest form. (Answer: X+Y+ZX + Y + Z)
  4. Build OR from NAND: Using only NAND gates, implement A+BA + B. Verify with an oscilloscope.

Start Building Your Circuit