170 likes | 334 Views
CSS342: Induction. Professor: Munehiro Fukuda. Today’s Topics. Review of sequence and summations Mathematical induction Strong form of mathematical induction. Review. 1 2 3 4 5 … N a 1 a 2 a 3 a 4 a 5 … a N 1 1/2 1/3 1/4 1/5 … 1/N. f(x) = 1/x. Sequence.
E N D
CSS342: Induction Professor: Munehiro Fukuda CSS342: Induction
Today’s Topics • Review of sequence and summations • Mathematical induction • Strong form of mathematical induction CSS342: Induction
Review 1 2 3 4 5 … N a1 a2 a3 a4 a5 … aN 1 1/2 1/3 1/4 1/5 … 1/N f(x) = 1/x Sequence • A function from an integer subset to a set S • Geometric progression • a, ar, ar2, … , arn where a = the initial term and r = the common ratio • Arithmetic progression • a, a + d, a + 2d, … , a + nd where a = the initial term and d = the common difference CSS342: Induction
Review Sequence • Finding a formula or a general rule for constructing the terms of a sequence: • Runs of the same value? • 1, 1, 1, 1, 1 • Terms obtained from previous terms by adding the same amount? • 1, 3, 5, 7, 9 = 2n – 1 related to the arithmetic sequence • Terms obtained from previous terms by multiplying a particular amount? • 1 –1, 1, –1, 1= (–1)n+1 related to the geometric sequence • Terms obtained by combining previous terms? • 1, 2, 2, 3, 3, 3, 4, 4, 4, 4 • Cycles among the terms? • 1, 3, 5, 7, 9, 1, 3, 5, 7, 9 CSS342: Induction
Review Summation • ∑j=mnaj = am + am+1 + … + an • ∑j=mnkaj = k * ∑j=mnaj • ∑i=14∑j=13ij = ∑i=14i * (1 + 2 + 3) = 6 ∑i=14i = 6 (1 + 2 + 3 + 4) = 60 • ∑j=1nj = n(n + 1)/2 • ∑j=1nj2 = n(n + 1)(2n + 1)/6 • ∑j=mnarj , (r ≠ 0) = a(rn+1 - 1)/(r - 1), (r≠1) CSS342: Induction
Mathematical Induction A Row of Dominos • If you push the first domino, all the dominoes will fall one after another. • Formal representation: • The first domino falls. • For any k ≥ 1, if the kth domino falls, the (k+1)th domino will fall. • Axiom: the principle of mathematical induction A property P(n) that involves an integer n is true for all n ≥ 0 if the following are true: • P(0) is true. • If P(k) is true for any k ≥ 0, then P(k+1) is true. CSS342: Induction
Mathematical Induction A Proof by Induction on N Use the principle of mathematical induction: • Base case (or basis): prove P(0) is true. • Inductive step: • Inductive hypothesis: Assume P(k) is true for any k ≥ 0 • Inductive conclusion: Prove P(k+1) is true. Example 1: Prove the correctness of a recursive solution. pow(int x, int n) { if (n == 0) return 1; else return x * pow(x, n-1); } CSS342: Induction
Mathematical Induction Example1: pow(x, n) • Basis: When n = 0, pow(x, 0) = 1. x0 = 1. The recursive function is correct. • Inductive hypothesis: When n = k, assume that pow(x, k) is correct, i.e., xk. • Inductive step: Show the pow(x, k+1) is correct. pow(x, k+1) = x * pow(x, k) By the inductive hypothesis, pow(x, k) returns the value xk. Thus, pow(x, k+1) = x * xk = xk+1 • If pow(x, k) is correct, pow(x, k+1) is correct. Therefore, by the principle of mathematical induction, pow(x, n) is correct for any n≥ 1. CSS342: Induction
Mathematical Induction Example2: 1 + 2 + …. + n = n(n + 1)/2 • Basis: When n = 1, the S1(sum) is 1. S1 =1(1+1)/2 = 1. The formula is true. • Inductive hypothesis: When n = k, assume that Sk is k(k + 1)/2. • Inductive step: Show the formula is true when n = k + 1. Sk+1 =1 + 2 + …+ k + (k+1) = Sk+ (k+1) =k(k+1)/2 + (k+1) = k(k+1)/2 + 2(k+1)/2 =(k(k+1) + 2(k+1))/2 =(k+1)(k+2)/2 • If Sk is true, Sk+1 is true. Therefore, by the principle of mathematical induction, the formula is true when n≥ 1. CSS342: Induction
Mathematical Induction Example 3: Geometric Sum Show that if r≠1, a + ar1 + ar2 + … + arn = a(rn+1 - 1)/(r - 1) • Basis: If n=0, a(r1 – 1)/(r – 1) = a, which is true. • Inductive hypothesis: Assume that the formula is true for n = k. • Inductive step: Show the formula is true for n = k + 1. a + ar1 + ar2 + … + ark + ark+1 = a(rk+1 - 1)/(r - 1) + ark+1 = a(rk+1 - 1)/(r - 1) + ark+1 (r - 1)/(r - 1) = (a rk+1– a + a rk+2 – a rk+1)/(r – 1) = (a rk+2 – a)/(r – 1) = a(rk+2 – 1)/(r – 1) • If the formula is true for k, it is also true for k+1.Therefore, by the principle of mathematical induction, the formula is true when n≥ 0. CSS342: Induction
Mathematical Induction Example 4: Triominoes A 4 * 4 deficient board with triominos A n 8 * 8 deficient board with triominos A triomino: consisting of 3 squares joined at the edges A 2 * 2 deficient board with a triomino CSS342: Induction
Mathematical Induction 2k+1 2k * 2k 2k * 2k 2k+1 2k * 2k 2k * 2k A Tiling Problem Can we tile a 2k * 2k deficient board with triominoes? • Basis: • if k = 1, the 2 x 2 deficient board is itself a tromino and can therefore be tiled with one tromino. • Inductive hypothesis: • Assume that we can tile a deficient 2k * 2k board. • Inductive step: • Consider a 2k+1 * 2k+1 board and divide it into 4 2k * 2k boards. • Rotate each divided board so that its missing square is placed at a corner. • With three of those squares, make a new tromino. • If a 2k * 2k board is tiled with trominoes, a 2k+1 * 2k+1 board can be tiled. CSS342: Induction
Strong Form of Mathematical Induction Strong Form of Mathematical Induction A property P(n) that involves an integer n is true for all n ≥ 0 if the following are true: • P(0) is true. • If P(0), P(1), …, P(k) are true for any k ≥ 0, then P(k+1) is true. Difference from ordinary form of mathematical induction: P(k+1) is factorized in a combination of two or more of P(0) through to P(k). Proof by strong form of mathematical induction • Base case or (basis): prove P(0) is true. • Inductive step: • Inductive hypothesis: Assume P(1),P(2),..,P(k) is true for any k ≥ 0 • Inductive conclusion: Prove P(k+1) is true. CSS342: Induction
Strong Form of Mathematical Induction Example5: Every Integer > 1 Can Be Written as A Product of Prime Integers • Basis: When n = 2 ( > 1), 2 is a prime number itself, and thus can be written as a product of prime integers. The proposition is true. • Inductive hypothesis: Assume that the proposition is true for each of the integers 2, 3, … k • Inductive step: Show the proposition is true when n = k + 1. If k + 1 is a prime number, there is nothing more to show. If k + 1 is NOT a prime number, k + 1 is divisible and can be written k + 1= x * y where 1 < x < k + 1 and 1 < y < k + 1 Notice that x and y can be written as a product of prime integers by inductive hypothesis. If k is a product of prime numbers, k+1 is a product of prime numbers.Therefore, by the principle of mathematical induction, the proposition is true when n≥ 1. CSS342: Induction
Strong Form of Mathematical Induction Example6: Multiplying Rabbits Our recursive solution was: rabbit(1) = 1 rabbit(2) = 1 rabbit(n) = rabbit(n-1) + rabbit(n-2) The problem was its inherent efficiency. There is another solution that is much efficient: rabbit(n) = (an – bn) / sqrt(5) where a = [1 + sqrt(5)]/2 and b = [1 – sqrt(5)]/2 Note: a + b = 1/2 + sqrt(5)/2 + 1/2 – sqrt(5)/2 = 1 b = 1 –a a2 = [1 + 2sqrt(5) + 5]/4 = {4 + [2 + 2sqrt(5)]}/4 = 1 + [1 + sqrt(5)]/2 = 1 + a b2 = [1 – 2sqrt(5) + 5]/4 = {4 + [2 – 2sqrt(5)]}/4 = 1 + [1 – sqrt(5)]/2 = 1 + b CSS342: Induction
Strong Form of Mathematical Induction Example6: Multiplying Rabbits • Basis: rabbit(1) = (a1 – b1)/sqrt(5) = ((1 + sqrt(5))/2 – (1 – sqrt(5))/2)/sqrt(5) = sqrt(5)/sqrt(5) = 1 rabbit(2) = (a2 – b2)/sqrt(5) = (((1 + sqrt(5))/2)2 – ((1 – sqrt(5))/2)2)/sqrt(5) = ((1+2sqrt(5)+5)/4 – (1 – 2sqrt(5)+5)/4)/sqrt(5) = (4sqrt(5)/4)/sqrt(5) = sqrt(5)/sqrt(5) = 1 Thus, the formula is true. • Inductive hypothesis: Assume that the formula is true for all n such that 1≤n ≤ k, where k is at least 2. • Inductive step: Show the formula is true for n = k + 1. rabbit(k + 1) = rabbit(k) + rabbit(k – 1) = [(ak – bk) + (ak-1 – bk-1)]/sqrt(5) = [ak-1(a + 1) – bk-1(b+1)]/sqrt(5) = [ak-1(a2) – bk-1(b2)]/sqrt(5) // a + 1 = a2, b + 1 = b2 =(ak+1 – bk+1)/sqrt(5) If the formula is true for k, it is also true for k+1.Therefore, by the principle of mathematical induction, the formula is true when n≥ 1. CSS342: Induction
In-Class Exercise 1 Let’s form a group of three or four students. Each group selects and solves one of the following four math problems by adding up all members’ student IDs and calculating its modulo by 4, (i.e., ∑id % 4). Each group should write their solution on a one-page scratch paper as listing all its group members’ names, turn in the solution to the professor, and choose its group representative who will present the solution to all the class audience in case if the group is ask to do so. Group 0: Textbook p280 Exercise #11 Group 1: Textbook p280 Exercise #10 Group 2: Proof by Strong Induction (See: http://courses.washington.edu/css342/fukuda/exercise/ex1.pdf) Group 3: Non-turn-in writing exercise Q15 CSS342: Induction