Skip to content
  • Open the math solver
  • Ask the AI tutor
  • Find an AP course
  • Create a quiz
  • Open the calculator
  • Graphing Calculator
  • Browse all calculators
  • Read math guides
↑ ↓Enter to open · Esc to close
Solve a problem
Discrete MathDiscrete MathematicsCollege

Logic and Sets

Truth tables, quantifiers, set operations and De Morgan's laws.

Logic studies statements that are either true or false and how connectives combine them: and (∧\land), or (∨\lor), not (¬\neg) and if-then (→\to). Truth tables list every case. An implication p→qp \to q is false only when pp is true and qq is false, and it is logically equivalent to its contrapositive ¬q→¬p\neg q \to \neg p, but not to its converse q→pq \to p.

Set theory is the parallel language for collections. Union, intersection and complement correspond to or, and and not, and De Morgan's laws hold in both worlds: ¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q and (A∩B)c=Ac∪Bc(A \cap B)^c = A^c \cup B^c.

Key terms

De Morgan's law
The negation of a conjunction is the disjunction of the negations.
¬(p∧q)≡¬p∨¬q\neg(p \land q) \equiv \neg p \lor \neg q

Key ideas

  • Contrapositive is equivalent; converse and inverse are not.
  • De Morgan: negating flips and/or (or ∩\cap/∪\cup) and negates each part.
  • Inclusion-exclusion: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|.
  • A set with nn elements has 2n2^n subsets.

Worked example

In a class of 30, 18 take French, 12 take Spanish and 5 take both. How many take neither?

  1. ∣F∪S∣=18+12−5=25|F \cup S| = 18 + 12 - 5 = 25.
  2. Neither: 30−25=530 - 25 = 5.
  3. A Venn diagram shows 13 French only, 7 Spanish only, 5 both, 5 neither.

Answer: 55

Common mistakes

  • Treating the converse as equivalent to the original statement.
  • Negating 'and' as 'and'.
  • Adding set sizes without subtracting the overlap.

Practice questions

Try each one, then open the answer. Numerical answers on this page are verified by an automated calculation check.

  1. 1.How many subsets does a 5-element set have?

    Show answer

    3232

  2. 2.∣A∣=10|A| = 10, ∣B∣=7|B| = 7, ∣A∩B∣=3|A \cap B| = 3. Find ∣A∪B∣|A \cup B|.

    Show answer

    1414

  3. 3.How many rows does a truth table for 3 variables have?

    Show answer

    88

More in Discrete Mathematics