De Morgan's Law Calculator - Negate Boolean Expressions

Accepted: variables A–Z · NOT as ! ~ ¬ or postfix ′ · AND as & · ∧ ∩ · OR as | + ∨ ∪ · parentheses · 0 and 1

Negation pushed to the variables

¬A ∨ ¬B ∧ C

Engineering notation

A′ + B′ · C

Set notation

Aᶜ ∪ Bᶜ ∩ C

Applied De Morgan’s law 2 times and removed 1 double negation.

Step-by-step transformation

  1. ¬(A ∧ (B ∨ ¬C))(original)
  2. 1. ¬A ∨ ¬(B ∨ ¬C)De Morgan's law: ¬(P ∧ Q) = ¬P ∨ ¬Q
  3. 2. ¬A ∨ ¬B ∧ ¬¬CDe Morgan's law: ¬(P ∨ Q) = ¬P ∧ ¬Q
  4. 3. ¬A ∨ ¬B ∧ CDouble negation: ¬¬P = P

Truth table verification

✓ Equivalent on all 8 rows
ABCOriginalResult
00011
00111
01011
01111
10000
10111
11000
11100

How to Use This Calculator

  1. Type a Boolean expression in the “Boolean expression” field — for example !(A & B) or engineering style (A + B)′.
  2. Or tap one of the example chips below the field to load a ready-made expression.
  3. Read the green panel: it shows your expression with every NOT pushed down onto individual variables, in logic, engineering, and set notation.
  4. Follow the numbered steps to see exactly where De Morgan’s law flipped an AND into an OR (or back) and where double negations cancelled.
  5. Check the truth table at the bottom — the Original and Result columns match on every row, which proves the two forms are equivalent.

Share this calculator

Help others solve their calculations

Found this calculator helpful? Share it with your friends, students, or colleagues who might need it!

De Morgan’s Law Calculator: Pushing a NOT Through AND and OR

About the Author

Marko Šinko - Co-Founder & Lead Developer

Marko Šinko

Co-Founder & Lead Developer, AI Math Calculator

Lepoglava, Croatia
Advanced Algorithm Expert

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Co-founder of award-winning projects, ensuring precise mathematical computations and reliable calculator tools.

📅 Published:
De Morgan's Law Calculator negating a Boolean expression step by step and verifying the equivalent form against a truth table

A De Morgan’s law calculator guards against the single most tempting wrong move in Boolean algebra: writing ¬(A ∧ B) = ¬A ∧ ¬B. It looks right. It’s wrong on exactly one truth-table row, which is the worst kind of wrong — the bug hides until that one input combination shows up. The correct rule flips the operator as the negation distributes: ¬(A ∧ B) = ¬A ∨ ¬B, and ¬(A ∨ B) = ¬A ∧ ¬B. The calculator above applies that rule mechanically, shows every intermediate step, and then proves the answer by checking all 2ⁿ truth-table rows. This article covers why the operator has to flip, how the same law works for sets, and where it quietly runs half the code and hardware you use every day.

Two Laws, One Move: Break the Bar, Flip the Sign

Both of Augustus De Morgan’s laws describe the same maneuver from opposite directions. In logic notation:

¬(A ∧ B) = ¬A ∨ ¬B

¬(A ∨ B) = ¬A ∧ ¬B

Digital logic courses teach the same pair with overbars and read it as a slogan: break the bar, change the sign. A long negation bar over A·B breaks into two short bars, and the · underneath it becomes a +. Set theory writes it with complements: (A ∩ B)ᶜ = Aᶜ ∪ Bᶜ and (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ. Three notations, one identity. That’s also why this page’s calculator prints its result three ways — once you see ¬A ∨ ¬B, A′ + B′, and Aᶜ ∪ Bᶜ side by side, they stop looking like three separate facts to memorize.

The Four-Row Proof

With two variables there are only four possible input combinations, so the entire proof of the first law fits in one small table. Column by column:

ABA ∧ B¬(A ∧ B)¬A¬B¬A ∨ ¬B
0001111
0101101
1001011
1110000

The two bold columns agree on every row, so the expressions are equivalent — that’s the whole proof. Now compare the wrong version: ¬A ∧ ¬B produces 1, 0, 0, 0 down its column. It matches ¬(A ∧ B) on three rows out of four and disagrees only where exactly one input is true. A condition tested casually will pass those three rows and ship the fourth. If you want to build tables like this for your own expressions with more variables, the truth table calculator generates all 2ⁿ rows for anything you type.

“Not Both” Is a Weaker Claim Than “Neither”

The flip stops feeling arbitrary once you say the two sides out loud. ¬(A ∧ B) means “not both” — at least one of the two fails. ¬A ∧ ¬B means “neither” — both fail. Someone who isn’t having coffee and cake might still be having one of them; someone having neither has ruled out both. “Not both” is satisfied in three of the four scenarios, “neither” in just one. Since negating an AND gives you the weaker “at least one fails” statement, the connective on the other side has to be the weaker one too — OR. The same argument in mirror image explains the second law: denying “at least one” leaves you with “none,” which is an AND of two negations.

Negating an if-Condition Without Breaking It

This is where the law earns its keep in practice. Say a discount applies to customers who are members with a cart over $50, and you need the branch for everyone else:

// eligible: isMember && cartTotal > 50

if (!(isMember && cartTotal > 50)) { ... }

// De Morgan — same behavior, one less nesting level:

if (!isMember || cartTotal <= 50) { ... }

Two details matter. First, the && became || — that’s the law doing its job. Second, the comparison > 50 negated into ≤ 50, not < 50; negating a strict inequality always picks up the boundary value. A cart at exactly $50.00 is the row where the sloppy version misfires. Linters push this rewrite for readability, and compilers apply it silently for short-circuit evaluation — with !isMember || cartTotal <= 50, a non-member skips the cart check entirely. Paste any condition’s shape into the calculator above (as, say, !(M & C)) and the truth table confirms the rewrite before you commit it.

The Set Version: Complement of a Union, Complement of an Intersection

Swap propositions for sets and the identical structure appears. Let the universe be the ten digits U = {0, 1, …, 9}, with A = {1, 2, 3, 4} and B = {3, 4, 5, 6}. Then A ∪ B = {1, 2, 3, 4, 5, 6}, so the complement of the union is (A ∪ B)ᶜ = {0, 7, 8, 9} — four elements. Now build the right-hand side separately: Aᶜ = {0, 5, 6, 7, 8, 9} and Bᶜ = {0, 1, 2, 7, 8, 9}, and their intersection is{0, 7, 8, 9}. Same four elements, confirming (A ∪ B)ᶜ = Aᶜ ∩ Bᶜ. The second law checks out the same way: A ∩ B = {3, 4} has an 8-element complement, exactly matching Aᶜ ∪ Bᶜ. For membership, union, and intersection operations on your own sets, the set calculator handles the element-by-element work; this page’s tool handles the symbolic side, printing results in ∩/∪/ᶜ notation directly.

Nested NOTs: What a De Morgan’s Law Calculator Does Layer by Layer

Real expressions rarely stop at two variables, and De Morgan’s law generalizes cleanly: ¬(A ∧ B ∧ C) = ¬A ∨ ¬B ∨ ¬C for any number of terms. The interesting cases are nested. Take the calculator’s default, ¬(A ∧ (B ∨ ¬C)), and push the negation inward one layer at a time:

  1. ¬A ∨ ¬(B ∨ ¬C)  — De Morgan on the outer AND
  2. ¬A ∨ (¬B ∧ ¬¬C)  — De Morgan on the inner OR
  3. ¬A ∨ (¬B ∧ C)  — double negation cancels

The finished form — every negation resting on a single variable — is called negation normal form, and it’s the standard first step in logic simplification pipelines, SAT solvers, and query optimizers. Note what the law does not do: it never removes a NOT that already sits on a lone variable, and it never simplifies A ∨ ¬A to 1. Those jobs belong to other identities — complement, absorption, distribution — which the boolean algebra calculator applies when you want a fully reduced expression rather than a correctly negated one.

Why Chip Designers Lean on De Morgan Every Day

In CMOS silicon, the cheap gates are the inverting ones: a NAND takes 4 transistors while a plain AND takes 6, because AND is literally built as NAND followed by an inverter. De Morgan’s law is the bridge that lets designers use the cheap parts everywhere. Reading A′ + B′ = (A·B)′ from right to left says a NAND behaves exactly like an OR fed with inverted inputs — so any AND/OR network can be redrawn as NAND-only or NOR-only, which is why both are called universal gates. A two-level AND-OR circuit converts to all-NANDs with zero added hardware; the bubbles (inversions) introduced on one gate’s output cancel against the next gate’s inputs. If you’re minimizing a circuit before converting it, run it through the logic gate simplifier first, then apply the De Morgan rewrite here to pick your target gate family. The same trick, a century and a half old, sits between Augustus De Morgan’s 1847 formalization and every processor shipping today.

Frequently Asked Questions

Still Have Questions?

The detailed content on this page provides comprehensive explanations and examples to help you understand better.