reading and writing mathematical proofs spring 2015 lecture 2: basic proving techniques
TRANSCRIPT
Reading and Writing Mathematical Proofs
Spring 2015
Lecture 2: Basic Proving Techniques
Previously on Reading and Writing
Mathematical Proofs
Proofs in Textual Form
Definition
Mathematical proof A convincing argument for the reader to establish the correctness of a mathematical statement without any doubt
Two Proof Formats
Theorem
If x is odd, then x2 is odd
Proof
Since x is odd, there exists a k ϵ ℤ such that x = 2k + 1. Then, x2 = (2k + 1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1. Thus, x2 is odd. □
This is what you should write down
This should be in the back of your mind
Proof Detail
When is a proof detailed enough?
Depends on what the reader will accept as true statements
A proof with more detail has “more obvious” statements…
… but is also much longer
A good proof must find the right balance
Proving Tips
Tips for writing proofs
1. State the proof techniques you’re using (see this lecture)
2. Keep a linear flow Proving process different from written proof
3. Describe every step clearly in words Or draw a figure
4. Don’t use complicated notation
5. Keep your proof as simple as possible
6. Make sure your axioms are actually “obvious” What is obvious to you may not be obvious to the reader
7. Finish your proof Connect everything with what you were trying to prove
Basic Proving Techniques
Today…
Overview
Basic Proving Techniques
1. Forward-backward method (or direct method)
2. Case analysis
3. Proof by contradiction
4. Mathematical induction
Forward-Backward Method
Forward-Backward Method
Forward-Backward Method
The most basic approach
Logically combine axioms, definitions, and earlier theorems (forward)
Simplify the goal (backward)
This is the approach we have been using so far
This should always be your default approach
Usage
When to use?
Generally used for statements of the form: If P then Q
Reason forward from the premise Reason backward from the goal Follow the rules from Logic and Set Theory (2IT60)
Note Reasoning backward is part of the proving process In a written proof you generally reason forward to keep the flow
Premise Goal
Example
Theorem
If 0 ≤ x ≤ 2, then –x3 + 4x + 1 > 0
Example
Theorem
If 0 ≤ x ≤ 2, then –x3 + 4x + 1 > 0Proof
Perhaps it helps if we first plot the function –x3 + 4x + 1.
It seems that the function is smallest around x = 0 and x
= 2. But -03 + 4 x 0 + 1 = 1, and -23 + 4 x 2 + 1 = 1.
It seems that –x3 + 4x + 1 ≥ 1 for 0 ≤ x ≤ 2 .Simplify goal: -x3 + 4x ≥ 0 for 0 ≤ x ≤ 2.
Example
Theorem
If 0 ≤ x ≤ 2, then –x3 + 4x + 1 > 0Proof
Let’s simplify further: -x3 + 4x = x (4 – x2) ≥ 0Also, x (4 – x2) ≥ 0 if x ≥ 0 and 4 – x2 ≥ 0.I think we’re ready for the proof…
Example
Theorem
If 0 ≤ x ≤ 2, then –x3 + 4x + 1 > 0Proof
We first show that –x3 + 4x ≥ 0. We can rewrite the function as –x3 + 4x = x (4 – x2) = x (2 – x) (2 + x). Since x, (2 - x), and (2 + x) are all nonnegative for 0 ≤ x ≤ 2, it follows that x (2 – x) (2 + x) = –x3 + 4x ≥ 0 for 0 ≤ x ≤ 2. By adding 1 to both sides we obtain –x3 + 4x + 1 ≥ 1 > 0. □
Another Example
Theorem
If f1(n) = O(g1(n)) and f2(n) = O(g2(n)), then f1(n)f2(n) = O(g1(n)g2(n))
Another Example
Theorem
If f1(n) = O(g1(n)) and f2(n) = O(g2(n)), then f1(n)f2(n) = O(g1(n)g2(n))
Proof
What does f(n) = O(g(n)) mean again?
There exist positive constants c and n0 such that f(n) ≤ c g(n)
for all n ≥ n0.
Let’s write this as a logical formula:
∃c,n0[c > 0 ⋀ n0 > 0: ∀n[n ≥ n0 : f(n) ≤ c g(n)]]
We must be very careful with our variables! Use different names!
Another Example
Theorem
If f1(n) = O(g1(n)) and f2(n) = O(g2(n)), then f1(n)f2(n) = O(g1(n)g2(n))
Proof
By definition there exist positive constants c’ and n0’ such that
f1(n) ≤ c’ g1(n) for all n ≥ n0’. Similarly, there exist positive constants c’’ and n0’’ such that f2(n) ≤ c’’ g1(n) for all n ≥ n0’’. We need to show that there exist positive constants c and n0 such that
f1(n)f2(n) ≤ c g1(n)g2(n) for all n ≥ n0.
To establish this result, we need to find values for c and n0 such that the above is true. We already have constants c’, c’’, n0’, and n0’’, so we can use these values to compute c and n0.
Note that f1(n)f2(n) ≤ c’g1(n) c’’g2(n) = c’ c’’ g1(n)g2(n) , but only if n ≥ n0’ and n ≥ n0’’ . So n ≥ n0 should imply n ≥ n0’ and n ≥ n0’’ .
Another Example
Theorem
If f1(n) = O(g1(n)) and f2(n) = O(g2(n)), then f1(n)f2(n) = O(g1(n)g2(n))
Proof
By definition there exist positive constants c’ and n0’ such that
f1(n) ≤ c’ g1(n) for all n ≥ n0’. Similarly, there exist positive constants c’’ and n0’’ such that f2(n) ≤ c’’ g1(n) for all n ≥ n0’’. We need to show that there exist positive constants c and n0 such that
f1(n)f2(n) ≤ c g1(n)g2(n) for all n ≥ n0. Let n0 = max(n0’, n0’’) and c = c’ c’’. Then, for all n ≥ n0 (which implies n ≥ n0’ and n ≥ n0’’),
f1(n)f2(n) ≤ c’ g1(n) c’’ g2(n) = c’ c’’ g1(n) g2(n) = c g1(n) g2(n). Thus, f1(n)f2(n) = O(g1(n)g2(n)). □
If the reasoning is confusing to you, try making a logical derivation using techniques from Logic and Set Theory (2IT60)
Case Analysis
Case Analysis
Case analysis
Prove the theorem by considering a small number of cases
Say you want to prove Q, then you can also prove: P1 ⇒ Q : if P1 then Q
P2 ⇒ Q : if P2 then Q
P3 ⇒ Q : if P3 then Q
P1 ⋁ P2 ⋁ P3 : P1 or P2 or P3
P1, P2, and P3 describe the different cases
Using P1, P2, or P3 as premise might make proof easier
Don’t forget to prove: P1 or P2 or P3 (one of the cases must hold)!
helps forward reasoning
Usage
When to use?
Generally useful for a “for all”-quantifier If it can be broken down into a small number of configurations
Examples An integer is odd or even An integer is positive, negative, or zero x ≤ y or y < x A quadrilateral is convex or not
Also useful for proving correctness if-statement (see next lecture)
Example
Theorem
For any integer x, x(x+1) is even
Example
Theorem
For any integer x, x(x+1) is even
Proof
Right now we know nothing about x, which makes it hard to prove that x(x+1) is even (we have nothing to work with).
What happens if x is odd?
In that case (x+1) is even, and hence the multiplication must be even.
What happens if x is even?
Doesn’t really matter, the multiplication will be even.
Example
Theorem
For any integer x, x(x+1) is even
Proof
We consider two cases:
Case (1): x is oddThen there exists an integer k such that x = 2k+1. Hence,
x(x+1) = (2k+1) (2k + 2) = 2 (2k + 1) (k + 1).
Thus, x(x+1) is even.
Case (2): x is evenThen there exists an integer k such that x = 2k. Hence,
x(x+1) = 2k (2k + 1) = 2 (2k2 + k).
Thus, x(x+1) is even.
Since an integer is either odd or even, this concludes the proof. □
Often omitted
Example
Theorem
Among any 6 people there are 3 mutual friends or 3 mutual strangers.
Example
Theorem
For any graph G=(V,E) with |V| = 6 vertices there is a complete subgraph of size 3 or an independent set of size 3.
Example
Theorem
For any graph G=(V,E) with |V| = 6 vertices there is a complete subgraph of size 3 or an independent set of size 3.
Proof
Consider any vertex x ϵ V. We consider the following cases:
Case (1): x is connected to at least three other vertices in Gx could be part of a complete subgraph. When is this not the case?
Case (2): x is connected to at most two other vertices of Gx could be part of an independent set. When is this not the case?
Example
Theorem
For any graph G=(V,E) with |V| = 6 vertices there is a complete subgraph of size 3 or an independent set of size 3.
Proof
Consider any vertex x ϵ V. We consider the following cases:
Case (1): x is connected to at least three other vertices in GLet these vertices be u, v, and w. We again consider two cases:
Case (a): u, v, and w are independent. Then {u, v, w} is our indep. set.
Case (b): u, v, and w are not independent. Without loss of generality, let u and v be connected. Then {x, u, v} is our complete subgraph.
Case (2): x is connected to at most two other vertices of GLet u, v, and w be three vertices not connected to x. More cases:
Case (a): u, v, and w form a complete subgraph. Done!
Case (b): u, v, and w do not form a complete subgraph. Without loss of generality, let u and v be independent. Then {x, u, v} is our indep. set. □
Case Analysis
Dealing with Cases
Cases can be nested! (as in example)
Proofs should not have too many cases Proofs with many cases are hard to check
Reducing the number of cases can be helpful to the reader If proofs of two cases are essentially the same, you only need to
give it once Some cases can be avoided with “without loss of generality”
Examples In the previous proof we had to consider (u, v) ϵ E, (v, w) ϵ E or
(u, w) ϵ E. We can swap letters to always make (u, v) ϵ E. For cases x ≤ y and y ≤ x we can assume the former
w.l.o.g.
Proof by Contradiction
Contradiction
Proof by Contradiction
Assume the negation and show that “it is impossible”
To prove Q: Assume ¬Q and derive contradiction (false) by forward
reasoning
To prove ¬Q: Assume Q and derive contradiction…
Very powerful technique!
“When you have eliminated the
impossible, whatever remains, however
improbable, must be the truth”
Usage
When to use?
Useful when the negation of the statement is easier to work with
Useful when the negation as a premise gives more information E.g. when the negation has a “there exists”-quantifier
Always try this method if you’re stuck!
Rational Numbers
Definition
A number x is rational if there exists integers a and b such that
x = a/b
Examples 6, ⅓, and -⅝ are rational π and e are irrational (not rational)
Example
Theorem
√2 is irrational
Example
Theorem
√2 is irrational
Proof
Ok, so we need to prove that there exist no integers a and b such that √2 = a/b. What can we do with that? Not sure…
How about a proof by contradiction?
That means we can assume that such a and b do exist. So what is wrong with that?
Example
Theorem
√2 is irrational
Proof
For the sake of contradiction, assume there exist integers a and b such that √2 = a/b. Without loss of generality we can assume that
b > 0 (why?). Square both sides and rewrite to obtain 2b2 = a2. This means that a2 is even and thus a is even (we have proved the contraposition in the previous lecture). Hence there exists a k such that a = 2k. But then 2b2 = a2 = 4k2 or b2 = 2k2, and thus b is also even.
Ok, so both a and b are even. In principle there is nothing wrong with that. However, if b = 2m, then a/b = k/m = √2. Also, k and m are smaller integers. Applying the same argument to k and m leads to even smaller integers. This cannot go on forever!
Example
Theorem
√2 is irrational
Proof
For the sake of contradiction, let a and b be the smallest positive integers such that √2 = a/b. Square both sides and rewrite to obtain 2b2 = a2. This means that a2 is even and thus a is even (we have proved the contraposition in the previous lecture). Hence there exists a k such that a = 2k. But then 2b2 = a2 = 4k2 or b2 = 2k2, and thus there exists an integer m such that b = 2m. We get that
k/m = a/b = √2. But k and m are smaller than a and b, which contradicts the assumption that a and b are smallest.
Thus, √2 is irrational. □
Example
Theorem (pigeonhole principle)
If n items are put into m containers and n > m, then there must exist a container that contains more than one item
pigeons pigeonholes
Example
Theorem (pigeonhole principle)
If n items are put into m containers and n > m, then there must exist a container that contains more than one item
Proof
For the sake of contradiction, assume that every container contains at most one item. Let ci be the number of items in container i for
1 ≤ i ≤ m (so ci ≤ 1 for all i). Then,
n = Σ1≤i≤m ci ≤ Σ1≤i≤m 1 = m < n
This is a contradiction. Thus there must exist a container that contains more than one item. □
Can we say something about more than one container?
Example
Theorem
n2 log n ≠ O(n2)
Example
Theorem
n2 log n ≠ O(n2)Proof
For the sake of contradiction, assume that there exist positive constants c and n0 such that n2 log n ≤ c n2 for all n ≥ n0. By dividing both sides by n2, we obtain that log n ≤ c for all n ≥ n0. This is false for n = max(2c+1, n0), since then log n ≥ log 2c+1 = c+1 > c.This contradicts that log n ≤ c for all n ≥ n0. Thus, n2 log n ≠ O(n2). □
Usually it is sufficient to say that the function f(n) (in this case: log n) is unbounded. This automatically implies that, for any constant c, there exists an n large enough such that f(n) > c.
Mathematical Induction
Mathematical induction
Mathematical Induction
Proving something about all positive integers using a chain of implications
Say we want to prove P(n) for all positive integers: Base case: Prove P(1) (or P(0) if for n ≥ 0) Step: Prove that P(n) implies P(n+1) for all n ≥ 1
P(1) ⇒ P(2) ⇒ P(3) ⇒ P(4) ⇒ P(5) ⇒ …
P(n) is called the induction hypothesis Sometimes you need to come up with one…
Again a very powerful technique!
Usage
When to use?
Whenever you encounter a statement of the form: ∀n[n ϵ ℕ: P(n)] or P(n) holds for all positive integers n
Or if it holds only for n ≥ c for some constant c Then the base case is P(c)
That’s all … for now
Example
Theorem
For all positive integers n, Σ1≤k≤n k = n(n+1)/2
Example
Theorem
For all positive integers n, Σ1≤k≤n k = n(n+1)/2
ProofWe use induction on n.Base case (n = 1):
Σ1≤k≤n k = Σ1≤k≤1 k = 1 = 1(1+1)/2 = n(n+1)/2
Step (n ≥ 1):Suppose that Σ1≤k≤n k = n(n+1)/2. (Induction hypothesis or IH)
We need to show that Σ1≤k≤n+1 k = (n+1)(n+2)/2.
We have:Σ1≤k≤n+1 k = (Σ1≤k≤n k) + (n+1) = n(n+1)/2 + (n+1) = (n+1)(n+2)/2
Note that we use the IH in the second equality.
So it follows by induction that Σ1≤k≤n k = n(n+1)/2 for all positive integers n. □
Example
Theorem
For every integer n ≥ 5, 2n > n2
Example
Theorem
For every integer n ≥ 5, 2n > n2
Proof
We use induction on n.
Base case (n = 5): 2n = 25 = 32 > 25 = 52 = n2
Step (n ≥ 5):Suppose that 2n > n2 (IH).
We need to show that 2n+1 > (n+1)2 .
We have:
2n+1 = 2 x 2n > 2n2 (by IH)So it is sufficient to show that 2n2 ≥ (n+1)2 = n2 + 2n + 1 for n ≥ 5. This can be simplified to n2 – 2n – 1 ≥ 0 or (n – 1)2 ≥ 2. This is clearly true for n ≥ 5.
So it follows by induction that 2n > n2 for n ≥ 5. □
Example
Theorem
A set of n ≥ 1 elements has 2n subsets including the empty set.
Example
Theorem
A set of n ≥ 1 elements has 2n subsets including the empty set.
Proof
We use induction on n.
Base case (n = 1):If a set S has only one element x, then we have 2 subsets {} and {x}. Since 21 = 2, the base case holds.
Step (n ≥ 1):Suppose that every set of n elements has 2n subsets. (IH)
We need to show that any set S of n+1 elements has 2n+1 subsets.
Pick some element x ϵ S (possible since n+1 ≥ 1). Let S’ = S\{x}.
By the IH, S’ has 2n subsets A1, …, Ak (k = 2n). The subsets of S’ are exactly the subsets of S that do not contain x. On the other hand, the sets A’i = Ai U {x} are the subsets of S’ that contain x. A subset of S’ must either contain x or not. Thus, S has 2 x 2n = 2n+1 subsets. □
Induction issues
Be careful with induction!
Theorem
All horses have the same color
Induction issues
Be careful with induction!
Theorem
In every set of n ≥ 1 horses, all horses have the same color
Proof
We use induction on n.
Base case (n = 1):There is only one horse, so it must be true.
Step (n ≥ 1):Suppose that in every set of n horses, all horses have the same color (IH).
We need to show that any set of n+1 horses share the same color.
By the IH, the first n horses have the same color. Similarly, by the IH,
the last n horses have the same color. Thus all horses have the same
color. □
Induction issues
Be careful with induction!
Theorem
In every set of n ≥ 1 horses, all horses have the same color
Proof
We use induction on n.
Base case (n = 1):There is only one horse, so it must be true.
Step (n ≥ 1):Suppose that in every set of n horses, all horses have the same color (IH).
We need to show that any set of n+1 horses share the same color.
By the IH, the first n horses have the same color. Similarly, by the IH,
the last n horses have the same color. Thus all horses have the same
color. □
What happens if n = 1?
Induction issues
Be careful with induction!
Theorem
In every set of n ≥ 1 horses,
all horses have the same color
We are missing P(1) ⇒ P(2) This breaks everything!
Can be remedied by additionally proving P(2) as extra base case But in this case we can’t…
Step argument must work for all n ≥ 1 (or n ≥ c)! Otherwise these cases must be proved as extra base cases
Strong Induction
Strong Induction
Normally we must prove P(n+1) using P(n)
What if we need P(i) (i < n) to prove P(n+1)? After all, P(i) should also already hold
Instead of P(n) ⇒ P(n+1) we prove P(1) ⋀ … ⋀ P(n) ⇒ P(n+1) More information in the premise! Still correct: strong induction
Not always useful, but sometimes very convenient…
Example
Theorem
It takes n – 1 breaks to break a chocolate bar with n ≥ 1 squares into individual squares
Example
Theorem
It takes n – 1 breaks to break a chocolate bar with n ≥ 1 squares into individual squares
Proof
We use strong induction on n.
Base case (n = 1):It’s just 1 square, so 0 breaks is correct.
Step (n ≥ 1):Suppose it takes i – 1 breaks to break a chocolate bar with i squares
for 1 ≤ i ≤ n (IH). We need to show that it takes n breaks to break a
chocolate bar with n+1 squares. Suppose the chocolate bar is broken into 2 pieces with a and
b squares, where 1 ≤ a, b ≤ n and a + b = n+1. By the IH it
takes a – 1 breaks for the first piece and b – 1 for the second piece.
Thus, weneed 1 + (a – 1) + (b – 1) = a + b – 1 = n breaks in total. □
Example
Theorem
It takes n – 1 breaks to break a chocolate bar with n ≥ 1 squares into individual squares
Proof
We use strong induction on n.
Base case (n = 1):It’s just 1 square, so 0 breaks is correct.
Step (n ≥ 2):Consider a chocolate bar with n squares. Suppose the chocolate bar is broken into 2 pieces with a and
b squares, where 1 ≤ a, b < n and a + b = n. By the IH it takes
a – 1 breaks for the first piece and b – 1 for the second piece.
Thus, weneed 1 + (a – 1) + (b – 1) = a + b – 1 = n – 1 breaks in total.
□
Example
Theorem
With 4-cent and 5-cent coins we can make any amount n ≥ 12
Example
Theorem
With 4-cent and 5-cent coins we can make any amount n ≥ 12
Proof
We use strong induction on n.
Base case (n = 12): We can use three 4-cent coins.
Step (n ≥ 12): Suppose we can make any amount i with 4-cent and 5-cent coins for
12 ≤ i ≤ n. We need to show that we can make the amount n+1.
If we use one 4-cent coin, then the remainder is n – 3. By the IH we
can make the amount n – 3, so that means we can make n+1. □
Example
Theorem
With 4-cent and 5-cent coins we can make any amount n ≥ 12
Proof
We use strong induction on n.
Base case (n = 12): We can use three 4-cent coins.
Step (n ≥ 12): Suppose we can make any amount i with 4-cent and 5-cent coins for
12 ≤ i ≤ n. We need to show that we can make the amount n+1.
If we use one 4-cent coin, then the remainder is n – 3. By the IH we
can make the amount n – 3, so that means we can make n+1. □
Can we apply the IH to n – 3? For n = 12, n – 3 = 9 and we haven’t
proved anything for n = 9! The step only works for n ≥ 15. We need
more base cases!
Example
Theorem
With 4-cent and 5-cent coins we can make any amount n ≥ 12
Proof
We use strong induction on n.
Base case (12 ≤ n ≤ 15):(n = 12): three 4-cent coins.
(n = 13): two 4-cent coins and one 5-cent coin.
(n = 14): one 4-cent coin and two 5-cent coins.
(n = 15): three 5-cent coins.
Step (n ≥ 15): Suppose we can make any amount i with 4-cent and 5-cent coins for
12 ≤ i ≤ n. We need to show that we can make the amount n+1.
If we use one 4-cent coin, then the remainder is n – 3. By the IH we
can make the amount n – 3, so that means we can make n+1. □
Strong induction
Final notes on strong induction
When you apply the IH to P(i), make sure that i ≤ n. Otherwise you may be proving P(n+1) with P(n+1)…
As with standard induction, make sure that the step works for all n If not, you may need more base cases
Theorem6n = 0 for all n ≥ 0
ProofBase case (n = 0): 6 x 0 = 0Step (n ≥ 0): n + 1 = a + b. By the IH, 6a = 0 and 6b = 0.
Thus, 6 (n+1) = 6 (a + b) = 6a + 6b = 0 + 0 = 0. □
What’s wrong with this proof?