Lecture 1 - Proof Techniques - Induction and Contradiction
Why Proofs?
This is a theory course, and in a theory course the proof is the deliverable. A proof is a complete chain of reasoning that starts from definitions and previously proved facts and ends at the claim, written so that a skeptical reader can check every step without trusting you. Examples, pictures, and intuition are how we find proofs, and they will appear all over these notes, but they are never the proof itself: checking a claim for the first million cases does not establish it for all cases, and Lecture 2 will show claims that hold for every case anyone has ever checked yet resist all known proofs.
Two habits will be enforced all semester, in every problem set and on every exam:
- Be wordy; err on the side of detail. Write for a skeptical reader: justify each step, name the fact or assumption it uses, and spell out reasoning you might be tempted to wave off as obvious. Extra detail never costs you; a gap does.
- Label the skeleton of the proof. Say what you are assuming, say what you are trying to show, and when the technique has named parts (base case, inductive hypothesis, inductive step), label them.
Every example below follows both habits; hold your own write-ups in the exercises at the end of each lecture, and on the exams, to the same standard.
Direct Proof
The plainest way to prove "if , then " is to assume , then reason forward until appears. One tiny example, done in full, to fix the format.
Definition. An integer is even if for some integer , and odd if for some integer .
Example 1: the sum of two odd integers is even
Claim. If and are odd integers, then is even.
Proof. By the definition of odd, there must be integers and such that and . Then
Since is an integer, matches the definition of even.
The entire proof is definitions and algebra. We never say "odd plus odd is clearly even". Instead, we produce the integer () that the definition of even demands.
Example 1's skeleton is not a one-off. The next two facts reuse it, and both feed directly into the proof later in this lecture.
We will build Examples 2 and 3 together on the board, with volunteers leading. Try each one yourself before reading the write-up; the versions here are for checking your work afterward.
Example 2: if is odd, then is odd
Claim. If is an odd integer, then is odd.
Proof. By the definition of odd, there must be an integer such that . Then
Since is an integer, matches the definition of odd.
Same skeleton as Example 1: start with the definition, do the algebra, move things around so that the definition of the conclusion appears.
Example 3: if is even, then is even
Try proving this directly and you hit a wall: assuming is even gives an equation about , and there is no clean algebraic road from a fact about down to a fact about .
The way out is the contrapositive: the statement "if , then " is true exactly when "if not , then not " is true, because each one says there is no situation where is true and is false. Proving either form proves both.
Claim. If is an integer and is even, then is even.
Proof. We prove the contrapositive: if is not even, then is not even. Every integer is either even or odd and not both (divide by 2 and look at the remainder, which is 0 or 1), so "not even" means odd, and the contrapositive reads: if is odd, then is odd. That is exactly Example 2, already proved. Since a statement and its contrapositive are equivalent, the claim holds.
Two lessons. First, when the hypothesis hands you nothing workable, flip to the contrapositive so the assumption arrives in usable form: " is odd" gives you to compute with, while " is even" gives an equation about the wrong quantity. Second, the proof cited Example 2 instead of reproving it: proofs are built from previously proved facts, and a precise citation is good style, not laziness. Keep Example 3 on a shelf; the proof uses it.
Proof by Contradiction
To prove a statement by contradiction, we assume is false and derive something impossible. Valid steps from a true assumption can only produce truths, so if the derivation lands on something impossible, the assumption must have been false, and is true. The general approach is:
- Announce it: "Suppose, for the sake of contradiction, that is false."
- Write out exactly what "not " says.
- Derive a statement that is obviously false.
- Conclude .
Example 4: there is no smallest positive rational number
Definition. A real number is rational if for some integers and with , and irrational otherwise.
Claim. There is no smallest positive rational number.
Proof. Suppose, for the sake of contradiction, that there does exist a smallest positive rational number. Let's call it . By the definition of rational, for some integers and with . Then , and since is a nonzero integer, is rational by that same definition. Moreover, half of a positive number is positive, so , and since is positive, . So is a positive rational smaller than the smallest positive rational, which is impossible. Therefore, no smallest positive rational exists.
Example 5: is irrational
Claim. is irrational.
Proof. Suppose, for contradiction, that is rational. Then for some integers with . A rational number has many such forms (), and we are free to pick which form to work with, so pick one in lowest terms, meaning and share no common factor greater than 1. Why is this possible? If our and do share a common factor , divide both by : the fraction's value is unchanged and the numerator shrinks. Repeating this cannot go on forever (the numerator's absolute value gets strictly smaller each time), so it eventually stops, and it stops exactly when no common factor greater than 1 remains. We may therefore assume from the start that and share no common factor greater than 1. Squaring both sides and clearing denominators:
So is even. By Example 3, is even, say . Substituting: , so , so is even, so is even. Now and are both even, contradicting the choice that they share no common factor greater than 1. Hence is irrational.
Three moves carried the proof: taking the fraction in lowest terms (always extract the strongest form of your assumption), the lemma from Example 3 (small direct proofs get reused inside big ones), and parity bookkeeping. The same skeleton proves , , or for any that is not a perfect square, with the parity argument replaced by divisibility by a prime factor of . The problem set asks you to run that generalization.
The most common mistake is assuming the conclusion (using 's irrationality somewhere inside the argument), and negating the claim incorrectly (the negation of " is irrational" is " for some integers", not "for all"). If your contradiction proof never uses the negated assumption, it is actually a direct proof (or it is wrong).
Induction
Induction proves statements of the form "for every natural number , holds."
Principle of mathematical induction. Let be a statement about a natural number , and let be a natural number. If
- holds (base case), and
- for every , if holds then holds (inductive step, where the assumption " holds" is the inductive hypothesis),
then holds for every .
Why do these two parts cover every case? The base case establishes the claim for one concrete value, . On its own that proves nothing about the rest. The inductive step is what reaches them: it shows that truth at any value forces truth at the next one, so the base case sets off a chain. holds by the base case; the inductive step applied at then gives ; applied again it gives ; and every is reached after finitely many of these hand-offs. The usual picture is a line of dominoes: the base case tips the first one, and the inductive step guarantees each domino knocks over the next.
In this course an induction proof must label all three parts. Here is the template at full detail.
Example 6: the sum of the first positive integers
Claim. For every : .
Proof. By induction on . Let be the statement .
Base case (). The left side is ; the right side is . Equal, so holds.
At this point we know the claim holds for one value, , and nothing more. The inductive step must supply every remaining case. We do this by showing that the claim holding at any forces it to hold at : combined with the base case, that reaches , then , and so on through every .
Inductive step. Let and assume the inductive hypothesis : . We must show . Splitting off the last term of the sum and applying the hypothesis:
which is exactly . By induction, holds for all .
The inductive step has a fixed rhythm: peel off the last piece, apply the hypothesis to what remains, do algebra until the target appears. Note where the hypothesis was used; if your inductive step never uses the inductive hypothesis, you did not write an induction proof, and you should either be suspicious or notice you found a direct proof.
Example 7: guess the formula, then prove it
Induction shines when paired with a guess-then-verify workflow.
Question. What is , the sum of the first odd numbers?
Compute small cases: , , , .
The values are : perfect squares!
Claim. For every : .
Proof. By induction on . Base case (): both sides are . Inductive step: let , assume , and split off the last term:
The computation of small cases is scratch work and proves nothing, but it gives you a hint at where to start.
Example 8: the base case is a choice
Induction does not have to start at , and sometimes it cannot.
Claim. For every : .
First, why ? Check small cases: at we get , , , so the claim is false! At we get .
Proof. By induction on . Base case (): .
Inductive step. Let and assume . We must show . Justifying every link:
The inductive step is a chain of inequalities, and every link is justified by either the hypothesis or the standing assumption . When a problem asks you for the smallest valid starting point , small-case checking finds the candidate and the induction certifies everything from it onward. This idea will return with force in Lecture 4 - Asymptotic Notation and Growth Rates, where "eventually, for all large " is the whole subject.
A famous failure mode: all horses are the same color
Induction can go wrong in a way that is easy to miss, and the classic demonstration is a "proof" of something absurd. Read it and try to find the flaw before continuing; every step will look reasonable.
"Claim." In any group of horses, all the horses are the same color.
"Proof." By induction on . Base case (): a group of one horse is trivially all one color. Inductive step: let and assume any group of horses is all one color. Take any group of horses, numbered through . Removing horse leaves the group of horses, all one color by the hypothesis. Removing horse instead leaves the group , also all one color by the hypothesis. The two groups share horses through , so both groups have the color of the shared horses, and all horses are the same color. By induction, every group of horses is monochrome, so all horses are the same color. ""
The flaw: the gluing move needs the two groups to overlap. The shared horses carry the color from one group to the other, but when (that is, going from horse to ), the two groups are and and the shared set is empty: nothing links the two horses' colors. The inductive step is perfectly valid for every and fails only at , which is exactly the hand-off the base case feeds. The chain never gets started, and one broken link is all it takes.
Strong induction
Sometimes does not follow from but from earlier cases further back. Strong induction allows that.
Principle of strong induction. Let be a statement about a natural number . If for every , the implication "if holds for all , then holds" is true, then holds for every . (The base case is the instance of the implication, where the hypothesis is vacuous and must be shown outright.)
Example 9: every integer at least 2 is a product of primes
Definition. An integer is prime if its only positive divisors are and . A single prime counts as a product of primes (a product with one factor).
Claim. Every integer is a product of primes.
Proof. By strong induction on . Let and assume every integer with is a product of primes. If is prime, it is a product of primes by itself. Otherwise, has a divisor other than and , so with . By the inductive hypothesis applied to each factor, and are products of primes, so their product is too.
Ordinary induction is helpless here: knowing that factors into primes says nothing about . The factors and land somewhere unpredictable below . Strong induction allows us to use any earlier case. Note the case prime plays the role of a base case scattered through the integers. Strong induction reappears in Unit 1 as structural induction on automata and grammars, where "earlier cases" become "smaller machines and subexpressions."
Example 10: there are infinitely many primes
The capstone: a proof by contradiction that also uses the strong-induction fact we just proved.
Claim. There are infinitely many primes.
Proof. Suppose, for the sake of contradiction, that there are only finitely many primes. List all of them as . Let
Since , Example 9 says is a product of primes, so some prime divides . That appears on our list, so also divides the product . Then divides the difference , which is impossible for a prime. So the list could not have contained all primes, and thus there must be infinitely many.
Two techniques in one proof: contradiction supplies the finite list, and the previously proved induction fact supplies the prime divisor of . Proofs compose; this is why we insist small facts get proved cleanly and cited, not rederived fuzzily inline. A common misreading: the proof does not claim itself is prime (it often is not), only that its prime divisors are new.
Quantifiers
Every definition in this course is a quantified statement: to prove "for all , " you take an arbitrary ; to prove "there exists with " you exhibit one; and to prove either by contradiction you must negate it correctly. The negation rules:
- not (for all : ) is: there exists with not .
- not (there exists with ) is: for all : not .
When quantifiers are nested, apply these rules one layer at a time: the "not" starts outside, moves past each quantifier in turn (flipping for-all to there-exists and there-exists to for-all), and finally lands on the innermost statement. For example:
The quantifiers keep their order; only their flavors flip, and the "not" ends up attached to the innermost claim, where it usually simplifies (not "" becomes ""). Order itself matters too: "every lock has a key that opens it" and "there is a key that opens every lock" are different claims.
You will use this mechanically in Lecture 4 - Asymptotic Notation and Growth Rates: the definition of has the form "there exist and such that for all , ", so proving a function is not means proving "for all and there exists with ": given an arbitrary and , you must produce a specific that violates the inequality. The same discipline is the entire content of the pumping lemma arguments in Lecture 7 - The Pumping Lemma and Nonregular Languages.
Exercises
These are not collected or graded, they are your study material! The warm-ups and exams will look alot like them. Each exercise is a variation of an example above.
Exercise 1
Prove that the sum of an odd integer and an even integer is odd (see Example 1).
Solution
Let be odd and be even. By the definitions, there must be integers and such that and . Then
Since is an integer, matches the definition of odd.
Exercise 2
Prove by contradiction that there is no largest negative rational number (see Example 4).
Solution
Suppose, for the sake of contradiction, that there does exist a largest negative rational number; call it . By the definition of rational, for some integers and with . Then , and since is a nonzero integer, is rational. Moreover, half of a negative number is negative, so , and since is negative, . So is a negative rational larger than the largest negative rational, which is impossible. Therefore, no largest negative rational exists.
Exercise 3
Prove that is irrational (see Example 5). Where does your argument break if you try to run it on ?
Solution
First a lemma mirroring Example 3: if is divisible by 3, then is divisible by 3. We prove the contrapositive. If is not divisible by 3, then or for some integer . In the first case ; in the second . Either way leaves remainder 1, so it is not divisible by 3.
Now suppose, for the sake of contradiction, that is rational, and write in lowest terms. Squaring and clearing denominators gives , so is divisible by 3, so is divisible by 3 by the lemma, say . Substituting gives , so , so is divisible by 3 too. Both and divisible by 3 contradicts lowest terms.
Where it breaks for : the lemma fails with 4 in place of 3. From " is divisible by 4" you cannot conclude " is divisible by 4" (take ). And indeed satisfies with , in lowest terms, no contradiction anywhere. The prime-ness of 3 is what powers the lemma.
Exercise 4
Prove by induction that for every : (Example 6's rhythm).
Solution
By induction on . Let be the statement .
Base case (). The left side is ; the right side is . Equal, so holds.
Inductive step. Let and assume the inductive hypothesis . Splitting off the last term and applying the hypothesis:
which is exactly (substitute into the formula and compare). By induction, holds for all .
Exercise 5
Prove by induction that is divisible by for every (Example 6's rhythm with different algebra).
Solution
By induction on . Let be the statement " is divisible by 3," that is, for some integer .
Base case (). , so holds.
Inductive step. Let and assume the inductive hypothesis: for some integer . Then
Since is an integer, is divisible by 3, which is . By induction, holds for all .
Exercise 6
Find the smallest integer such that for every , then prove your answer by induction (Example 8, both halves).
Solution
Finding the candidate. Check small cases: , , , , , and . So the candidate is , and the failures at show no smaller start works.
Certifying it by induction. Base case (): . Inductive step: let and assume . Then
Exercise 7
Write out the negation of: "for every there exists such that for all , if then ." Push the negation all the way inward, one quantifier at a time.
Solution
One layer at a time, flipping each quantifier as the "not" passes it:
The last step uses that the negation of "if then " is " and not ": an implication fails only when the hypothesis holds and the conclusion does not.