Hubert Chan (Chapters 1.6, 1.7, 4.1)

Slides:



Advertisements
Similar presentations
With examples from Number Theory
Advertisements

22C:19 Discrete Structures Induction and Recursion Fall 2014 Sukumar Ghosh.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Induction Lecture 5: Sep 21 (chapter of the book and chapter of the notes)
Induction and recursion
CSE115/ENGR160 Discrete Mathematics 01/31/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/01/11
Methods of Proof Lecture 4: Sep 16 (chapter 3 of the book)
Induction and recursion
CS 2210 (22C:019) Discrete Structures Logic and Proof Spring 2015 Sukumar Ghosh.
Methods of Proof & Proof Strategies
Introduction to Proofs
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
Mathematical Induction. F(1) = 1; F(n+1) = F(n) + (2n+1) for n≥ F(n) n F(n) =n 2 for all n ≥ 1 Prove it!
Methods of Proof. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical theorems. Direct.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: More Proofs.
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
March 3, 2015Applied Discrete Mathematics Week 5: Mathematical Reasoning 1Arguments Just like a rule of inference, an argument consists of one or more.
CSC201 Analysis and Design of Algorithms Asst.Proof.Dr.Surasak Mungsing Oct-151 Lecture 2: Definition of algorithm and Mathematical.
1 Introduction to Abstract Mathematics Chapter 3: Elementary Number Theory and Methods of Proofs Instructor: Hayk Melikya Direct.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Methods of Proof Lecture 3: Sep 9. This Lecture Now we have learnt the basics in logic. We are going to apply the logical rules in proving mathematical.
Chap 3 –A theorem is a statement that can be shown to be true –A proof is a sequence of statements to show that a theorem is true –Axioms: statements which.
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
1 Discrete Structures – CNS2300 Text Discrete Mathematics and Its Applications Kenneth H. Rosen (5 th Edition) Chapter 3 The Foundations: Logic and Proof,
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
22C:19 Discrete Structures Logic and Proof Fall 2014 Sukumar Ghosh.
Mathematical Induction
CS104:Discrete Structures Chapter 2: Proof Techniques.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Mathematical Induction I Lecture 5: Sep 20 (chapter of the textbook and chapter of the course notes)
Section 1.7. Definitions A theorem is a statement that can be shown to be true using: definitions other theorems axioms (statements which are given as.
CSE 311 Foundations of Computing I Lecture 8 Proofs Autumn 2012 CSE
Methods of Proof Lecture 4: Sep 20 (chapter 3 of the book, except 3.5 and 3.8)
Induction and Recursion CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Mathematical Induction And Recursion Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
3.3 Mathematical Induction 1 Follow me for a walk through...
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Induction (chapter of the book and chapter of the notes)
The Foundations: Logic and Proofs
CS 2210:0001 Discrete Structures Logic and Proof
CSE15 Discrete Mathematics 02/01/17
CSE15 Discrete Mathematics 02/08/17
Indirect Argument: Two Classical Theorems
Advanced Algorithms Analysis and Design
Advanced Algorithms Analysis and Design
CS2210:0001Discrete Structures Induction and Recursion
Chapter 3 The Real Numbers.
Induction and recursion
Predicate Calculus Validity
CSE 311: Foundations of Computing
Hubert Chan (Chapters 1.6, 1.7, 4.1)
Gray Code Can you find an ordering of all the n-bit strings in such a way that two consecutive n-bit strings differed by only one bit? This is called the.
Mathematical Induction Recursion
Chapter 5 Induction and Recursion
The Foundations: Logic and Proofs
Induction and recursion
CSE 311: Foundations of Computing
Section 2.1 Proof Techniques Introduce proof techniques:   o        Exhaustive Proof: to prove all possible cases, Only if it is about a.
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept 24, 25.
Applied Discrete Mathematics Week 9: Integer Properties
Follow me for a walk through...
Advanced Analysis of Algorithms
Mathematical Induction
Mathematical Induction
Follow me for a walk through...
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
Methods of Proof Rosen 1.7, 1.8 Lecture 4: Sept, 2019.
Presentation transcript:

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]

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.

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

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))

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!

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.

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.

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.

(p  q)  (p  q) Its negation is: p  q Proof by contradiction [O2] Assume that pq 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!

(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 pq 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.

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 (p1q)  (p2 q)  ....  (pn q) That is, we have to prove (pi q) one by one for each i

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)

Prove the following using mathematical induction. (1) 1 + 3 + 5 + .... + (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. = 1 + 3 + 5 + … (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, ….

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.

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.

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!

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

Representation of Recursive Algorithm F(n) *n F(n-1) Time complexity = number of calls (nodes) = n *(n-1) F(n-2) F(1)

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.

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.

Covering Chessboard with L-tiles Any 2n x 2n chessboard missing one square can be filled by L-tiles based on induction (recursion).

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

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

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 = 2M(n1) + 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(n2) + 1) + 1 = 22M(n2) + 2 + 1 = 23M(n3) + 22 + 2 + 1 = 2n-1M(1) + 2n-2 + … + 2 + 1 = 2n  1

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

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

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) + 1 + 1 : = f(n/2k) + k = f(1) + k = k + 1 = log2n + 1

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

Fibonacci Numbers F(0) = 0, F(1) = 1 For n > 1, F(n) = F(n-1) + F(n-2).