De Morgan’s Law Calculator
Apply De Morgan’s Laws to simplify logical expressions involving conjunctions (AND) and disjunctions (OR) with negations.
De Morgan’s Law Simplifier
Results
Simplified Expression: —
Original Expression Evaluation: —
Simplified Expression Evaluation: —
De Morgan’s Law Applied: —
De Morgan’s Laws provide a way to distribute a negation over a conjunction (AND) or a disjunction (OR).
- Law 1: NOT (A AND B) is equivalent to (NOT A) OR (NOT B)
- Law 2: NOT (A OR B) is equivalent to (NOT A) AND (NOT B)
Our calculator applies these laws to the expressions you provide, showing the resulting simplified form and its logical evaluation based on the truth values you assign.
What is De Morgan’s Law?
De Morgan’s Laws are fundamental rules in Boolean algebra and propositional logic, named after the mathematician Augustus De Morgan. They describe how to correctly negate compound statements involving logical conjunction (AND The logical AND operator, denoted by ∧ or &, is true only if both operands are true.) and disjunction (OR The logical OR operator, denoted by ∨ or |, is true if at least one operand is true.). Essentially, these laws allow us to “push” a negation sign inside a logical expression by changing the logical operator from AND to OR, or from OR to AND.
Understanding De Morgan’s Laws is crucial for anyone working with logic circuits, database queries, programming, or mathematical proofs. They help simplify complex logical statements, making them easier to understand and implement. Programmers frequently use these laws to simplify conditions in `if` statements or `while` loops.
Who should use this calculator?
- Students learning formal logic or Boolean algebra.
- Programmers looking to simplify conditional statements.
- Database administrators writing complex SQL queries.
- Anyone needing to understand or manipulate logical expressions.
Common Misunderstandings: A frequent mistake is applying the negation incorrectly, for example, thinking NOT (A AND B) simplifies to NOT A AND NOT B. This is incorrect; the operator must flip. Another misunderstanding arises when statements are not clearly defined or when the context implies different logical operators. This calculator assumes standard logical AND and OR operations.
De Morgan’s Law Formula and Explanation
De Morgan’s Laws are typically expressed using logical notation. For statements P and Q:
- Law 1 (Negation of Conjunction): ¬(P ∧ Q) ≡ (¬P) ∨ (¬Q)
- Law 2 (Negation of Disjunction): ¬(P ∨ Q) ≡ (¬P) ∧ (¬Q)
In plain English:
- “It is not the case that both P and Q are true” is logically equivalent to “Either P is false, or Q is false (or both are false)”.
- “It is not the case that either P or Q is true” is logically equivalent to “Both P and Q are false”.
Variables Table
| Variable | Meaning | Unit | Typical Range |
|---|---|---|---|
| P, Q | Logical propositions or statements | Boolean (True/False) | True, False |
| ¬ | Logical NOT (negation) | Unitless | Applies to a single proposition |
| ∧ | Logical AND (conjunction) | Unitless | Requires two propositions |
| ∨ | Logical OR (disjunction) | Unitless | Requires two propositions |
This calculator uses descriptive strings for the statements (like ‘raining’) and boolean values (True/False) for evaluation. The core logic remains the same as the formal notation.
Practical Examples
Example 1: NOT (It is raining AND it is cloudy)
Inputs:
- Expression Type: NOT (A AND B)
- Statement A: ‘It is raining’
- Statement B: ‘It is cloudy’
- Value A: True
- Value B: True
Calculation:
Applying Law 1: NOT (A AND B) becomes (NOT A) OR (NOT B).
So, “It is not the case that it is raining and it is cloudy” is equivalent to “It is not raining OR it is not cloudy”.
Original Expression Evaluation: True AND True = True. NOT(True) = False.
Simplified Expression Evaluation: (NOT True) OR (NOT True) = False OR False = False.
Result:
- Simplified Expression: (NOT It is raining) OR (NOT It is cloudy)
- Original Expression Evaluation: False
- Simplified Expression Evaluation: False
- Law Applied: NOT (A AND B) => (NOT A) OR (NOT B)
Example 2: NOT (The traffic light is red OR the speed limit is exceeded)
Inputs:
- Expression Type: NOT (A OR B)
- Statement A: ‘The traffic light is red’
- Statement B: ‘The speed limit is exceeded’
- Value A: False
- Value B: True
Calculation:
Applying Law 2: NOT (A OR B) becomes (NOT A) AND (NOT B).
So, “It is not the case that the traffic light is red OR the speed limit is exceeded” is equivalent to “The traffic light is NOT red AND the speed limit is NOT exceeded”.
Original Expression Evaluation: False OR True = True. NOT(True) = False.
Simplified Expression Evaluation: (NOT False) AND (NOT True) = True AND False = False.
Result:
- Simplified Expression: (NOT The traffic light is red) AND (NOT The speed limit is exceeded)
- Original Expression Evaluation: False
- Simplified Expression Evaluation: False
- Law Applied: NOT (A OR B) => (NOT A) AND (NOT B)
How to Use This De Morgan’s Law Calculator
Using the calculator is straightforward:
- Select Expression Type: Choose whether you want to simplify a
NOT (A AND B)expression or aNOT (A OR B)expression using the dropdown menu. - Enter Statements: In the “Statement A” and “Statement B” fields, type descriptive phrases representing your logical propositions. These don’t need to be complex; simple statements work best for demonstration.
- Assign Logical Values: Use the “A is:” and “B is:” dropdowns to set the truth value (True or False) for each statement. This allows the calculator to evaluate the original and simplified expressions.
- Click Simplify & Evaluate: Press the button to see the results.
- Interpret Results:
- Simplified Expression: This shows the equivalent expression after applying the appropriate De Morgan’s Law.
- Original Expression Evaluation: The truth value (True/False) of the original negated expression based on your input values for A and B.
- Simplified Expression Evaluation: The truth value (True/False) of the resulting expression after applying De Morgan’s Law. These two evaluation values should always match.
- De Morgan’s Law Applied: Indicates which of the two laws was used.
- Copy Results: Use the “Copy Results” button to easily transfer the output to your notes or documents.
- Reset: Click “Reset” to clear all inputs and results and start over.
The core idea is to understand how the negation interacts with AND/OR. The calculator helps visualize this by transforming the statement and showing that both forms yield the same logical outcome for given truth values.
Key Factors That Affect De Morgan’s Law Application
While De Morgan’s Laws themselves are fixed logical equivalences, their practical application and understanding are influenced by several factors:
- Clarity of Propositions: The statements (A and B) must be well-defined and unambiguous. If “raining” is unclear (e.g., drizzle vs. downpour), the logical evaluation becomes fuzzy.
- Correct Operator Choice: Ensuring the initial expression is truly an AND or an OR is critical. Misidentifying the operator means applying the wrong De Morgan’s Law.
- Negation Scope: De Morgan’s Laws apply when the negation applies to the *entire* compound statement (e.g., NOT (A AND B)). If the negation applies only to one part (e.g., (NOT A) AND B), these specific laws don’t directly simplify it in the same way.
- Truth Value Assignment: The evaluation of the expressions depends entirely on the truth values assigned to the individual propositions. Correctly assigning True or False is essential for verifying the equivalence.
- Context of Use: In programming, the implementation of logical operators (`&&`, `||`, `!`) must be precise. In formal logic, the symbols (`∧`, `∨`, `¬`) must be used consistently.
- Domain Specific Interpretations: While the logic is universal, how terms are interpreted in different fields (like law, computer science, or philosophy) can affect how propositions are formed and evaluated, though the laws themselves remain constant.
FAQ
What are the two De Morgan’s Laws?
- NOT (A AND B) is equivalent to (NOT A) OR (NOT B)
- NOT (A OR B) is equivalent to (NOT A) AND (NOT B)
Can De Morgan’s Laws be used for more than two statements?
- NOT (A AND B AND C) ≡ (NOT A) OR (NOT B) OR (NOT C)
- NOT (A OR B OR C) ≡ (NOT A) AND (NOT B) AND (NOT C)
The principle remains the same: distributing the negation flips the operator.
Are De Morgan’s Laws applicable in programming languages?
What does it mean for expressions to be “equivalent”?
Why does the calculator ask for specific statements like ‘raining’?
Can I input complex statements for A and B?
What if the statements A or B are themselves negations?
How do I copy the results?
Related Tools and Internal Resources
- Understanding Boolean Algebra
- Truth Table Generator
- Logic Gates Explained
- Logical Equivalence Checker
- Set Theory Fundamentals
- Conditional Statement Simplifier
Explore these resources to deepen your understanding of logic, Boolean algebra, and related mathematical concepts.