De Morgan's Theorem Calculator
De Morgan's laws say that the complement of an AND is the OR of the complements, and the complement of an OR is the AND of the complements. Flip the inputs to see both laws agree on every row, view the gate equivalents, or type your own Boolean expression and push its negations down to the variables.
(A · B)' = A' + B'(A + B)' = A' · B'Step-by-step
Summary
Gate equivalents (using A and B)
A small circle means inversion. A NAND gate equals an OR gate with inverted inputs, and a NOR gate equals an AND gate with inverted inputs. Teal wires carry 1, grey wires carry 0.
Truth table
Columns (A·B…)' and A'+B'… are identical on every row, as are (A+B…)' and A'·B'… Your current row is highlighted.
Try your own expression
Use variables A to D. Write AND as · or * or & (or just put letters together), OR as +, and NOT as a prime (A') or ! before the variable. Parentheses group terms. Constants 0 and 1 are allowed.
Related identities and uses
| Rule | Expression | Why it matters |
|---|---|---|
| De Morgan 1 | (A·B)' = A' + B' | NAND = OR of inverted inputs |
| De Morgan 2 | (A+B)' = A'·B' | NOR = AND of inverted inputs |
| Double negation | (A')' = A | Two inversions cancel |
| AND from NOR | A·B = (A'+B')' | NOR is a universal gate |
| OR from NAND | A+B = (A'·B')' | NAND is a universal gate |
| NOT from NAND | A' = (A·A)' | One gate type builds everything |
| In code | !(a && b) == (!a || !b) | Rewrite conditions more clearly |
FAQ
What does De Morgan's theorem say?
Negating an AND gives an OR of the negated inputs, and negating an OR gives an AND of the negated inputs: (A·B)' = A' + B' and (A+B)' = A'·B'. It extends to any number of variables: (A·B·C)' = A' + B' + C'.
How does it help in circuit design?
It lets you convert between gate types, for example building a design only from NAND gates, and it underlies "bubble pushing" in schematics. It also helps simplify expressions with long negation bars.
How do I apply it to a bigger expression?
Break the bar over a group, swap AND for OR (or OR for AND), and put a bar on each part. Repeat until only single variables are negated. The expression tool above does this automatically and shows each step.
Is this the same as distribution?
No. Distribution rewrites A·(B+C) as A·B + A·C. De Morgan's laws instead move a negation across a group while swapping its operator.
Variables
| Symbol | Quantity | Unit |
|---|---|---|
| A | Input A | dimensionless |
| B | Input B | dimensionless |
| Y | Output (A·B)' | dimensionless |
| Z | Output A' + B' | dimensionless |
What it means
De Morgan’s theorem provides rules for simplifying Boolean expressions. It states that the complement of an AND is the OR of complements: (A·B)' = A' + B', and the complement of an OR is the AND of complements: (A+B)' = A' · B'. These transformations are essential for converting between positive and negative logic, and for simplifying complex logic circuits. They allow the use of different gate types (NAND vs NOR) and are heavily used in digital logic design. De Morgan’s theorem also helps in minimising logic functions using Boolean algebra. Example: To implement a function F = (A·B)' using only NOR gates, De Morgan gives F = A' + B', which can be built with two inverters and a NOR gate, or directly with a NAND gate. This theorem is fundamental for digital electronics.
Worked example
De Morgan's Theorem – Practical Example
Real‑World| Parameter | Value |
|---|---|
| Inputs | A, B |
| Original | (A·B)' |
| Theorem | (A·B)' = A' + B' |
Common mistakes
Watch unit consistency and the assumptions behind the formula; misapplying it outside its valid conditions is the most frequent error.Applications
De Morgan's theorem states that the complement of an AND is the OR of complements, and vice versa: (A·B)' = A' + B' and (A+B)' = A'·B'. This theorem is widely used to simplify Boolean expressions and to convert between gate types. Engineers use it to reduce the number of gates, to minimise circuit area, and to improve speed. By applying De Morgan's laws, they can transform complex logic into more implementable forms. This is a core tool in digital logic design and is essential for combinational logic optimisation.
- Logic simplification and gate‑level minimisation
- Conversion between NAND/NOR and AND/OR implementations
- Design of efficient digital circuits
- Boolean algebra and Karnaugh maps
- Educational foundation of digital logic design
Related calculators · Digital Electronics
Recently updated formulas
Suggest an improvement
Found a mistake? Have a better example? Let us know.
You may send up to 3 suggestions per 24 hours.