Discrete MathLogic

Quantifiers

"For all" (∀) and "there exists" (∃) make claims about every element of a domain, or about at least one.

Not started Jump to practice

A sentence like "$x^{2} > 4$" is not a statement until we know what $x$ is. Quantifiers turn such sentences into statements by saying how many values of $x$ we mean. They are the language of every theorem you will prove, and they connect to the equivalences you just learned.

Key idea

A predicate $P(x)$ is a sentence about $x$ that becomes true or false once $x$ is chosen from a domain. The universal statement $\forall x\, P(x)$ ("for all $x$") is true when $P(x)$ holds for every $x$ in the domain. The existential statement $\exists x\, P(x)$ ("there exists $x$") is true when $P(x)$ holds for at least one $x$.

Why it works

On a finite domain, the quantifiers are just long "and"s and "or"s. If the domain is $\{1, 2, 3\}$, then $\forall x\, P(x)$ means $P(1) \wedge P(2) \wedge P(3)$, and $\exists x\, P(x)$ means $P(1) \vee P(2) \vee P(3)$. That explains how to check them: one failure sinks a "for all," and one success is enough for a "there exists." It also explains why the domain matters: change the list of things being joined, and the truth can change.
The same formula over different domains.
Statementpositive integersintegersrational numbersreal numbers
$\exists x\, (x^{2} = 2)$FFFT
$\exists x\, (2x = 1)$FFTT
$\forall x\, (x^{2} \ge x)$TTFF
$\exists x\, (x + 5 = 2)$FTTT

Worked examples

Worked example: Checking quantified statements on a finite domain

Let the domain be $D = \{1, 2, 3, 4\}$. Decide $\forall x\, (x^{2} > x)$ and $\exists x\, (x^{2} = 2x)$.
  1. For $\forall x\, (x^{2} > x)$, look for a failure. At $x = 1$: $1^{2} = 1$, which is not greater than $1$. One failure is enough: false.
  2. For $\exists x\, (x^{2} = 2x)$, look for a success. At $x = 2$: $4 = 4$. True.
  3. Notice the asymmetry: the first needed one counterexample, the second one example.

Answer: false, true

Worked example: Writing English with quantifiers

The domain is the students in a class, and $S(x)$ means "$x$ passed the test." Write "Every student passed," "Some student passed" and "No student passed."
  1. "Every" is $\forall$: $\forall x\, S(x)$.
  2. "Some" means at least one: $\exists x\, S(x)$.
  3. "No student passed" means every student did not pass: $\forall x\, \neg S(x)$. (It is also $\neg \exists x\, S(x)$, as the next lesson shows.)

Answer: $\forall x\, S(x)$, $\exists x\, S(x)$, $\forall x\, \neg S(x)$

Common mistake

Ignoring the domain. "$\exists x\, (x^{2} = 2)$" is true over the real numbers ($x = \sqrt{2}$) but false over the rational numbers, because $\sqrt{2}$ is irrational. Check: before deciding, ask which numbers $x$ may be, and whether your example or counterexample belongs to that domain.
In mathematical writing the quantifier is often hidden. "If $n$ is even, then $n^{2}$ is even" really means "for every integer $n$, if $n$ is even, then $n^{2}$ is even."

Practice

Pass with 3 right answers, the last 2 in a row. Each right answer earns 2 XP.

Loading practice…

Builds on

Leads to

Sources and further reading

  • Oscar Levin, Discrete Mathematics: An Open Introduction (3rd ed.), section "Mathematical Statements" (predicates and quantifiers)
  • MIT OpenCourseWare 6.042J Mathematics for Computer Science (Lehman, Leighton and Meyer), chapter "Logical Formulas" (predicate formulas)
@teddyrookbook GitHub