Introduction to proof techniques 1 Proof by induction

CS246 (Winter 2015) Mining Massive Data Sets
Introduction to proof techniques
Sammy El Ghazzal, Jean-Yves Stephan
Disclaimer These notes may contain typos, mistakes or confusing points. Please contact [email protected]
so that we can improve them for next year.
1
Proof by induction
The proof by induction is usually illustrated by falling dominoes. Make the first domino fall (initialization or
base case) and if your dominos are placed in such a way that each domino makes the next one fall (inheritance
or induction), then all dominos will be down.
1.1
Principle
Say you want to prove that a property holds for all integers. To do a proof by induction, you will:
1. Base case: Prove that the property holds for n = 0 (possibly another value, it really depends on the
cases).
2. Inheritance: Assume that the result holds1 for n ≥ 0 and prove that the property would hold for n + 1.
1.2
Example
1. Let us start with a simple example. Prove that:
∀n ≥ 1,
n
X
i2 =
i=1
Solution
n(n + 1)(2n + 1)
.
6
We proceed in two steps:
• Base case (n = 1): the left hand side is 1, as is the right hand side so the property holds for n = 1.
• Now, we assume that the property holds for a given n ≥ 1, and we want to prove that it holds for
n + 1.
1 There
is a stronger variant of the proof by induction where you assume that the property holds for any integer k ≤ n.
1
2
Introduction to proof techniques
We compute:
n+1
X
i2 =
i=1
n
X
i2 + (n + 1)2
i=1
n(n + 1)(2n + 1)
+ (n + 1)2
6
n+1
=
(n(2n + 1) + 6(n + 1))
6
n+1
=
2n2 + 7n + 6
6 |
{z
}
(Induction hypothesis)
=
(n+2)(2n+3)
(n + 1)(n + 2)(2n + 3)
=
6
(n + 1)((n + 1) + 1)(2(n + 1) + 1)
=
,
6
which proves that the property holds for n + 1 and concludes the proof by induction.
2. A more complicated example2 : let n ≥ 1, and two families of vector (e1 , . . . , en ), and (f1 , . . . , fn+1 )
such that:
n
X
(j)
λi ei .
∀1 ≤ j ≤ n + 1, fj =
i=1
3
Prove that (f1 , . . . , fn+1 ) is a dependent family.
Solution
Let us denote by H(n) the property that we want to prove by induction:
H(n) = For any families f = (f1 , . . . , fn+1 ) and e = (e1 , . . . , en ) such that:
∀1 ≤ j ≤ n + 1, fj =
n
X
(j)
λi ei ,
i=1
then f is dependent.
We proceed in two steps:
• Base case (n = 1): we have:
∃λ1 , λ2 , f1 = λ1 e1 , f2 = λ2 e1 .
If both λ1 and λ2 are zero, then the family is clearly dependent.
Otherwise, we compute:
λ1 e2 − λ2 e1 = 0,
which proves that the family (e1 , e2 ) is dependent.
• Inheritance: Assume that H(n) holds and let us try to prove that H(n + 1) holds.
We distinguish two cases:
2 Note that the following result basically says that any set of n + 1 vectors in a vector space of dimension n is always
dependent.
3 Recall that (v , . . . , v ) is a (linearly) dependent family if and only if:
n
1
∃(λ1 , . . . , λn ) 6= 0,
n
X
i=1
λi vi = 0.
Introduction to proof techniques
3
(j)
(a) Forall 1 ≤ j ≤ n + 2, λn+1 = 0. Then, we can rewrite all the fj ’s in terms of (e1 , . . . , en ) and
therefore using H(n) we conclude that (f1 , . . . , fn+1 ) is dependent and so will be (f1 , . . . , fn+2 ).
(j)
(b) One of the λn+1 is non-zero. We can assume (by changing the numbering if necessary) that
(n+2)
λn+1 6= 0. We then define:
(j)
λn+1
fn+2 .
∀1 ≤ j ≤ n + 1, f˜j = fj − (n+2)
λn+1
Then, the coefficient on en+1 is zero for all the f˜j ’s, and therefore, we can apply H(n) to
(f˜1 , . . . , f˜n+1 ) and (e1 , . . . , en ), which gives us that (f˜1 , . . . , f˜n+1 ) is dependent, that is:
∃(β1 , . . . , βn+1 ) 6= 0, β1 f˜1 + · · · + βn+1 f˜n+1 = 0,
which can be rewritten:
∃(β1 , . . . , βn+1 ) 6= 0, β1 f1 + · · · + βn+1 fn+1 −
(j)
n+1
X
βj λn+1
j=1
λn+1
(n+2)
fn+2 = 0,
which by definition means that (f1 , . . . , fn+2 ) is dependent and concludes the inheritance part
of the proof.
1.3
Common mistakes
• Forgetting the base case. Usually, the base case is easy compared to the induction step, but you still
have to clearly mention that you looked at it.
2
Proof by contrapositive
2.1
Principle
Say you want to prove something of the form:
A ⇒ B.
The usual way to prove this is to assume that A is true and then try to get to B. Sometimes it is easier to
prove that:
¬B ⇒ ¬A.
2.2
Example
1. Prove that for any a, b ∈ R:
a + b is irrational ⇒ a or b is irrational.
4
Introduction to proof techniques
Solution
¬B in our case will be:
a and b are rational.
Now we want to prove ¬A, that is:
a + b is rational.
This is now straightforward: indeed, we can write:
∃p, q, u, v ∈ N, a =
We then compute:
a+b=
p
u
and b = .
q
v
pv + qu
,
qv
which proves that a + b is rational and concludes the proof by contrapositive.
2. Prove that for n ∈ N:
8 does not divide n2 − 1 ⇒ n is even.
Hint: Notice that any odd number n can be written as n = 4k + r with k ∈ N and r ∈ {1, 3}.
Solution
The contrapositive is:
n is odd ⇒ 8 divides n2 − 1.
Now, let us do the proof: let us take n an odd integer. By using the hint, we write n as 4k + r with
r ∈ {1, 3}.
We compute:
n2 − 1 = 16k 2 + 8rk + r2 − 1.
Now by noticing that 8 divides 16k 2 , 8rk and r2 −1 (because this quantity is either 0 or 8), we conclude
that 8 divides n2 − 1 which is what we wanted.
2.3
Common mistakes
• Computing ¬A and ¬B may be tricky in some cases. You should spend some time practicing if you
are not confident on this point.
For instance, try to find the contrapositive of the following (definition of limx→a f (x) = b):
∀ > 0, ∃α > 0, ∀x ||x − a|| ≤ α ⇒ ||f (x) − b|| ≤ Solution
The contrapositive is:
∃ > 0, ∀α > 0, ∃x s.t. ||x − a|| ≤ α and ||f (x) − b|| > 3
3.1
Proof by contradiction
Principle
A proof by contradiction works as follows: assume that the property you are trying to prove is wrong and
find a contradiction.
Introduction to proof techniques
3.2
5
Example
1. Prove that
Solution
√
2 is irrational.
Assume by contradiction that
√
2 is rational, that is4 :
∃p, q such that gcd(p, q) = 1 and
√
2=
p
.
q
Now, our goal is to find a contradiction.
We compute:
p2 = 2q 2 ⇒ p2 is even ⇒ p is even.
Therefore, we can write p = 2k and:
2=
(2k)2
⇔ q 2 = 2k 2 ⇒ q is even.
q2
Because both p and q are even, we have gcd(p, q) ≥ 2, which contredicts our assumption that gcd(p, q) =
1.
√
Therefore 2 is irrational.
2. Show that any function k-Lipschitz with k < 1 has at most one fixed point5 .
Solution
Let f be a k-Lipschitz function.
Assume by contradiction that f has 2 distinct fixed points that we call u and v with v 6= u. Then:
||f (u) − f (v)|| ≤ k||u − v|| ⇔ (1 − k)||u − v|| ≤ 0.
|
{z
}
=||u−v||
But 1 − k > 0 and ||u − v|| > 0 because u and v are distinct. This is a contradiction and therefore our
initial assumption is wrong, that is f has at most one fixed point.
4 The
fact that we can assume gcd(p, q) = 1 comes from the fact that you can reduce a fraction to its minimal form.
that f is k-Lipschitz on R if and only if:
5 Recall
∀x, y ∈ R, ||f (x) − f (y)|| ≤ k||x − y||.