Discrete Structures Chapter 2 Part B Mathematical Induction

Slides:



Advertisements
Similar presentations
Chapter 3 Elementary Number Theory and Methods of Proof.
Advertisements

Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
3.3 Divisibility Definition If n and d are integers, then n is divisible by d if, and only if, n = dk for some integer k. d | n  There exists an integer.
1 Section 2.4 The Integers and Division. 2 Number Theory Branch of mathematics that includes (among other things): –divisibility –greatest common divisor.
Elementary Number Theory and Methods of Proof
Chapter Primes and Greatest Common Divisors ‒Primes ‒Greatest common divisors and least common multiples 1.
February 19, 2015Applied Discrete Mathematics Week 4: Number Theory 1 The Growth of Functions Question: If f(x) is O(x 2 ), is it also O(x 3 )? Yes. x.
Copyright © 2013, 2010, and 2007, Pearson Education, Inc.
Basic properties of the integers
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
1.  The set N = {1,2,3,4,……..} is known as natural numbers or the set of positive integers  The natural numbers are used mainly for :  counting  ordering.
Discrete Mathematics Lecture 4: Sequences and Mathematical Induction
Discrete Mathematics Lecture 4 Harper Langston New York University.
CMSC 250 Discrete Structures Number Theory. 20 June 2007Number Theory2 Exactly one car in the plant has color H( a ) := “ a has color”  x  Cars –H(
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Discrete Structures Chapter 5: Sequences, Mathematical Induction, and Recursion 5.2 Mathematical Induction I [Mathematical induction is] the standard proof.
Copyright © Cengage Learning. All rights reserved.
Proofs, Recursion, and Analysis of Algorithms Mathematical Structures for Computer Science Chapter 2 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesProofs,
Lecture 4 Discrete Mathematics Harper Langston. Algorithms Algorithm is step-by-step method for performing some action Cost of statements execution –Simple.
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
Properties of the Integers: Mathematical Induction
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Fall 2002CMSC Discrete Structures1 Let us get into… Number Theory.
The Integers and Division
CSCI 1900 Discrete Structures
Chapter 2 The Fundamentals: Algorithms, the Integers, and Matrices
1 Properties of Integers Objectives At the end of this unit, students should be able to: State the division algorithm Apply the division algorithm Find.
9/2/2015Discrete Structures1 Let us get into… Number Theory.
Mathematical Maxims and Minims, 1988
Lecture 9. Arithmetic and geometric series and mathematical induction
Chapter 6 Mathematical Induction
Discrete Mathematics, 1st Edition Kevin Ferland
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
Copyright © Cengage Learning. All rights reserved. CHAPTER 4 ELEMENTARY NUMBER THEORY AND METHODS OF PROOF.
The Integers. The Division Algorithms A high-school question: Compute 58/17. We can write 58 as 58 = 3 (17) + 7 This forms illustrates the answer: “3.
CompSci 102 Discrete Math for Computer Science
Application: Correctness of Algorithms Lecture 22 Section 4.5 Fri, Mar 3, 2006.
Discrete Mathematics Lecture 4 Alexander Bukharovich New York University.
Chapter 5: Sequences, Mathematical Induction, and Recursion 5.5 Application: Correctness of Algorithms 1 [P]rogramming reliability – must be an activity.
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
Application: Correctness of Algorithms Lecture 22 Section 4.5 Fri, Feb 18, 2005.
Foundations of Discrete Mathematics Chapter 4 By Dr. Dalia M. Gil, Ph.D.
(CSC 102) Lecture 23 Discrete Structures. Previous Lecture Summery  Sequences  Alternating Sequence  Summation Notation  Product Notation  Properties.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Application: Algorithms Lecture 20 Section 3.8 Wed, Feb 21, 2007.
Greatest Common Divisors & Least Common Multiples  Definition 4 Let a and b be integers, not both zero. The largest integer d such that d|a and d|b is.
Direct Proof and Counterexample III
Application: Algorithms Lecture 19 Section 3.8 Tue, Feb 20, 2007.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Ch04-Number Theory and Cryptography 1. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic.
Number Theory Lecture 1 Text book: Discrete Mathematics and its Applications, 7 th Edition.
Fuw-Yi Yang1 Textbook: Introduction to Cryptography 2nd ed. By J.A. Buchmann Chap 1 Integers Department of Computer Science and Information Engineering,
CS151: Mathematical Foundations of Computing Mathematical Induction.
Number Theory. Introduction to Number Theory Number theory is about integers and their properties. We will start with the basic principles of divisibility,
Discrete Mathematics Lecture 7
Advanced Algorithms Analysis and Design
CMSC Discrete Structures
Applied Discrete Mathematics Week 3: Algorithms
Applied Discrete Mathematics Week 4: Number Theory
ELEMENTARY NUMBER THEORY AND METHODS OF PROOF
Copyright © Cengage Learning. All rights reserved.
CS201: Data Structures and Discrete Mathematics I
Application: Algorithms
Application: Algorithms
Divisibility and Modular Arithmetic
Advanced Analysis of Algorithms
Applied Discrete Mathematics Week 10: Introduction to Counting
Number Theory.
Agenda Proofs (Konsep Pembuktian) Direct Proofs & Counterexamples
From the last time: gcd(a, b) can be characterized in two different ways: It is the least positive value of ax + by where x and y range over integers.
Presentation transcript:

Discrete Structures Chapter 2 Part B Mathematical Induction Nurul Amelina Nasharuddin Multimedia Department

Mathematical Induction Use to verify a property of a sequence Used to check the conclusions about the outcomes of processes that occur repeatedly and according to definite patterns

Mathematical Induction Eg: Any whole number of cents of at least 8 cents can be obtained using 3 cents and 5 cents coins Formally: For all integers n  8, P(n) is true where P(n) = “n cents can be obtained using 3 cents and 5 cents coins” (1) If k cents is obtained using at least one 5 cents coin, then replace the coin with two 3 cents coins = (k+1) cents (2) If k cents is obtained without using a 5 cents coin, then replace at least three 3 cents coins with two 5 cents coins = (k+1) cents To show that P(n) is true for all integers n  8, (1) show P(8) is true (2) show that the truth of P(k+1) follows necessarily from the truth of P(k) for each k  8

Principle of Mathematical Induction Let P(n) be a predicate that is defined for integers n and let a be some integer. If the following two premises are true: P(a) is a true k  a, P(k)  P(k + 1) then the following conclusion is true as well P(n) is true for all n  a

Method of Proof by Mathematical Induction Consider a statement of the form, “For all integers n  a, a property P(n) is true” To prove such statement, perform these 2 steps: Step 1 (basis step): Show that when n = a, statement is true Step 2 (inductive step): Show that for all integers k  a, if the property is true for n = k then it is true for n = k+1. To perform this step, Suppose that the property is true for n = k, where k  a [This supposition is called the induction hypothesis] Then Show that the property is true for n = k+1

Coins Proofing P(n): n cents can be obtained using 3c and 5c coins.” P(n) is true for all integers n  8. Proof: Step 1: The property is true for n = 8 because 8c = 3c + 5c. Step 2: Suppose kc can be obtained using 3c and 5c for some integer k  8. [Induction hypothesis]. We must show that (k+1)c can be obtained using 3c and 5c. (1) In case there is a 5c coin among the kc, replace it by two 3c coins = (k+1) cents (2) In case there is no 5c coin, replace three 3c coins by two 5c coins = (k+1) cents Thus in either case (k+1)c can be obtained using 3c and 5c coins (PROVED!!)

Applications of Mathematical Induction Show that 1 + 2 + … + n = (n * (n + 1)) / 2 Sum of geometric series: r0 + r1 + … + rn = (rn+1 – 1) / (r – 1)

Sum of the First n Integers Show that 1 + 2 + … + n = (n * (n + 1)) / 2 for all integers n  1 P(n): 1 + 2 + … + n = (n * (n + 1)) / 2 Step 1: Show that the property is true for n=1 (LHS) 1 = (1 * (1 + 1)) /2 = 1 (RHS) The property true for n=1 Step 2 : Show that for all integers k  1, if the property is true for n = k then it is true for n = k+1 Suppose 1 + 2 + … + k = (k * (k + 1)) / 2, for some integer k  1 (induction hypothesis)

Sum of the First n Integers (2) We must show that 1 + 2 + … + (k+1) = (k+1)((k + 1)+1) /2, or equivalently that 1 + 2 + … + (k+1) = (k+1)(k + 2) /2 (show that LHS equals the RHS) 1 + 2 + … + (k+1) = 1 + 2 + … + k +(k+1) = (k * (k + 1)) / 2 + (k+1) (by substitution from the inductive hypothesis) = (k * (k + 1)) / 2 + 2(k + 1) / 2 = [(k+1)(k+2)] / 2 LHS = RHS Consequently, by the Principle of Mathematical Induction, P(n) is true for all n  1

Sum of a Geometric Sequence For any real number r except 1, and any integer n  0, P(n): Step 1: Show that the property is true for n=0: (LHS) (RHS) The property true for n=0

Sum of a Geometric Sequence (2) Step 2 : Show that for all integers k  0, if the property is true for n = k then it is true for n = k+1 Suppose , for k  0 (induction hypothesis) We must show that the property is true for (show that LHS equals the RHS) LHS = RHS Consequently, the theorem is true

Proving the Divisibility Property For all integers n  1, 22n – 1 is divisible by 3 P(n): 22n – 1 is divisible by 3 Step 1: Show that the property is true for n=1 22(1) – 1 = 22 – 1 = 3 is divisible by 3 The property true for n=1 Step 2 : Show that for all integers k  1, if the property is true for n = k then it is true for n = k+1 Suppose 22k – 1 is divisible by 3, for some integer k  1 (induction hypothesis)

Proving the Divisibility Property (2) By definition of divisibility, this means that 22k – 1 = 3r, for some integer r. We must show that the 22(k+1) – 1 is divisible by 3. 22(k+1) – 1 = 22k+2 – 1 = 22k . 22 – 1 = 22k . 4 – 1 = 22k . (3 + 1) – 1 = 22k . 3 + 22k – 1 = 22k . 3 + 3r = 3(22k + r) 22k + r is an integer because it is a sum of products of integers. Consequently, the theorem is true

Proving an Inequality For all integers n  3, 2n + 1  2n P(n): 2n + 1  2n Step 1: Show that the property is true for n=3 2n + 1 = 2(3) + 1 = 7  2n = 23 = 8 The property true for n=3 Step 2 : Show that for all integers k  3, if the property is true for n = k then it is true for n = k+1 Suppose 2k + 1  2k, for some integer k  3 (induction hypothesis)

Proving an Inequality (2) We must show that 2(k+1) + 1  2(k+1) or equivalently, 2k+3  2k+1 2k+3 = (2k+1) +2  2k + 2 2k+3 = (2k+1) +2  2k + 2k 2  2k for all integers k 2k + 3  2(2k) = 2k+1 Consequently, the 2n + 1  2n for all integers n  3

Proving a Property of A Sequence Define a sequence a1, a2, a3, …, as follows a1 = 2 ak = 5ak-1 Write the first four sequence a1 = 2 a2 = 5a1 = 5.2 = 10 a3 = 5a2 = 5.10 = 50 a4 = 5a3 = 5.50 = 250 Proof an = 2 . 5n-1 for all integers n  1 Step 1: Show that the property is true for n=1 2 . 51-1 = 2 . 1 = 2 = a1 The property true for n=1

Proving a Property of A Sequence (2) Step 2 : Show that for all integers k  1, if the property is true for n = k then it is true for n = k+1 Suppose ak = 2 . 5k-1 for all integers k  1(induction hypothesis) We must show that ak+1 = 2 . 5(k+1)-1 = 2 . 5k ak+1 = 5a(k+1)-1 = 5ak = 5 . (2 . 5k-1) = 2 . (5 . 5k-1) = 2 . 5k Consequently, the an = 2 . 5n-1 for all integers n  1

Exercises Show that 22n – 1 is divisible by 3 Show that for n > 2: 2n + 1 < 2n Show that xn – yn is divisible by x – y Show that n3 – n is divisible by 6 On the outside rim of a circular disk the integers from 1 to 30 are painted in random. Show that there must be three successive integers whose sum is at least 45

Principle of Strong Mathematical Induction Basis step may contains proofs for several initial values In inductive step the truth of the predicate P(n) is assumed for all values through k-1, then the truth of P(k) is proved. Let P(n) be a predicate that is defined for integers n and let a and b be fixed integers with a  b. Suppose the following two premises are true: P(a), P(a+1), P(a+2), …, and P(b) are true (basis step) For any integer k  b, if P(i) is true for all integers i with a  i  k, then P(k) is true (inductive step) then the following conclusion is true as well P(n) is true for all n  a

Applying Strong Mathematical Induction Prove that any integer greater than 1 is divisible by a prime number P(n): n is divisible by a prime number where n  2 Step 1: Show that the property is true for n=2 The property is true for n=2 because 2 is a prime number and 2 is divisible by 2 Step 2: Show that for all integers k  2, if the property true for all i with 2  i  k, then it is true for k For all integers i with 2  i  k, i is divisible by a prime number. (induction hypothesis)

Applying Strong Mathematical Induction (2) Either k is a prime or not. If k is a prime, k is divisible by a prime number, namely itself. If k is not a prime, then k = ab, where a and b are integers with 2  a  k and 2  b  k. By inductive hypothesis, a is divisible by a prime number p, and so by transitivity of divisibility (pg151), k is also divisible by p.  Hence regardless of whether k is a prime or not, k is divisible by a prime number

Divisibility (pg 148) Integer n is divisible by an integer d, when k  Z, n = d * k, for some integer k Notation: d | n Synonymous statements: n is a multiple of d d is a factor of n d is a divisor of n d divides n Eg: If a and b are integers, is 3a + 3b divisible by 3? Yes. By distributive law, 3a + 3b = 3(a+b) and a+b is an integer because it is a sum of 2 integers

Divisibility (pg 148) Divisibility is transitive: for all integers a, b, c, if a divides b and b divides c, then a divides c We need to show a | c or in other words c = a*k (k is some integer) a | b or b = a*r; and b | c or c = b*s (r and s are some integers) c = b*s =(a*r)*s =a(rs) Let k = rs, therefore a divides c by definition of divisibility

Exercises Prove or provide counterexample: For integers a, b, c: (a | b)  (a | bc) For integers a, b, c: (a | (b + c))  (a | b  a | c) If 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * m = 151 * 150 * 149 * 148 * 147 * 146 * 145 * 144 * 143, does 151 | m? Show that an integer is divisible by 9 iff the sum of its digits is divisible by 9. Prove the same for divisibility by 3. Show that an integer is divisible by 11 iff the alternate sum of its digits is divisible by 11

Fundamental Theorem of Arithmetic (pg 153) Given any integer n  1, the standard factored form of n, is an expression of the form where k is a positive integer; p1, p2, …, pk are prime numbers; e1, e2, …, ek are positive integers; and p1  p2  pk Eg: Write 3300 in standard factored form 3300= 2(1650) =22(825) =2231(275) = 223152(11) = 223152111

Fundamental Theorem of Arithmetic (pg 153) Number of positive divisors of n are (e1 + 1)(e2 + 1)…(ek + 1) Eg: 29, 338, 848,000 = 28 35 53 73 11. ∴ 29,338,848,000 has (8 + 1)(5 + 1)(3 + 1)(3 + 1)(1 + 1) = (9) (6) (4) (4) (2) = 1728 positive divisors.

The Division Algorithm (pg 190) For an integer a and a positive integer d, then there exists integers q and r such that a = dq + r and 0  r  d In quotient-remainder theorem, q=quotient and r=remainder Eg: Find the q and r of the division of 32 by 9 The q represents how many number 9’s contained in 32 The r is the number left over when all possible groups of 9 are subtracted 32 – 9 = 23  9, and 23 – 9 = 14  9, and 14 – 9 = 5  9 This shows that 3 groups of 9 can be subtracted from 32 with 5 leftover. Thus, q=3 and r=5

The Greatest Common Divisor The Euclidean Algorithm (pg 192) gcd of 2 integers a and b is the largest integers that divides both a and b (gcd of 12 and 30 is 6) Euclidean algorithm: An efficient way to compute the gcd for 2 integers Let a and b be integers that are not 0. The gcd(a, b) is that integer d with the following properties: d is a common divisor for both a and b or d|a and d|b For all integers c, if c|a and c|b, then c  d.

The Greatest Common Divisor The Euclidean Algorithm (pg 192) Lemma 1: if r is a positive integer, then gcd(r, 0) = r Lemma 2: if a = bq + r, then gcd(a, b) = gcd(b, r) So if a, b are 2 positive integers, division algorithm is apply as a = q1b + r1, 0  r1  b b = q2r1 + r2, 0  r2  r1 r1 = q3r2 + r3, 0  r3  r2 … ri = qi+2ri+1 + ri+2, 0  ri+2 + ri+1 ... rk-3 = qk-1rk-2 + rk-1, 0 < rk-1 < rk-2 rk-2 = qkrk-1 + rk, 0 < rk < rk-1 rk-1 = qk+1rk Then, rk , the last nonzero remainder , equals gcd(a, b)

Examples Using Euclidean algo, find gcd(330, 156) 330 = 156*2 + 18 156 = 18*8 +12 18 = 12*1 + 6 12 = 6*2 gcd(330, 156) = 6 Find gcd(250, 111)

Least Common Multiple For a, b, c  Z+, c is called a common multiple of a, b if c is a multiple of both a and b. Furthermore, c is the least common multiple of a, b if it is the smallest of all positive integers. We denote c by lcm(a, b).

Examples Eg: 12 = 34 lcm(3, 4) = lcm (4, 3) = 12 Eg: lcm(6, 15) = 30 not 90 For all n  Z+, we find that lcm(1, n) = lcm(n, 1) = n. When a, n  Z+, we have lcm(a, na) = na. If a, m, n  Z+ with m ≤ n, then lcm(am, an) = an. [And gcd(am, an) = am].

Least Common Multiple Theorem: Let a, b, c  Z+, with c = lcm(a, b). If d is a common multiple of a and b, then c|d. Theorem: For all a, b  Z+, ab = lcm(a, b)  gcd(a, b). Eg: gcd(250, 111) = 1. As a result we find that lcm(250, 111) = (250)(111) / 1 = 27,750 Eg: For all a, b  Z+, if a, b are relatively prime, then lcm(a, b) = ab. Eg: gcd(456, 624) = 24. lcm(456, 624) = (456)(624) / 24 = 11,856.

GCD and LCM If m, n  Z+, let and with each pi prime and 0 ≤ ei and 0 ≤ fi for all 1 ≤ i ≤ t. Then if ai = min{ei, fi}, the minimum (or smaller) of ei and, fi and bi = max { ei, fi }, the maximum (or larger) of ei and fi, for all 1 ≤ i ≤ t, we have

GCD and LCM Eg: Let m = 491,891,400 = 23 33 52 72 111 132 and Then with p1 = 2, p2 = 3, p3 = 5, p4 = 7, p5 = 11, p6 = 13, and p7 = 17, we find a1 = 2, a2 = 2, a3 = 0 (the exponent of 5 in the prime factorization of n must be 0, because 5 does not appear in the prime factorization), a4 = 1, a5 = 1, a6 = 2, and a7 = 0. So gcd(m, n) = 22 32 50 71 111 132 170 = 468,468. We also have lcm(m, n) = 23 33 52 72 112 133 171 = 1,195,787,993,400.

Correctness of Algorithms Assertions Pre-condition is a predicate describing initial state before an algorithm is executed Post-condition is a predicate describing final state after an algorithm is executed Loop guard Loop is defined as correct with respect to its pre- and post- conditions, if whenever the algorithm variables satisfy the pre-conditions and the loop is executed, then the algorithm satisfies the post-conditions as well

Loop Invariant Theorem Let a while loop with guard G be given together with its pre- and post- conditions. Let predicate I(n) describing loop invariant be given. If the following 4 properties hold, then the loop is correct: Basis Property: I(0) is true before the first iteration of the loop Inductive Property: If G and I(k) is true, then I(k + 1) is true Eventual Falsity of the Guard: After finite number of iterations, G becomes false Correctness of the Post-condition: If N is the least number of iterations after which G becomes false and I(N) is true, then post-conditions are true as well

Correctness of Some Algorithms Product Algorithm: pre-conditions: m  0, i = 0, product = 0 while (i < m) { product += x; i++; } post-condition: product = m * x

Correctness of Some Algorithms Division Algorithm pre-conditions: a  0, d > 0, r = a, q = 0 while (r  d) { r -= d; q++; } post-conditions: a = q * d + r, 0  r < d

Correctness of Some Algorithms Euclidean Algorithm pre-conditions: a > b  0, r = b while (b > 0) { r = a mod b; a = b; b = r; } post-condition: a = gcd(a, b)