Download presentation
Presentation is loading. Please wait.
1
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Methods of Proof Hubert Chan (Chapters 1.6, 1.7, 4.1) [O1 Abstract Concepts] [O2 Proof Techniques]
2
Fallacy: Beware of Wrong Proofs
Claim: All girls have the same hairstyle. Proof: By induction on the number of girls. Basis step: Obviously true for any group of one girl. Induction step: Assume that any group of k 1 girls have same hairstyle. Let us then consider any group of (k+1) girls.
3
What is wrong with that proof?
k+1 Y X Remove a girl, say X k X Y Remove a girl, say Y Induction hypothesis: Y and others have the same hairstyle k X Y Induction hypothesis: X and others have the same hairstyle What is wrong with that proof? Thus, X, Y and the rest have the same hairstyle
4
Example of a proof A student in this class has not read the discrete mathematics textbook. Everyone in this class passed the first quiz. Hence, someone who passed the first quiz has not read the book. C(x): x is in this class B(x): x has read the book P(x): x has passed the first quiz x (C(x) B(x)) x (C(x) P(x)) x (P(x) B(x)) Is the argument valid? Yes. x (C(x) B(x)) implies that there is a student x0 in the class that C(x0) and B(x0) x (C(x) P(x)) implies that for all students in the class, if C(x) then P(x). Since C(x0), we have P(x0). Hence we have P(x0) and B(x0), which means x (P(x) B(x))
5
We can start with some related proposition q which is true
Methods of Proof 1. Theorem: p is true. n2 0 n2 + 4 4 n2 + 4 > 0 e.g. n2+4 > 0 We can start with some related proposition q which is true Then, show that q p is true Since q is true, so p must be true e.g. 2n+5 is odd Assume that 2n + 5 is even 2n is odd A contradiction occurs. Show that p F is true That is, we assume that p is false, then lead to some proposition which is always false. So, p must be true “Proof by contradiction” [O2] Note that for a -> F to be true, the only possible case is to have a to be false, thus if one can show that p F, then p must be true!
6
Theorem. 2 is irrational
Assume 2 is rational. integers a, b > 0 such that 2 = a/b; and a and b are relatively prime. 2b2 = a2. a2 is even. a is even. a = 2c for some integer c. b2 = a2/2 = 2c2 b2 is even. b is even. a and b have a common factor 2. A contradiction occurs.
7
2. Theorem: p q is true. Direct Proof e.g. If n is odd, then n2 is odd. Suppose n is odd. Then, n=2k+1 for some integer k. It follows that n2 = 4k2+4k+1, n2 = 2(2k2+2k)+1. So, n2 is odd. Assume that p is true. Show that q is true.
8
Indirect Proof (Contrapositive) e.g. If 3n+2 is odd, then n is odd.
Suppose n is even. Then, 3n is even 3n+2 is even So, 3n+2 is odd n is odd Assume that q is false. Show that p is false. (p q) (q p) To assume that p -> q is false, the only case we need consider is when p is true, but q is false (recall that for implication, this is the only case that will make it false). If we can show that this case leads to a contradiction, then this case is not possible, then p->q is always true.
9
(p q) (p q) Its negation is: p q Proof by contradiction [O2] Assume that pq is false and leads to a contradiction Example 1. If 6x + 9y = 101, then either x or y is not an integer. Suppose that 6x + 9y = 101, and both x and y are integers. Then, 3(2x+3y) = 101 and 2x + 3y = 101/3 Since 101/3 is not an integer However, since we assume both x and y are integers, we conclude that 2x + 3y is an integer. Hence, contradiction!
10
(p q) (p q) Its negation is: p q Proof by contradiction [O2] Example 2. Prove that if x is irrational and y is rational, then x+y is irrational Assume that pq is false and leads to a contradiction Suppose x is irrational and y is rational, but x+y is rational. Then, x + y can be rewritten as a/b for two integers a,b That is, (x+y) = a/b. Since y is also rational, so y = c/d for two integers c, d Then, x = a/b – c/d = (ad-cb)/bd Since (ad-cb) and bd are both integers, it follows that x is rational. A contradiction occurs.
11
Proof by Cases e.g. If n is an integer not divisible by 3, then n2 mod 3 = 1. Case 1: n mod 3 = 1. Then, n = 3k + 1 for some integer k. Thus, n2 = 9k2 + 6k + 1 = 3(3k2 + 2k) + 1. So, n2 mod 3 = 1. Case 2: n mod 3 = 2. Then, n = 3k + 2 for some integer k. Thus, n2 = 9k2 + 12k + 4 = 3(3k2 + 4k +1) + 1. So, n2 mod 3 = 1. So, p q is true p = p1 p2 ... pn To prove (p1 p2 ... pn ) q, we can prove (p1q) (p2 q) .... (pn q) That is, we have to prove (pi q) one by one for each i
12
Mathematical Induction
Theorem: P(n) for all positive integers n. A proof by mathematical induction consists of two steps. Basis step: P(1) is true. Inductive step: for any positive integer i, if P(i) is true, then P(i+1) is true (induction hypothesis) When we complete both steps, we have proved that P(n) is true for all positive integer n 1. Why mathematical induction works? Since P(1) is true, so P(2) is true (inductive step) Similarly, P(2) is true, so P(3) is true (inductive step again) P(3) is true, so P(4) is true (...) ... P(n) is true if n 1 Basic philosophy: [P(1) k>0 (P(k) P(k+1))] n≥1 P(n)
13
Prove the following using mathematical induction.
(1) (2n-1) = n2 (2) 2n < n! for all n > 3 Base case: n = 1, LHS = RHS, so the statement is true for n = 1. (2) Induction step: Assume that the statement is true for n = k. (Hypothesis) Consider n = k + 1. L.H.S. = … (2k – 1) + (2(k+1) – 1) [by the hypothesis:] L.H.S. = k2 + 2(k+1) – 1 = k2 + 2k + 1 = (k + 1)2 = R.H.S. So, the statement is true for n = k + 1. Therefore, the statement is true for all n = 1, 2, ….
14
Another form of mathematical induction
Basis step: P(1) is true. Inductive step: for any positive integer i, if P(i) is true, then P(i+1) is true if P(k) is true for all k i, then P(i+1) is true Since P(1) is true, so P(2) is true (inductive step) Since P(1) and P(2) is true, so P(3) is true (inductive step again) Again, P(1), P(2), and P(3) is true, so P(4) is true (...) ...... P(n) is true if n 1 Example. Every integer k 2 is either a prime number or can be written as a product of prime numbers.
15
Every integer k 2 is either a prime number or can be written as a product of prime numbers.
Base case: k = 2, the statement is true. Induction step: Assume that the statement is true for k i (with k 2). Consider k = i+1. Case (a) – If k is a prime number, then the statement is true. Case (b) – Otherwise, k is a composite number, k = k1 k2 where k1, k2 i. By the hypothesis, Both k1 and k2 can be written as a product of prime numbers. Thus, k can also be written as a product of prime numbers.
16
All girls have the same hairstyle?
An incorrect Proof: By induction on the number of girls. Basis step: Obviously true for any group of one girl. Induction step: Assume that any group of k 1 girls have same hairstyle. Let us then consider any group of (k+1) girls. Delete a girl x, the remaining k girls have the same hairstyle Delete another girl y, the remaining k girls have the same hairstyle Hence the (k+1) girls have the same hairstyle! The argument works only when k > 1, (at least 3 girls in the group to start with) i.e., it makes use of the hypothesis that it is true for k = 2, but this is not yet proved in the base case!
17
Recursive Algorithms [O1]
To solve P(n) for n ≥ 1, where P(n) is a problem of size n when n = 1, solve P(1) directly when n > 1, solve P(n) based on the solution of P(n-1) Why this approach works? mathematical induction. For example: To compute F(n) = n! = n(n-1)(n-2)…1 = n*(n-1)! Procedure F(n) if n=1 then return (1) else return (n*F(n-1)) Try F(4) = 4*F(3); needed to solve F(3) F(3) = 3*F(2); needed to solve F(2) F(2) = 2*F(1); needed to solve F(1) F(1) = 1; Output 24 Output 6 Output 2 Output 1
18
Representation of Recursive Algorithm
F(n) *n F(n-1) Time complexity = number of calls (nodes) = n *(n-1) F(n-2) F(1)
19
Another example: Covering Problem by L-tiles
Show that any 2n x 2n chessboard with one square removed can be filled using L-shaped pieces.
20
Basis step n=1 Induction step: Assume it is true for n > 0 consider the case for n+1. Divide the chessboard into 4 2n x 2n boards. The figure shows that each of the four 2n x 2n boards has exactly a missing square. By the induction hypothesis, they can be covered by the L-shaped pieces, so is the 2n+1 x 2n+1 board.
21
Covering Chessboard with L-tiles
Any 2n x 2n chessboard missing one square can be filled by L-tiles based on induction (recursion).
22
Hanoi Problem (Chapter 7.1)
Given 3 pegs with n disks of different sizes. Initially all the disks are placed on the first peg in the order of sizes, with the largest on the bottom. The game is to move all disks to another peg under the following rules: Disks are moved one at a time No disk is placed on top of a smaller disk. Example: moving 3 disks from Disk A to Disk B. A B C A B C A B C A B C A B C A B C A B C A B C A B C 22
23
Hanoi Problem Procedure Move (n, X, Y)
(move n disks from peg X to peg Y) If n = 1, then move the disk from X to Y else Move (n-1, X, Z) move disk n from X to Y Move (n-1, Z, Y) Correctness can be proved by mathematical induction. X Y Z
24
Recursive Algorithms Recursive algorithm is a common technique for problem solving. Advantages: Easy to debug implement/comprehend, good structure, correctness can be proved easily by mathematical induction. Attention should be paid to the recursive step and the initial cases. Hanoi Problem M(n) = number of moves for solving the n-disks Hanoi problem = M(n1) + 1 n > 1 1 n = 1 Procedure Move (n, X, Y) (move n disks from peg X to peg Y) If n = 1, then move the disk from X to Y else move (n-1, X, Z) move disk n from X to Y move (n-1, Z, Y) M(n) = 2 (2M(n2) + 1) + 1 = 22M(n2) = 23M(n3) = 2n-1M(1) + 2n-2 + … = 2n 1
25
Divide and Conquer Strategy
Divide the problem into sub-problems Solve all subproblems (recursively) Combine subproblems’ solutions to find the solution of the whole. problem of size n ….. divide cost subproblem of size n/b a subproblems altogether ….. combine cost Solution for the original problem f(n) = number of operations required to solve the problem of size n. = a f(n/b) + divide cost and combine cost
26
Divide and Conquer Examples
Binary Search - Search a sorted list of n elements for a given x Method compare x with the middle element of the list and reduce the search window by half (left half or right half) f(n) stands for the number of comparisons
27
A log2n Solution - Intuition
F(n) F(n/2) F(n/4) F(1) Assume n = 2k , k = log2n f(n) = f(n/2) + 1 = f(n/22) : = f(n/2k) + k = f(1) + k = k + 1 = log2n + 1
28
Evaluating xn If n=1, output x Number of multiplication: f(1)=0
If n>1, consider two cases: If n is even, Number of multiplications: If n is odd, For all n>1, Define
29
Fibonacci Numbers F(0) = 0, F(1) = 1
For n > 1, F(n) = F(n-1) + F(n-2).
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.