De Morgan’s Law Calculator – Verify Boolean Logic Equivalences


De Morgan’s Law Calculator

Utilize our interactive De Morgan’s Law Calculator to effortlessly verify boolean logic equivalences. This tool helps you understand and apply De Morgan’s theorems, crucial for digital logic design, computer science, and propositional logic. Simply input your boolean variables A and B, and see the results instantly.

De Morgan’s Law Verification Tool



Check for TRUE, uncheck for FALSE.


Check for TRUE, uncheck for FALSE.

Calculation Results

Select inputs to see De Morgan’s Law equivalences.

NOT A: N/A

NOT B: N/A

A AND B: N/A

A OR B: N/A

NOT (A AND B): N/A

(NOT A) OR (NOT B): N/A

NOT (A OR B): N/A

(NOT A) AND (NOT B): N/A

De Morgan’s Laws state:

1. NOT (A AND B) is equivalent to (NOT A) OR (NOT B)

2. NOT (A OR B) is equivalent to (NOT A) AND (NOT B)

De Morgan’s Law Visualizer

This chart visually represents the truth values (1 for TRUE, 0 for FALSE) for each side of De Morgan’s Laws, demonstrating their equivalence.

De Morgan’s Law Truth Table


Comprehensive Truth Table for De Morgan’s Laws
A B NOT A NOT B A AND B A OR B NOT (A AND B) (NOT A) OR (NOT B) NOT (A OR B) (NOT A) AND (NOT B)

What is De Morgan’s Law?

De Morgan’s Law consists of two fundamental rules in boolean algebra that relate the conjunction (AND), disjunction (OR), and negation (NOT) operators. These laws are named after Augustus De Morgan, a British mathematician. They are crucial for simplifying complex logical expressions, designing digital circuits, and understanding set theory. Essentially, De Morgan’s Laws provide a way to express the negation of a conjunction or disjunction in terms of the negations of the individual components.

Definition of De Morgan’s Law

The two laws are:

  1. The negation of a conjunction is the disjunction of the negations. In simpler terms, “NOT (A AND B)” is logically equivalent to “(NOT A) OR (NOT B)”. This means if it’s not true that both A and B are true, then either A is false, or B is false (or both).
  2. The negation of a disjunction is the conjunction of the negations. This translates to “NOT (A OR B)” being logically equivalent to “(NOT A) AND (NOT B)”. If it’s not true that A or B (or both) are true, then both A must be false AND B must be false.

These laws are foundational in propositional logic and are widely applied in various fields, including computer science, electrical engineering, and mathematics. Our De Morgan’s Law Calculator helps you visualize and verify these equivalences.

Who Should Use the De Morgan’s Law Calculator?

This De Morgan’s Law Calculator is an invaluable tool for:

  • Computer Science Students: For understanding boolean logic, simplifying code conditions, and designing algorithms.
  • Electrical Engineering Students/Professionals: Essential for digital logic design, simplifying circuit diagrams, and optimizing gate usage.
  • Mathematics Students: Particularly those studying discrete mathematics, set theory, and mathematical logic.
  • Software Developers: To write more efficient and readable conditional statements in programming languages.
  • Anyone Learning Logic: A practical way to grasp abstract logical concepts through interactive examples.

Common Misconceptions about De Morgan’s Law

Despite their simplicity, some common misunderstandings exist:

  • Confusing AND/OR with their negations: A common mistake is to think NOT (A AND B) is NOT A AND NOT B. De Morgan’s Law explicitly shows the operator flips (AND becomes OR, OR becomes AND) when negation is distributed.
  • Applying to non-boolean contexts: While the principles can be extended to set theory (union/intersection), directly applying them to arithmetic operations without proper context is incorrect.
  • Ignoring the scope of negation: The “NOT” applies to the entire expression within the parentheses, not just the first variable. This is why the operator inside also changes.

De Morgan’s Law Formula and Mathematical Explanation

De Morgan’s Laws are expressed using standard logical operators. Let’s denote:

  • ¬ or NOT for negation
  • or AND for conjunction
  • or OR for disjunction

Step-by-Step Derivation

Consider the first law: ¬(A ∧ B) ≡ (¬A ∨ ¬B)

  1. Start with the left side: ¬(A ∧ B). This means “it is not the case that both A and B are true.”
  2. Consider when A ∧ B is true: Only when A is true AND B is true.
  3. Consider when ¬(A ∧ B) is true: This happens when A ∧ B is false.
  4. When is A ∧ B false? When A is false, OR B is false, OR both are false.
  5. Expressing “A is false” or “B is false”: This is exactly ¬A ∨ ¬B.
  6. Conclusion: Therefore, ¬(A ∧ B) is equivalent to ¬A ∨ ¬B.

Now, the second law: ¬(A ∨ B) ≡ (¬A ∧ ¬B)

  1. Start with the left side: ¬(A ∨ B). This means “it is not the case that A is true or B is true.”
  2. Consider when A ∨ B is true: When A is true, OR B is true, OR both are true.
  3. Consider when ¬(A ∨ B) is true: This happens when A ∨ B is false.
  4. When is A ∨ B false? Only when A is false AND B is false.
  5. Expressing “A is false” and “B is false”: This is exactly ¬A ∧ ¬B.
  6. Conclusion: Therefore, ¬(A ∨ B) is equivalent to ¬A ∧ ¬B.

Variable Explanations

In the context of De Morgan’s Law, the variables A and B represent propositional statements or boolean values.

Variables Used in De Morgan’s Law
Variable Meaning Unit/Type Typical Range
A A boolean proposition or statement Boolean (True/False) True (1) or False (0)
B Another boolean proposition or statement Boolean (True/False) True (1) or False (0)
NOT (¬) Logical negation (inverts truth value) Operator N/A
AND (∧) Logical conjunction (true if both are true) Operator N/A
OR (∨) Logical disjunction (true if at least one is true) Operator N/A

Practical Examples (Real-World Use Cases)

De Morgan’s Law is not just theoretical; it has significant practical applications.

Example 1: Simplifying a Conditional Statement in Programming

Imagine you have a condition in a program that grants access if a user is NOT both an administrator AND active.

Original condition: if (!(isAdmin && isActive)) { grantAccess(); }

Using De Morgan’s First Law, NOT (A AND B) = (NOT A) OR (NOT B), we can rewrite this:

  • Let A = isAdmin
  • Let B = isActive
  • Then !(isAdmin && isActive) becomes (!isAdmin || !isActive)

Simplified condition: if (!isAdmin || !isActive) { grantAccess(); }

Interpretation: The program grants access if the user is either NOT an administrator OR NOT active. This is often easier to read and understand, and in some cases, can lead to more optimized code or circuit designs. Our De Morgan’s Law Calculator can verify this equivalence.

Example 2: Digital Logic Design

Consider a security system that triggers an alarm if the main door is NOT closed OR the window is NOT locked.

Original condition: Alarm = !(DoorClosed || WindowLocked)

Using De Morgan’s Second Law, NOT (A OR B) = (NOT A) AND (NOT B), we can rewrite this:

  • Let A = DoorClosed
  • Let B = WindowLocked
  • Then !(DoorClosed || WindowLocked) becomes (!DoorClosed && !WindowLocked)

Simplified condition: Alarm = (!DoorClosed && !WindowLocked)

Interpretation: The alarm will trigger if the door is NOT closed AND the window is NOT locked. This transformation can be crucial for designing circuits with different types of logic gates (e.g., converting an OR gate followed by a NOT gate into an AND gate with inverted inputs). This demonstrates the power of De Morgan’s Law in practical engineering.

How to Use This De Morgan’s Law Calculator

Our De Morgan’s Law Calculator is designed for ease of use, providing instant verification of boolean equivalences.

Step-by-Step Instructions

  1. Locate the Input Fields: At the top of the calculator, you will find two input checkboxes labeled “Boolean Variable A” and “Boolean Variable B”.
  2. Set Variable A: To set Variable A to TRUE, check the box next to “Boolean Variable A”. To set it to FALSE, leave the box unchecked.
  3. Set Variable B: Similarly, check the box for “Boolean Variable B” to set it to TRUE, or uncheck it for FALSE.
  4. View Results: As you change the state of the checkboxes, the calculator will automatically update the “Calculation Results” section in real-time.
  5. Interpret the Primary Result: The large, highlighted box will display the core equivalences of De Morgan’s Law based on your inputs.
  6. Examine Intermediate Values: Below the primary result, you’ll see the truth values for intermediate expressions like “NOT A”, “A AND B”, “NOT (A AND B)”, and their De Morgan’s equivalents.
  7. Consult the Chart: The “De Morgan’s Law Visualizer” chart will dynamically update to show a graphical representation of the truth values, confirming the equivalences.
  8. Review the Truth Table: The comprehensive truth table below the chart provides all possible combinations of A and B and their resulting truth values for each expression, offering a complete overview of De Morgan’s Law.

How to Read Results

  • TRUE (1): Indicates that the logical expression evaluates to true.
  • FALSE (0): Indicates that the logical expression evaluates to false.
  • Equivalence Confirmation: For each of De Morgan’s Laws, the calculator will show that the left side of the equation (e.g., NOT (A AND B)) yields the same truth value as the right side (e.g., (NOT A) OR (NOT B)).

Decision-Making Guidance

Using this De Morgan’s Law Calculator can help you:

  • Verify your manual calculations: Double-check your understanding of boolean logic.
  • Simplify complex expressions: Identify opportunities to rewrite logical conditions in a more concise or efficient manner.
  • Design more effective systems: Apply the laws to optimize digital circuits or improve software logic.
  • Learn by doing: Experiment with different inputs to build intuition about how logical operators interact.

Key Factors That Affect De Morgan’s Law Results

While De Morgan’s Law itself is a fixed mathematical principle, understanding the factors that influence its application and interpretation is crucial.

  • Truth Values of Inputs (A and B): The most direct factor. The specific TRUE/FALSE assignment to A and B determines the outcome of all expressions. Our De Morgan’s Law Calculator allows you to manipulate these directly.
  • Correct Application of Operators: Misunderstanding the behavior of AND, OR, and NOT operators will lead to incorrect results, even if De Morgan’s Law is applied. For instance, confusing an inclusive OR with an exclusive OR.
  • Scope of Negation: The “NOT” operator must be applied to the entire expression it precedes. Forgetting to distribute the negation correctly (e.g., changing AND to OR) is a common error.
  • Order of Operations: In complex boolean expressions, the order of operations (parentheses first, then NOT, then AND, then OR) is critical. De Morgan’s Law helps simplify expressions by changing this order.
  • Context of Application (e.g., Programming vs. Circuitry): While the logical principles are universal, their representation might differ. In programming, `&&` for AND, `||` for OR, `!` for NOT. In digital logic, specific gate symbols are used.
  • Understanding of Logical Equivalence: The core concept is that two different logical expressions can always yield the same truth value for all possible inputs. This is what De Morgan’s Law proves.

Frequently Asked Questions (FAQ)

Q: What is the primary purpose of De Morgan’s Law?

A: The primary purpose of De Morgan’s Law is to provide rules for negating conjunctions (AND statements) and disjunctions (OR statements). It allows for the transformation of logical expressions, which is vital for simplification in boolean algebra, digital circuit design, and programming.

Q: Can De Morgan’s Law be applied to more than two variables?

A: Yes, De Morgan’s Law can be extended to any number of variables. For example, ¬(A ∧ B ∧ C) ≡ (¬A ∨ ¬B ∨ ¬C) and ¬(A ∨ B ∨ C) ≡ (¬A ∧ ¬B ∧ ¬C). The principle remains the same: negate each variable and flip the operator.

Q: How does De Morgan’s Law relate to set theory?

A: De Morgan’s Law has direct analogues in set theory. If A and B are sets, then the complement of their intersection is the union of their complements: (A ∩ B)' = A' ∪ B'. Similarly, the complement of their union is the intersection of their complements: (A ∪ B)' = A' ∩ B'. This shows the deep connection between logic and set theory.

Q: Why is De Morgan’s Law important in computer science?

A: In computer science, De Morgan’s Law is crucial for simplifying complex conditional statements in code, optimizing boolean expressions, and understanding how logic gates work in digital circuits. It helps developers write more efficient and readable code and engineers design more compact and faster hardware.

Q: What are the two main De Morgan’s Laws?

A: The two main De Morgan’s Laws are:

1. NOT (A AND B) is equivalent to (NOT A) OR (NOT B)

2. NOT (A OR B) is equivalent to (NOT A) AND (NOT B)

Q: Does De Morgan’s Law apply to all logical systems?

A: De Morgan’s Laws are fundamental to classical boolean logic and propositional logic. While many logical systems share similar principles, their direct applicability might vary in non-classical logics (e.g., intuitionistic logic) where the law of excluded middle or double negation elimination might not hold.

Q: Can I use this De Morgan’s Law Calculator for educational purposes?

A: Absolutely! This De Morgan’s Law Calculator is an excellent educational tool for students and educators alike. It provides an interactive way to explore and verify the laws, making abstract concepts more concrete and understandable.

Q: What is the difference between De Morgan’s Law and distributive law?

A: De Morgan’s Law deals with the negation of conjunctions and disjunctions, showing how negation distributes over AND/OR while flipping the operator. Distributive law, on the other hand, describes how AND distributes over OR (A AND (B OR C) = (A AND B) OR (A AND C)) and vice-versa, without involving negation in the same way.

Related Tools and Internal Resources

Explore more of our logic and mathematics tools to deepen your understanding:

© 2023 De Morgan’s Law Calculator. All rights reserved.



Leave a Reply

Your email address will not be published. Required fields are marked *