Unit 2 Cycle 1 Day 9: De Morgan's Laws
Share
De Morgan's Laws
Section 2.6 — Equivalent Boolean
Key Concept
De Morgan's Laws describe how to negate compound boolean expressions: !(a && b) is equivalent to !a || !b, and !(a || b) is equivalent to !a && !b. The key is that negation flips both the operator (AND becomes OR, OR becomes AND) and each operand. For relational operators, negation also flips them: !(x < 5) becomes x >= 5, not x > 5. De Morgan's Laws are among the most frequently tested topics on the AP CSA exam.
Consider the following boolean expression where a and b are boolean variables.
Which of the following is equivalent to the expression above?
Answer: (B) !a || !b
De Morgan's Law: !(a && b) is equivalent to !a || !b. Negate both operands AND flip the operator (AND becomes OR).
Why Not the Others?
(A) This applies NOT to both operands but keeps AND. De Morgan's requires flipping AND to OR.
(C) This removes the negations entirely, which is not equivalent.
(D) This negates an OR expression, which equals !a && !b by the other De Morgan's Law.
Common Mistake
De Morgan's Laws: !(a && b) = !a || !b and !(a || b) = !a && !b. The key is to negate each operand AND flip the operator. Forgetting to flip the operator is the most common error.
AP Exam Tip
De Morgan's Laws appear on nearly every AP exam. Memorize both forms. When you see a NOT in front of a compound expression, distribute the NOT and flip the operator.