MAT2033 · Week 2 · nested quantifiers and introduction to proofs

Introduction to proof methods: direct, contrapositive, contradiction

Direct proof, contraposition, contradiction, proof by cases and counterexamples, using the definitions of even/odd, divisibility and rational numbers. The template proof questions of the midterm come from here.

theoremlemmacorollaryconjecturedirect proofproof by contrapositionproof by contradictionproof by casesexistence proofcounterexamplevacuous proofevenoddrational numberdividesif and only if

The proof questions are the most feared part of the discrete math midterm. In fact most of them are template questions: “Give a direct proof”, “Prove by contraposition”, “Prove by contradiction”. On this page you will learn the English skeleton of each method. Half of any proof is writing the definition correctly. A proof that starts without the definition usually falls apart.

Golden rules:

  1. Start with the definition. The moment you write ”nn is odd”, immediately write “so n=2k+1n = 2k + 1 for some integer kk”.
  2. A new letter for every new number. If mm and nn are odd, m=2a+1m = 2a + 1, n=2b+1n = 2b + 1.
  3. Finish with the definition of your goal. ”=2m+1= 2m + 1, where m=…m = \dots is an integer. Therefore … is odd.”
  4. An example is not a proof, but a single counterexample refutes a ∀\forall claim.
  5. If the hypothesis is not useful, switch to the contrapositive.

Terms and definitions

  • Theorem: an important claim that has been proved true. Lemma: a helper claim used in a bigger proof. Corollary: a result that follows immediately from a theorem. Conjecture: a claim believed to be true but not proved. Axiom: a starting truth accepted without proof.
  • Most theorems start with “for all” but do not write it: “If nn is odd, then n2n^2 is odd” really means ∀n (P(n)→Q(n))\forall n\,(P(n) \to Q(n)). In the proof you take an arbitrary nn, and at the end universal generalization makes it hold for all nn.

Definitions to memorize:

ConceptDefinition
nn eventhere is an integer kk with n=2kn = 2k
nn oddthere is an integer kk with n=2k+1n = 2k + 1
a∣ba \mid b (aa divides bb)a≠0a \ne 0 and there is an integer cc with b=acb = ac
rr rationalr=p/qr = p/q, p,qp, q integers, q≠0q \ne 0
rr irrationala real number that is not rational
nn perfect squarethere is an integer kk with n=k2n = k^2

Direct proof

To prove p→qp \to q, assume pp and reach qq using definitions and algebra.

Theorem. If mm is even and nn is odd, then m+nm + n is odd.

Proof. Let m be even and n be odd.            state the hypothesis
Then m = 2a and n = 2b + 1 for some            definitions, TWO different letters
integers a and b.
So m + n = 2a + 2b + 1 = 2(a + b) + 1.         algebra, factor out the 2
Since a + b is an integer, m + n is odd        definition of the goal
by definition.  ∎

PITFALL · Giving the same letter to two numbers. If you write m=2km = 2k, n=2k+1n = 2k + 1, you have said n=m+1n = m + 1; the proof then works only for consecutive numbers. Every number gets its own letter.

Proof by contraposition

Since p→q≡¬q→¬pp \to q \equiv \lnot q \to \lnot p, it is enough to prove the contrapositive. When? When the hypothesis does not give you a useful equation: ”3n+73n + 7 is even”, ”n2n^2 is odd”, ”xyxy is irrational”.

Theorem. If nn is an integer and 3n+73n + 7 is even, then nn is odd.

If you try it directly: 3n+7=2k⇒n=2k−733n + 7 = 2k \Rightarrow n = \tfrac{2k - 7}{3}. This does not help; you cannot see that nn is odd.

Proof. We prove the contrapositive:
"If n is even, then 3n + 7 is odd."
Let n be even, so n = 2k for some integer k.
Then 3n + 7 = 6k + 7 = 6k + 6 + 1 = 2(3k + 3) + 1.
Since 3k + 3 is an integer, 3n + 7 is odd.
Since the contrapositive is true, the original statement is true.  ∎

Writing the contrapositive explicitly as a sentence earns marks. Watch De Morgan when the conclusion contains “and/or”: the negation of ”x≥1x \ge 1 or y≥1y \ge 1” is ”x<1x < 1 and y<1y < 1”.

Proof by contradiction

Assume the claim is false and reach an absurdity (r∧¬rr \land \lnot r). For p→qp \to q the assumption is ”pp is true and qq is false”. When? For negative claims such as “irrational”, “there is no …”, “infinitely many”.

Theorem. 2\sqrt{2} is irrational.

Proof. Assume, for contradiction, that √2 is rational.
Then √2 = a/b where a, b are integers, b ≠ 0, and the
fraction is in lowest terms (a and b have no common factor > 1).
Squaring: 2 = a²/b², so a² = 2b². Hence a² is even,
so a is even (if a were odd, a² would be odd).
Write a = 2c. Then 4c² = 2b², so b² = 2c², and b² is even,
so b is even.
Now a and b are both even, so 2 is a common factor.
This contradicts "lowest terms". Hence √2 is irrational.  ∎

Here the lemma “a² even ⇒ a even” was used; you proved it by contraposition (question 1). Big proofs are built from small lemmas.

TIP · Name the contradiction. On the last line write what contradicts what: “This contradicts the assumption that a/ba/b is in lowest terms.” The word “contradiction” alone is weak.

Proof by cases

If the hypothesis splits into several cases, prove each case separately. The cases must cover all possibilities (exhaustive).

Theorem. For every integer nn, n2+nn^2 + n is even.

Proof. Case 1: n is even, n = 2k.
  n² + n = 4k² + 2k = 2(2k² + k), even.
Case 2: n is odd, n = 2k + 1.
  n² + n = 4k² + 4k + 1 + 2k + 1 = 4k² + 6k + 2 = 2(2k² + 3k + 1), even.
Every integer is even or odd, so n² + n is even for all n.  ∎

A shorter way: n2+n=n(n+1)n^2 + n = n(n+1) is the product of two consecutive numbers and one of them is always even. But you have to justify this sentence too; on the exam the two-case proof is safer.

Existence proofs and counterexamples

Existence proof (constructive): to say “There exists xx with P(x)P(x)”, show a concrete xx. Example: “There is a positive integer that can be written as the sum of two cubes in two different ways.” 1729=13+123=93+1031729 = 1^3 + 12^3 = 9^3 + 10^3. Done.

Nonconstructive: proving that something exists without exhibiting it (for example, showing that one of two cases works without saying which). This comes up less in this course.

Counterexample: to show that ∀x P(x)\forall x\, P(x) is false, a single cc for which P(c)P(c) is false is enough. The danger is the reverse: however many examples you try, a ∀\forall claim is not proved by examples. n2−n+11n^2 - n + 11 is prime for the first ten values and collapses at n=11n = 11.

Other small templates

  • Vacuous proof: if pp can never be true, p→qp \to q is automatically true. “If nn is an integer with n2<0n^2 < 0, then n=7n = 7.” The hypothesis is never satisfied.
  • Trivial proof: if qq is always true, p→qp \to q is true.
  • iff proof: p↔q≡(p→q)∧(q→p)p \leftrightarrow q \equiv (p \to q) \land (q \to p). Write the two directions under separate headings: ”(⇒)” and ”(⇐)”. You may use the contrapositive for the second direction.

Which method should I choose?

What the hypothesis / claim looks likeTry first
The hypothesis gives a formula (”nn odd”, "a∣ba \mid b")Direct
The hypothesis is “expression is odd/even”, ”n2n^2 …”Contraposition
“irrational”, “no … exists”, “infinitely many”Contradiction
“for every integer” and parity/remainders are involvedCases
“there exists”Concrete example
“prove or disprove”Try small values first, look for a counterexample

Common mistakes

Wrong ideaThe truth
I showed a few examples, the proof is doneA ∀\forall claim is not proved by examples
m=2k+1m = 2k+1, n=2k+1n = 2k+1Separate letters: 2a+12a+1, 2b+12b+1
I write "=2(… )= 2(\dots)" and stopThe sentences “where … is an integer” and “therefore … even” are required
Proving the converseContrapositive: the direction flips AND both parts are negated
Starting by assuming the conclusion of the proofCircular reasoning; start from the hypothesis
Not saying what contradicts what in a contradiction proofName which part of the assumption it contradicts
Only one direction in iffBoth directions are needed
Not covering all casesWrite a covering sentence such as “Every integer is even or odd”

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Which proof method is the most natural for "If nn is an integer and n2n^2 is even, then nn is even"? Why?

Show answer
Proof by contraposition (prove: if n is odd, then n² is odd)

The hypothesis "n2n^2 is even" gives you no useful formula for nn: you cannot extract nn from n2=2kn^2 = 2k. The contrapositive "if nn is odd then n2n^2 is odd" starts with n=2k+1n = 2k+1: n2=2(2k2+2k)+1n^2 = 2(2k^2 + 2k) + 1. When the hypothesis is "an expression is odd/even", switch to the contrapositive.

Question 2medium

Prove or disprove: for every integer nn, n2+n+1n^2 + n + 1 is odd.

Show answer
True. n² + n = n(n + 1) is even, so n² + n + 1 is odd.

Proof by cases. Case 1: n=2kn = 2k. Then n2+n+1=4k2+2k+1=2(2k2+k)+1n^2 + n + 1 = 4k^2 + 2k + 1 = 2(2k^2 + k) + 1, odd. Case 2: n=2k+1n = 2k + 1. Then n2+n+1=4k2+4k+1+2k+1+1=2(2k2+3k+1)+1n^2 + n + 1 = 4k^2 + 4k + 1 + 2k + 1 + 1 = 2(2k^2 + 3k + 1) + 1, odd. It is odd in every case, so the claim is true. In a "prove or disprove" question, first try a few values (n=0,1,2n = 0, 1, 2: 1, 3, 7); if no counterexample appears, move on to the proof.

Question 3easy

Disprove: "Every odd integer greater than 1 is prime."

Show answer
Counterexample: 9 = 3 · 3 is odd and not prime.

A single counterexample is enough to break a ∀\forall claim. The odd integers greater than 1 are 3, 5, 7, 9: the first non-prime is 9. "For n=9n = 9, nn is odd but 9=3⋅39 = 3 \cdot 3, so it is not prime." This sentence earns full marks.

Question 4medium

Give a direct proof: if a∣ba \mid b and b∣cb \mid c, then a∣ca \mid c (for integers a≠0a \ne 0, b≠0b \ne 0, cc).

Show answer
b = ak and c = bl give c = a(kl), and kl is an integer, so a | c.

Write the definition: a∣ba \mid b means there is an integer kk with b=akb = ak. b∣cb \mid c means there is an integer ll with c=blc = bl. Use two different letters. Substitute: c=bl=(ak)l=a(kl)c = bl = (ak)l = a(kl). klkl is a product of integers, so it is an integer. By definition a∣ca \mid c. ∎

Question 5medium

Prove by contraposition: if nn is an integer and 5n−35n - 3 is even, then nn is odd.

Show answer
Contrapositive: if n is even, then 5n − 3 is odd. n = 2k gives 5n − 3 = 2(5k − 2) + 1.

pp: "5n−35n-3 even", qq: "nn odd". The contrapositive ¬q→¬p\lnot q \to \lnot p: "If nn is even, then 5n−35n-3 is odd." Let n=2kn = 2k. Then 5n−3=10k−3=10k−4+1=2(5k−2)+15n - 3 = 10k - 3 = 10k - 4 + 1 = 2(5k - 2) + 1, and 5k−25k - 2 is an integer, so it is odd. Since the contrapositive is true, the original is true too. ∎

Question 6medium

Prove that there is no integer nn with n2=4m+2n^2 = 4m + 2 for some integer mm. (That is, no perfect square leaves remainder 2 when divided by 4.)

Show answer
Every square is 4j or 4j + 1, never 4m + 2.

Proof by cases. If n=2kn = 2k then n2=4k2n^2 = 4k^2: the remainder on division by 4 is 0. If n=2k+1n = 2k + 1 then n2=4k2+4k+1=4(k2+k)+1n^2 = 4k^2 + 4k + 1 = 4(k^2 + k) + 1: the remainder is 1. A number has only one remainder on division by 4, so n2n^2 can never be of the form 4m+24m + 2. ∎ (Check: over −200..200-200..200 the remainders of squares are only 0 and 1.)

Question 7medium

Consider the claim "n2−n+11n^2 - n + 11 is prime for every positive integer nn." Find the smallest counterexample.

Show answer
n = 11 (11² − 11 + 11 = 121 = 11²)

For n=1,…,10n = 1, \dots, 10 the values are 11, 13, 17, 23, 31, 41, 53, 67, 83, 101: all prime. This is why "I tried a few examples and it works" is not a proof. For n=11n = 11, 121−11+11=121=11⋅11121 - 11 + 11 = 121 = 11 \cdot 11. Hint: when you choose n=11n = 11, every term becomes a multiple of 11.

Question 8hard

Prove that if nn is an odd integer, then 8∣n2−18 \mid n^2 - 1.

Show answer
n = 2k + 1 gives n² − 1 = 4k(k + 1), and k(k + 1) is even, so n² − 1 = 8m.

Let n=2k+1n = 2k + 1. Then n2−1=4k2+4k=4k(k+1)n^2 - 1 = 4k^2 + 4k = 4k(k+1). kk and k+1k+1 are consecutive; one of them is even, so k(k+1)=2mk(k+1) = 2m for some integer mm. (Show this separately by cases: if kk is even then k=2jk = 2j, if odd then k+1=2jk + 1 = 2j.) Hence n2−1=4⋅2m=8mn^2 - 1 = 4 \cdot 2m = 8m, that is, 8∣n2−18 \mid n^2 - 1. ∎ Check: n=3⇒8n = 3 \Rightarrow 8, n=5⇒24n = 5 \Rightarrow 24.

Question 9hard

Prove by contradiction: if rr is rational and xx is irrational, then r+xr + x is irrational.

Show answer
If r + x = s were rational, then x = s − r would be rational, a contradiction.

Assume, for contradiction, that r+xr + x is rational: r+x=abr + x = \tfrac{a}{b} and r=cdr = \tfrac{c}{d}, b,d≠0b, d \ne 0. Then x=ab−cd=ad−bcbdx = \tfrac{a}{b} - \tfrac{c}{d} = \tfrac{ad - bc}{bd}. The numerator and denominator are integers and bd≠0bd \ne 0; so xx is rational. This contradicts xx being irrational. Hence r+xr + x is irrational. ∎

Question 10medium

Prove that for all real numbers aa and bb, min⁡(a,b)+max⁡(a,b)=a+b\min(a, b) + \max(a, b) = a + b.

Show answer
Cases a ≤ b and a > b; in each case the sum is a + b.

Proof by cases. Case 1: a≤ba \le b. Then min⁡=a\min = a, max⁡=b\max = b, and the sum is a+ba + b. Case 2: a>ba > b. Then min⁡=b\min = b, max⁡=a\max = a, and the sum is b+a=a+bb + a = a + b. The two cases cover all possibilities. ∎ It is important to say that the cases are exhaustive.

Question 11easy

A student writes: "Claim: if n2n^2 is even then nn is even. Proof: take n=4n = 4. Then n2=16n^2 = 16 is even and n=4n = 4 is even. So the claim holds." What is wrong?

Show answer
An example is not a proof of a universal statement.

The claim says "for every integer nn". A single example does not prove a ∀\forall claim (but a single counterexample refutes it). The right way: contrapositive, "if nn is odd, n=2k+1n = 2k+1, then n2=2(2k2+2k)+1n^2 = 2(2k^2+2k)+1 is odd."

Question 12hard

Prove that for every integer nn: nn is odd if and only if n2+3n^2 + 3 is even.

Show answer
Prove both directions: n odd ⇒ n² + 3 even, and (contrapositive) n even ⇒ n² + 3 odd.

"iff" requires two proofs. (⇒) n=2k+1n = 2k + 1: n2+3=4k2+4k+4=2(2k2+2k+2)n^2 + 3 = 4k^2 + 4k + 4 = 2(2k^2 + 2k + 2), even.
(⇐) By contrapositive: if nn is even then n2+3n^2 + 3 is odd. n=2kn = 2k: n2+3=4k2+3=2(2k2+1)+1n^2 + 3 = 4k^2 + 3 = 2(2k^2 + 1) + 1, odd.
Both directions hold, so the claim is proved. ∎ Proving only one direction earns half marks.

Verification: Every proved claim (even/odd, divisibility, 8 | n²−1, remainders of squares mod 4, etc.) was brute-force tested over -200..200 with node; the counterexamples (9, and 121 for n = 11) were found with a primality test (verify/MAT2033/02.mjs).

Review card

even n=2k odd n=2k+1 a|b ⇔ b=ac (c an integer) rational r=p/q, q≠0 Two different numbers → two different letters: m=2a+1, n=2b+1 Direct: write the definition of p → algebra → definition of q. "where m=... is an integer" Contraposition: prove ¬q → ¬p. Choose it when the hypothesis is "expression is odd/even". Contradiction: assume p ∧ ¬q → absurdity → "This is a contradiction." Cases: cover all cases (n even / n odd; a≤b / a>b) Counterexample: ONE example kills a ∀ claim. An example never proves a ∀. iff: two directions separately (⇒ and ⇐) Vacuous: if p is always false then p→q is true √2 irrational: √2=a/b in lowest terms, a²=2b² → a even → b even → contradiction n²+n=n(n+1) always even odd² = 4(k²+k)+1 square ≡ 0 or 1 (mod 4) Closing sentence: "Therefore, by definition, ... ∎"