What is De Morgan's theorem?
The rules for transforming logic expressions: NOT (A AND B) equals (NOT A) OR (NOT B), and NOT (A OR B) equals (NOT A) AND (NOT B).
Field: Logic circuits
Read the beginner explainer: What Is a Logic Gate? AND, OR, NOT and How Gates Compute
Japanese name: ド・モルガンの定理
The two forms
The theorem has two forms. The first says that the negation of A AND B equals NOT A OR NOT B; the second says that the negation of A OR B equals NOT A AND NOT B. In symbols, the negation of the whole of A·B equals Ā + B̄, and the negation of the whole of A + B equals Ā·B̄. The key point is that AND and OR swap when the negation is distributed inside. Writing a truth table for the four combinations of A and B shows that both sides agree.
What it means in circuits
A NAND gate behaves the same as inverting each input and then taking OR, and a NOR gate behaves the same as inverting each input and then taking AND. On a schematic, moving the bubble (inversion) from the output to the inputs changes the gate shape between AND and OR. Because of this, a two-level circuit of AND gates followed by an OR gate can be replaced by a two-level circuit of NAND gates only. In CMOS, NAND and NOR take fewer transistors than AND and OR, so this replacement is used all the time.
Where it is used and a common mistake
It is used when simplifying logic expressions, reading active-low signals and rewriting conditions in programs. For example, the condition that A and B are not both true is the same as A is false or B is false. The most common mistake is distributing the negation but forgetting to swap AND and OR. With a long expression, applying the theorem one level at a time from the outermost negation reduces errors.
Try it: questions about De Morgan's theorem
- A(NOT A) AND (NOT B)
- B(NOT A) OR (NOT B)
- CA OR B
Show answer and explanation
Answer: B. (NOT A) OR (NOT B)
De Morgan's theorem states NOT(A AND B) = (NOT A) OR (NOT B) and NOT(A OR B) = (NOT A) AND (NOT B): distributing a negation swaps AND and OR. In words, "not both true" equals "at least one false." In schematics a NAND can be redrawn as an OR with bubbled inputs, which helps when handling active-low signals or building circuits from NAND gates alone.
FAQ
Does it hold for three or more variables?
Yes. The negation of the whole of A·B·C is Ā + B̄ + C̄, and the negation of the whole of A + B + C is Ā·B̄·C̄. However many variables there are, negate each one and swap AND and OR.
Why can every circuit be built from NAND gates alone?
Tying the two inputs of a NAND together gives NOT, and negating the output of a NAND gives AND. By De Morgan's theorem, negating each input before a NAND gives OR. With NOT, AND and OR available, any logic expression can be built. The same is true of NOR.
Books on Logic circuits Ad
Learn hands-on: parts and kits
Building real circuits is a good way to check what you learned in the questions.
As an Amazon Associate I earn from qualifying purchases.
Semiconductor, Electronics and Computing Calculators
This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.
Back to the glossary