De Morgan's laws
Pushing a NOT through a gate
De Morgan's laws say the inverse of an AND is an OR of the inverses and the inverse of an OR is an AND of the inverses, so `NOT (A AND B) = (NOT A) OR (NOT B)` and `NOT (A OR B) = (NOT A) AND (NOT B)`, which is how you push a NOT through a gate and convert between NAND and NOR forms.
Builds onBoolean algebra
You met these laws inside boolean algebra as one of the identities. They earn their own page because they are the single most-used rewrite in all of digital design, the move behind every NAND-only or NOR-only circuit and behind reading any bubbled schematic.
There are exactly two De Morgan's laws, and they are mirror twins. Each tells you what happens when a NOT wraps a whole gate: the NOT breaks apart onto the inputs, and the operation flips as it passes through.
(AB)' = A' + B'
(A + B)' = A'·B'
In plain words: "not both" is the same as "not this or not that", and "not either" is the same as "not this and not that". The recipe to apply either one has two steps, done together: complement each input, and swap AND with OR (or OR with AND).
A concrete example
A door alarm should stay quiet only when the front door and the back door are both closed, and sound otherwise. Call
F and B the "door open" signals. The quiet condition is NOT (F OR B) (neither door open). De Morgan rewrites that as (NOT F) AND (NOT B): quiet exactly when the front door is not open and the back door is not open. Same rule, read two ways, and the second form is what you build if you only have inverters and an AND gate.Verify it on the four rows.
NOT (F OR B) is 1 only when both are 0; (NOT F) AND (NOT B) is also 1 only when both are 0. The columns match on every line, which is what an identity means.| F | B | NOT(F OR B) | (NOT F) AND (NOT B) |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 0 |
NOT (F OR B) = (NOT F) AND (NOT B). The NOT pushed onto each input and the OR flipped to an AND.Bubble pushing: the visual form
On a schematic a NOT is drawn as a small bubble. De Morgan says a bubble on a gate's output can be slid onto its inputs if you also change the gate's shape (AND becomes OR, OR becomes AND). This "bubble pushing" is how a NAND is redrawn as an OR with inverted inputs, and it is why a two-layer NAND-NAND network computes an ordinary AND-OR (sum-of-products) function: the back-to-back bubbles between the layers cancel.
NOT (A AND B). By De Morgan that is identical to (NOT A) OR (NOT B): an OR fed inverted inputs. Open it in the lab and confirm both readings on the same four rows: the output is 0 only when both inputs are 1, and 1 whenever either input is 0.Common mistakes. You must do both steps, not one:
NOT (A AND B) is *not* (NOT A) AND (NOT B) (forgot to flip the operation) and *not* NOT A OR NOT B written but still drawn as an AND. Also complement every input, not just the first. And the law wraps the *whole* gate: NOT (A AND B) is one bubble on the output, which is a different thing from (NOT A) AND B, where only one input is inverted.Try it
Rewrite
NOT (A AND B AND C) so the outer NOT no longer wraps the whole group, then say when the result is 1.Answer
Complement each input and flip AND to OR:
NOT (A AND B AND C) = (NOT A) OR (NOT B) OR (NOT C). It is 1 whenever any of A, B, C is 0, which is exactly when the original A AND B AND C is 0. (The law extends to any number of inputs: complement each, flip the operation once.)Frequently asked
What is De Morgan's law?
De Morgan's two laws say a NOT flips the operation when it crosses a gate:
NOT (A AND B) = (NOT A) OR (NOT B) and NOT (A OR B) = (NOT A) AND (NOT B). To apply one, complement each input and swap AND for OR (or OR for AND).How do you apply De Morgan's law to a circuit?
Slide the inversion bubble from a gate's output onto each of its inputs while changing the gate's shape from AND to OR (or OR to AND). This bubble pushing is how a NAND becomes an OR with inverted inputs, and why a NAND-NAND network computes a sum-of-products: the bubbles between the two layers cancel.
Why is De Morgan's law important?
It lets you convert any logic into a single gate type. Since a NAND is
NOT (A AND B) = (NOT A) OR (NOT B), every AND, OR, and NOT can be rebuilt from NANDs alone (or NORs alone), which is why real chips lean on those two universal gates.What is the difference between De Morgan's law and duality?
De Morgan complements the variables and gives a true equality you can substitute into a formula. The duality principle only swaps AND with OR and
0 with 1, never touches a variable, and produces a *different* identity rather than an equal expression.With De Morgan in hand you can convert any expression to NAND-only or NOR-only form. The companion tool for finding the *smallest* expression to convert is the Karnaugh map; the redundant term it sometimes keeps is explained by the consensus theorem.
Every lesson here builds toward one thing: a working CPU, from the transistor up.
Open the free lab →