← Logic for the TMUA

Negation and Quantifiers

What you will get from this section. You'll learn how to write the opposite of a statement correctly: simple statements, statements joined by "and" or "or", and statements involving quantifiers "for all" and "there exists" (including a couple of those stacked together).

What negation is

The negation of a statement PP is the statement "not PP", written ¬P\neg P. It is true exactly when PP is false, and false exactly when PP is true. Another definition is: ¬P\neg P is a statement such that in any given situation, precisely one of PP or ¬P\neg P is true.

Negating basic statements

Negating everyday mathematical statements is just based on the idea of: ¬P\neg P is true exactly when PP is false, and false exactly when PP is true.

  • "x=5x = 5" negates to "x5x \neq 5".
  • "Jane is in London" negates to "Jane is not in London".
  • "nn is even" negates to "nn is odd" (for an integer nn).
  • "x>3x > 3" negates to "x3x \leq 3" — not "x<3x < 3".

Negating a negation!

This may or may not be obvious, but ¬(¬P)\neg(\neg P) is simply PP. Here are some examples:

  • The negation of "x5x \neq 5" is "x=5x = 5".
  • The negation of "Jane is not in London" is "Jane is in London".
  • The negation of "nn is odd" is "nn is even". Notice how naturally this flows!

Negating "and"

A statement of the form "PP and QQ" is true when both PP and QQ are true. Therefore, its negation is: PP and QQ are not both true. In other words, at least one of them must be false: either PP is false, or QQ is false.

Formally, we write

¬(P and Q)becomes(¬P) or (¬Q).(1)\neg(P \text{ and } Q) \quad\text{becomes}\quad (\neg P) \text{ or } (\neg Q).\qquad\qquad(1)

Here are some examples:

  • The negation of "x>3x>3 and x<10x<10" is "x3x\leq 3 or x10x\geq 10".
  • The negation of "James is naughty and clever" is "James is not naughty or James is not clever".
  • The negation of "nn is even and n>5n>5" is "nn is odd or n5n\leq 5", assuming nn is an integer.

The same idea holds for more than two statements:

  • The negation of "James likes football, swimming and tennis" is "James does not like football, or James does not like swimming, or James does not like tennis".
  • Notice that a more succinct way of saying the same thing is: "There is one sport, or at least one sport, among football, swimming and tennis that James does not like". This is a precursor to how we negate quantified statements involving and, which we will discuss shortly!

Negating "or"

A statement of the form "PP or QQ" is true when at least one of PP and QQ is true. Therefore, its negation is that PP and QQ are both not true.

Formally, we write

¬(P or Q)becomes(¬P) and (¬Q).(2)\neg(P \text{ or } Q) \quad\text{becomes}\quad (\neg P) \text{ and } (\neg Q).\qquad\qquad(2)

The very keen-eyed among you may notice that we can obtain (2)(2) from (1)(1) by reading (1)(1) in reverse and replacing ¬P\neg P with PP and ¬Q\neg Q with QQ.

Here are some examples:

  • The negation of "x>3x>3 or x<0x<0" is "x3x\leq 3 and x0x\geq 0".
  • The negation of "James is naughty or clever" is "James is not naughty and James is not clever".
  • The negation of "nn is even or n>5n>5" is "nn is odd and n5n\leq 5", assuming nn is an integer.

The same idea holds for more than two statements:

  • The negation of "James likes football, swimming or tennis" is "James does not like football, and James does not like swimming, and James does not like tennis".
  • Notice that a more succinct way of saying the same thing is: "James likes none of football, swimming and tennis". This is a precursor to how we negate quantified statements involving or, which we will discuss shortly!

Quantifiers

Interesting mathematical claims are often about whole collections of objects, and these two phrases are often used:

  • "for all", written .\forall. \quad For example: "x, P\forall x,\ P" means "every xx has the property PP".
  • "there exists", written .\exists. \quad For example: "x, P\exists x,\ P" means "at least one xx has the property PP".

So "xR, x20\forall x \in \mathbb{R},\ x^2 \geq 0" reads "for every real number xx, x2x^2 is non-negative", and "nZ, n2=9\exists n \in \mathbb{Z},\ n^2 = 9" reads "There exists an integer nn for which nn squared is 99".

Negating "for all" quantifiers

The quantifier for all is a general version of and, since for all requires all the involved statements to be true. Therefore, its negation is that at least one of the involved statements is false, or equivalently, that there exists one case for which the statement is false.

Here are some examples:

  • The negation of "For all primes pp, pp is odd" is "There exists a prime pp that is not odd".
  • The negation of "Every multiple of 2 is a multiple of 4" is "There exists a multiple of 2 that is not a multiple of 4".
  • The negation of "For every positive integer nn, r=1nr=n(n+1)/2\sum_{r=1}^n r = n(n+1)/2" is "There exists a positive integer mm for which r=1mrm(m+1)/2\sum_{r=1}^m r \neq m(m+1)/2".

Negating "there exists" quantifiers

The quantifier there exists is a general version of or, since there exists only requires at least one of the involved statements to be true. Therefore, its negation is that none of the involved statements is true, or equivalently, that for all of the statements involved, each statement is false.

Here are some examples:

  • The negation of "There exists a prime pp that is even" is "For all primes pp, pp is not even".
  • The negation of "There exists a multiple of 2 that is not a multiple of 4" is "Every multiple of 2 is a multiple of 4".
  • The negation of "There exists a positive integer mm for which r=1mrm(m+1)/2\sum_{r=1}^m r \neq m(m+1)/2" is "For every positive integer nn, r=1nr=n(n+1)/2\sum_{r=1}^n r = n(n+1)/2".

Negating "for all" and "there exists" quantifiers: algebraic rules

We can summarise these negation rules with one short, memorable phrase:

Swap the quantifier and negate the inside. That is,

¬(x, P(x))becomesx, ¬P(x),\neg\big(\forall x,\ P(x)\big) \quad\text{becomes}\quad \exists x,\ \neg P(x),

and

¬(x, P(x))becomesx, ¬P(x).\neg\big(\exists x,\ P(x)\big) \quad\text{becomes}\quad \forall x,\ \neg P(x).

Here are some examples.

  • The negation of "For all primes pp, pp is odd" is "There exists a prime pp such that pp is not odd".
  • The negation of "nZ+, n2n\forall n\in\mathbb{Z}^+,\ n^2\geq n" is "nZ+\exists n\in\mathbb{Z}^+ such that n2<nn^2<n".
  • ¬(xR, x2=2)xR, x22.\neg\left(\exists x\in\mathbb{R},\ x^2=2\right) \equiv \forall x\in\mathbb{R},\ x^2\neq 2.
  • ¬(nZ, n is odd and n is even )nZ,n is even or n is odd. \neg\left(\exists n\in\mathbb{Z},\ n \text{ is odd and } n \text{ is even }\right) \equiv \forall n\in\mathbb{Z}, n \text{ is even or } n \text{ is odd}.

Negating nested quantifiers

Nested quantifiers are statements where one quantifier sits inside another, such as "for all ... there exists ..." or "there exists ... such that for all ...". The key rule is the same as before: swap each quantifier and negate the inside, working from the outermost quantifier inwards, one layer at a time.

For example,

¬(x, y, P(x,y))x, ¬(y, P(x,y))x, y, ¬P(x,y).\neg\left(\forall x,\ \exists y,\ P(x,y)\right) \equiv \exists x,\ \neg\left(\exists y,\ P(x,y)\right) \equiv \exists x,\ \forall y,\ \neg P(x,y).

Similarly,

¬(x, y, P(x,y))x, ¬(y, P(x,y))x, y, ¬P(x,y).\neg\left(\exists x,\ \forall y,\ P(x,y)\right) \equiv \forall x,\ \neg\left(\forall y,\ P(x,y)\right) \equiv \forall x,\ \exists y,\ \neg P(x,y).

Now I give a couple of actual concrete mathematical examples, these are definitions that naturally use nested statements involving quantifiers.

Example 1: Local maximum of a function f(x)f(x)

We define ff to have a local maximum at x=ax=a if

δ>0 such that x, xa<δf(x)f(a).\exists \delta>0 \text{ such that } \forall x,\ |x-a|<\delta \Rightarrow f(x)\leq f(a).

Intuitively, this is saying x=ax=a is a local maximum if you can find a small interval around aa for which f(x)f(x) of all the xx in that interval is not greater than f(a)f(a).

Now let us examine what it means for x=ax=a not to be a local maximum. This is the negation of the statement above:

¬(δ>0 such that x, xa<δf(x)f(a))\neg\left(\exists \delta>0 \text{ such that } \forall x,\ |x-a|<\delta \Rightarrow f(x)\leq f(a)\right) δ>0, ¬(x, xa<δf(x)f(a))\equiv \forall \delta>0,\ \neg\left(\forall x,\ |x-a|<\delta \Rightarrow f(x)\leq f(a)\right) δ>0, x such that ¬(xa<δf(x)f(a))\equiv \forall \delta>0,\ \exists x \text{ such that } \neg\left(|x-a|<\delta \Rightarrow f(x)\leq f(a)\right) δ>0, x such that xa<δ and f(x)>f(a).\equiv \forall \delta>0,\ \exists x \text{ such that } |x-a|<\delta \text{ and } f(x)>f(a).

So the negation is

δ>0, x such that xa<δ and f(x)>f(a).\forall \delta>0,\ \exists x \text{ such that } |x-a|<\delta \text{ and } f(x)>f(a).

Intuitively, this is saying that no matter how small a neighbourhood we choose around aa, there is always some xx in that neighbourhood with f(x)>f(a)f(x)>f(a), so x=ax=a is not a local maximum.

Example 2: Continuity of a function f(x)f(x) at a point

We define ff to be continuous at x=ax=a if

ϵ>0, δ>0 such that x, xa<δf(x)f(a)<ϵ.\forall \epsilon>0,\ \exists \delta>0 \text{ such that } \forall x,\ |x-a|<\delta \Rightarrow |f(x)-f(a)|<\epsilon.

This is a difficult definition to understand, and it is usually first taught at undergraduate level. Intuitively, the idea of ff is continuous at x=ax=a is that ff passes x=ax=a without jumps or sudden breaks. If xx is sufficiently close to aa, then f(x)f(x) is also very close to f(a)f(a). I will leave the intuition at this level, as this part is optional! However, we can nonetheless find its negation.

Now let us examine what it means for ff not to be continuous at x=ax=a. This is the negation of the statement above:

¬(ϵ>0, δ>0 such that x, xa<δf(x)f(a)<ϵ)\neg\left(\forall \epsilon>0,\ \exists \delta>0 \text{ such that } \forall x,\ |x-a|<\delta \Rightarrow |f(x)-f(a)|<\epsilon\right) ϵ>0 such that ¬(δ>0 such that x, xa<δf(x)f(a)<ϵ)\equiv \exists \epsilon>0 \text{ such that } \neg\left(\exists \delta>0 \text{ such that } \forall x,\ |x-a|<\delta \Rightarrow |f(x)-f(a)|<\epsilon\right) ϵ>0 such that δ>0, ¬(x, xa<δf(x)f(a)<ϵ)\equiv \exists \epsilon>0 \text{ such that } \forall \delta>0,\ \neg\left(\forall x,\ |x-a|<\delta \Rightarrow |f(x)-f(a)|<\epsilon\right) ϵ>0 such that δ>0, x such that ¬(xa<δf(x)f(a)<ϵ)\equiv \exists \epsilon>0 \text{ such that } \forall \delta>0,\ \exists x \text{ such that } \neg\left(|x-a|<\delta \Rightarrow |f(x)-f(a)|<\epsilon\right) ϵ>0 such that δ>0, x such that xa<δ and f(x)f(a)ϵ.\equiv \exists \epsilon>0 \text{ such that } \forall \delta>0,\ \exists x \text{ such that } |x-a|<\delta \text{ and } |f(x)-f(a)|\geq \epsilon.

So the negation is

ϵ>0 such that δ>0, x such that xa<δ and f(x)f(a)ϵ.\exists \epsilon>0 \text{ such that } \forall \delta>0,\ \exists x \text{ such that } |x-a|<\delta \text{ and } |f(x)-f(a)|\geq \epsilon.

Intuitively, this says that we can find a gap ϵ>0\epsilon > 0 for which, no matter how small a non-zero interval we choose around x=ax=a, we can always find a xx^* inside that interval, for which f(x)f(a)ϵ|f(x^*) - f(a)| \geq \epsilon. In this case, ff is not continuous at aa, as the xx near it, not all f(x)f(x) converge to f(a)f(a). What I gave here again is a hand wavy explanation to aid intuition, not a precise definition or statement, for that is where we turn to the formal negation!

Summary

  • ¬P\neg P is true exactly when PP is false.
  • ¬(¬P)\neg(\neg P) is PP.
  • "¬(P and Q)\neg(P \text{ and } Q)" is "¬P or ¬Q\neg P \text{ or } \neg Q".
  • "¬(P or Q)\neg(P \text{ or } Q)" is "¬P and ¬Q\neg P \text{ and } \neg Q".
  • Rule for negating quantifiers: swap the quantifier and negate the inside.
  • When negating statements with nested quantifiers, apply swap the quantifier and negate the inside recursively, starting from the outermost quantifier.