8.1 CompSci 102© Michael Frank Today’s topics Integers & Number TheoryIntegers & Number Theory – –Sequences – –Summations Reading: Sections 3.2Reading:

Slides:



Advertisements
Similar presentations
1 Sequences Rosen 6 th ed., §2.4 2 Sequences A sequence represents an ordered list of elements.A sequence represents an ordered list of elements. e.g.,
Advertisements

Elementary Number Theory and Methods of Proof
Induction and recursion
CSE115/ENGR160 Discrete Mathematics 02/07/12
CSE115/ENGR160 Discrete Mathematics 02/21/12
Kavita Hatwal Fall Sequences and Induction.
1 Section 3.2 Sequences and Summations. 2 Sequence Function from a subset of Z (usually the set beginning with 1 or 0) to a set S a n denotes the image.
Lecture , 3.1 Methods of Proof. Last time in 1.5 To prove theorems we use rules of inference such as: p, p  q, therefore, q NOT q, p  q, therefore.
Induction and recursion
For a geometric sequence, , for every positive integer k.
Methods of Proof & Proof Strategies
MATH 224 – Discrete Mathematics
Lecture 9. Arithmetic and geometric series and mathematical induction
Induction and recursion
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
2015 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
Introduction to Proofs
2.4 Sequences and Summations
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
Section 1.8. Section Summary Proof by Cases Existence Proofs Constructive Nonconstructive Disproof by Counterexample Nonexistence Proofs Uniqueness Proofs.
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
CS 173, Lecture B August 27, 2015 Tandy Warnow. Proofs You want to prove that some statement A is true. You can try to prove it directly, or you can prove.
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
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.
Chapter 2 Mathematical preliminaries 2.1 Set, Relation and Functions 2.2 Proof Methods 2.3 Logarithms 2.4 Floor and Ceiling Functions 2.5 Factorial and.
Sequences and Summations
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
1 Sequences Rosen 6 th ed., §2.4 2 Sequences A sequence represents an ordered list of elements.A sequence represents an ordered list of elements. Formally:
Discrete math Bijections 2 A function f is a one-to-one correspondence, or a bijection or reversible, or invertible, iff it is both one-to-one and onto.
First Order Logic Lecture 2: Sep 9. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
Module #12: Summations Rosen 5 th ed., §3.2 Based on our knowledge on sequence, we can move on to summations easily.
강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
Sequences and Summations Section 2.4. Section Summary Sequences. – Examples: Geometric Progression, Arithmetic Progression Recurrence Relations – Example:
ICS 253: Discrete Structures I Induction and Recursion King Fahd University of Petroleum & Minerals Information & Computer Science Department.
CompSci 102 Discrete Math for Computer Science March 1, 2012 Prof. Rodger Slides modified from Rosen.
12 INFINITE SEQUENCES AND SERIES. In general, it is difficult to find the exact sum of a series.  We were able to accomplish this for geometric series.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
1 INFO 2950 Prof. Carla Gomes Module Induction Rosen, Chapter 4.
2014 년 봄학기 강원대학교 컴퓨터과학전공 문양세 이산수학 (Discrete Mathematics) 수열과 합 (Sequences and Summations)
Year 9 Proof Dr J Frost Last modified: 19 th February 2015 Objectives: Understand what is meant by a proof, and examples.
Section 3.2: Sequences and Summations. Def: A sequence is a function from a subset of the set of integers (usually the set of natural numbers) to a set.
Module #10: Proof Strategies Rosen 5 th ed., §3.1 (already covered)
Copyright © Zeph Grunschlag, Induction Zeph Grunschlag.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
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.
Chapter 2 1. Chapter Summary Sets The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions and sequences.
Based on Rosen, Discrete Mathematics & Its Applications, 5e Prepared by (c) Michael P. Frank Modified by (c) Haluk Bingöl 1/18 Module.
8.1 CompSci 102© Michael Frank Today’s topics Integers & Number TheoryIntegers & Number Theory – –More proof techniques – –Sequences – –Summations Reading:
Fall 2002CMSC Discrete Structures1 Chapter 3 Sequences Mathematical Induction Recursion Recursion.
CSE15 Discrete Mathematics 02/08/17
COT 3100, Spring 2001 Applications of Discrete Structures
Induction and recursion
Mathematical Induction Recursion
VCU, Department of Computer Science CMSC 302 Sequences and Summations Vojislav Kecman 9/19/2018.
Module #10: Proof Strategies
Rosen 5th ed., §3.2 ~19 slides, ~1 lecture
Rosen 5th ed., §3.2 ~19 slides, ~1 lecture
Rosen 5th ed., §3.2 ~9 slides, ~½ lecture
The Foundations: Logic and Proofs
Proving Existentials A proof of a statement of the form x P(x) is called an existence proof. If the proof demonstrates how to actually find or construct.
Induction and recursion
MA/CSSE 474 More Math Review Theory of Computation
Rosen 5th ed., §3.2 ~9 slides, ~½ lecture
Discrete Mathematics and its Applications
Module #10: Proof Strategies
Discrete Mathematics and its Applications
Discrete Mathematics and its Applications
Presentation transcript:

8.1 CompSci 102© Michael Frank Today’s topics Integers & Number TheoryIntegers & Number Theory – –Sequences – –Summations Reading: Sections 3.2Reading: Sections 3.2 UpcomingUpcoming –Induction

8.2 CompSci 102© Michael Frank Sequences A sequence or series {a n } is identified with a generating function f:S  A for some subset S  N and for some set A.A sequence or series {a n } is identified with a generating function f:S  A for some subset S  N and for some set A. –Often we have S=N or S=Z + =N  {0}. –Sequences may also be generalized to indexed sets, in which the set S does not have to be a subset of N. For general indexed sets, S may not even be a set of numbers at all.For general indexed sets, S may not even be a set of numbers at all. If f is a generating function for a series {a n }, then for n  S, the symbol a n denotes f(n), also called term n of the sequence.If f is a generating function for a series {a n }, then for n  S, the symbol a n denotes f(n), also called term n of the sequence. –The index of a n is n. (Or, often i is used.) A series is sometimes denoted by listing its first and/or last few elements, and using ellipsis (…) notation.A series is sometimes denoted by listing its first and/or last few elements, and using ellipsis (…) notation. –E.g., “{a n } = 0, 1, 4, 9, 16, 25, …” is taken to mean  n  N, a n = n 2.

8.3 CompSci 102© Michael Frank Sequence Examples Some authors write “the sequence a 1, a 2, …” instead of {a n }, to ensure that the set of indices is clear.Some authors write “the sequence a 1, a 2, …” instead of {a n }, to ensure that the set of indices is clear. –Be careful: Our book often leaves the indices ambiguous. An example of an infinite series:An example of an infinite series: –Consider the series {a n } = a 1, a 2, …, where (  n  1) a n = f(n) = 1/n. –Then, we have {a n } = 1, 1/2, 1/3, …

8.4 CompSci 102© Michael Frank Example with Repetitions Like tuples, but unlike sets, a sequence may contain repeated instances of an element.Like tuples, but unlike sets, a sequence may contain repeated instances of an element. Consider the sequence {b n } = b 0, b 1, … (note that 0 is an index) where b n = (  1) n.Consider the sequence {b n } = b 0, b 1, … (note that 0 is an index) where b n = (  1) n. –Thus, {b n } = 1,  1, 1,  1, … Note repetitions!Note repetitions! –This {b n } denotes an infinite sequence of 1’s and  1’s, not the 2-element set {1,  1}.

8.5 CompSci 102© Michael Frank Recognizing Sequences Sometimes, you’re given the first few terms of a sequence,Sometimes, you’re given the first few terms of a sequence, –and you are asked to find the sequence’s generating function, –or a procedure to enumerate the sequence. Examples: What’s the next number?Examples: What’s the next number? –1,2,3,4,… –1,3,5,7,9,… –2,3,5,7,11,... 5 (the 5th smallest number >0) 11 (the 6th smallest odd number >0) 13 (the 6th smallest prime number)

8.6 CompSci 102© Michael Frank What are Strings, Really? This book says “finite sequences of the form a 1, a 2, …, a n are called strings”,This book says “finite sequences of the form a 1, a 2, …, a n are called strings”, –but infinite strings are also discussed sometimes. Strings are normally restricted to sequences composed of symbols drawn from a finite alphabet, and are often indexed from 0 or 1.Strings are normally restricted to sequences composed of symbols drawn from a finite alphabet, and are often indexed from 0 or 1. –But these are really arbitrary restrictions also. Either way, the length of a (finite) string is just its number of terms (or of distinct indices).Either way, the length of a (finite) string is just its number of terms (or of distinct indices).

8.7 CompSci 102© Michael Frank Strings, more formally Let  be a finite set of symbols, i.e. an alphabet.Let  be a finite set of symbols, i.e. an alphabet. –A string s over alphabet  is any sequence {s i } of symbols, s i , normally indexed by N or N  {0}. If a, b, c, … are symbols, the string s = a, b, c, … can also be written abc…(i.e., without commas).If a, b, c, … are symbols, the string s = a, b, c, … can also be written abc…(i.e., without commas). If s is a finite string and t is any string, then the concatenation of s with t, written just st,If s is a finite string and t is any string, then the concatenation of s with t, written just st, –is simply the string consisting of the symbols in s, in sequence, followed by the symbols in t, in sequence.

8.8 CompSci 102© Michael Frank More Common String Notations The length |s| of a finite string s is its number of positions (i.e., its number of index values i).The length |s| of a finite string s is its number of positions (i.e., its number of index values i). If s is a finite string and n  N,If s is a finite string and n  N, –Then s n denotes the concatenation of n copies of s.  or “” denotes the empty string, the string of length 0.  or “” denotes the empty string, the string of length 0. –This is fairly common, but the book uses λ instead. If  is an alphabet and n  N,  n :  {s | s is a string over  of length n}, and  * :  {s | s is a finite string over  }.If  is an alphabet and n  N,  n :  {s | s is a string over  of length n}, and  * :  {s | s is a finite string over  }.

8.9 CompSci 102© Michael Frank Summation Notation Given a series {a n }, an integer lower bound (or limit) j  0, and an integer upper bound k  j, then the summation of {a n } from j to k is written and defined as follows:Given a series {a n }, an integer lower bound (or limit) j  0, and an integer upper bound k  j, then the summation of {a n } from j to k is written and defined as follows: Here, i is called the index of summation.Here, i is called the index of summation.

8.10 CompSci 102© Michael Frank Example: Impress Your Friends Boast, “I’m so smart; give me any 2-digit number n, and I’ll add all the numbers from 1 to n in my head in just a few seconds.”Boast, “I’m so smart; give me any 2-digit number n, and I’ll add all the numbers from 1 to n in my head in just a few seconds.” I.e., Evaluate the summation:I.e., Evaluate the summation: There is a simple closed-form formula for the result, discovered by Euler at age 12!There is a simple closed-form formula for the result, discovered by Euler at age 12! –And frequently rediscovered by many… Leonhard Euler ( )

8.11 CompSci 102© Michael Frank Euler’s Trick, Illustrated Consider the sum: 1+2+…+(n/2)+((n/2)+1)+…+(n-1)+nConsider the sum: 1+2+…+(n/2)+((n/2)+1)+…+(n-1)+n We have n/2 pairs of elements, each pair summing to n+1, for a total of (n/2)(n+1).We have n/2 pairs of elements, each pair summing to n+1, for a total of (n/2)(n+1). … n+1

8.12 CompSci 102© Michael Frank Symbolic Derivation of Trick For case where n is even…

8.13 CompSci 102© Michael Frank Concluding Euler’s Derivation So, you only have to do 1 easy multiplication in your head, then cut in half.So, you only have to do 1 easy multiplication in your head, then cut in half. Also works for odd n (prove this at home).Also works for odd n (prove this at home).

8.14 CompSci 102© Michael Frank Example: Geometric Progression A geometric progression is a series of the form a, ar, ar 2, ar 3, …, ar k, where a,r  R.A geometric progression is a series of the form a, ar, ar 2, ar 3, …, ar k, where a,r  R. The sum of such a series is given by:The sum of such a series is given by: We can reduce this to closed form via clever manipulation of summations...We can reduce this to closed form via clever manipulation of summations...

8.15 CompSci 102© Michael Frank Here we go...Here we go... Geometric Sum Derivation

8.16 CompSci 102© Michael Frank Derivation example cont...

8.17 CompSci 102© Michael Frank Concluding long derivation...

8.18 CompSci 102© Michael Frank Nested Summations These have the meaning you’d expect.These have the meaning you’d expect. Note issues of free vs. bound variables, just like in quantified expressions, integrals, etc.Note issues of free vs. bound variables, just like in quantified expressions, integrals, etc.

8.19 CompSci 102© Michael Frank Some Shortcut Expressions Geometric series. Euler’s trick. Quadratic series. Cubic series.

8.20 CompSci 102© Michael Frank Using the Shortcuts Example: Evaluate.Example: Evaluate. –Use series splitting. –Solve for desired summation. –Apply quadratic series rule. –Evaluate.

8.21 CompSci 102© Michael Frank Stone Game Example Game rules:Game rules: –There are 15 stones in a pile. Two players take turns removing either 1, 2, or 3 stones. Whoever takes the last stone wins. Theorem: There is a strategy for the first player that guarantees him a win.Theorem: There is a strategy for the first player that guarantees him a win. How do we prove this? Constructive proof…How do we prove this? Constructive proof… –Looks complicated… How do we pick out the winning strategy from among all possible strategies? Work backwards from the endgame!Work backwards from the endgame! Example 2

8.22 CompSci 102© Michael Frank Working Backwards in the Game Player 1 wins if it is player 2’s turn and there are no stones…Player 1 wins if it is player 2’s turn and there are no stones… P1 can arrange this if it is his turn, and there are 1, 2, or 3 stones…P1 can arrange this if it is his turn, and there are 1, 2, or 3 stones… This will be true as long as player 2 had 4 stones on his turn…This will be true as long as player 2 had 4 stones on his turn… And so on…And so on… Player 1 Player 2 0 1, 2, 3 4 5, 6, 7 8 9, 10, , 14, 15

8.23 CompSci 102© Michael Frank “Forwardized” version Theorem. Whoever moves first can always force a win.Theorem. Whoever moves first can always force a win. –Proof. Player 1 can remove 3 stones, leaving 12. After player 2 moves, there will then be either 11, 10, or 9 stones left. In any of these cases, player 1 can then reduce the number of stones to 8. Then, player 2 will reduce the number to 7, 6, or 5. Then, player 1 can reduce the number to 4. Then, player 2 must reduce them to 3, 2, or 1. Player 1 then removes the remaining stones and wins.

8.24 CompSci 102© Michael Frank Proof by Cases Example Theorem:  n  Z ¬(2|n  3|n) → 24|(n 2 −1)Theorem:  n  Z ¬(2|n  3|n) → 24|(n 2 −1) –Proof: Since 2·3=6, the value of n mod 6 is sufficient to tell us whether 2|n or 3|n. If (n mod 6)  {0,3} then 3|n; if it is in {0,2,4} then 2|n. Thus (n mod 6)  {1,5}. Case #1: If n mod 6 = 1, then (  k) n=6k+1. n 2 =36k 2 +12k+1, so n 2 −1=36k 2 +12k = 12(3k+1)k. Note 2|(3k+1)k since either k or 3k+1 is even. Thus 24|(n 2 −1).Case #1: If n mod 6 = 1, then (  k) n=6k+1. n 2 =36k 2 +12k+1, so n 2 −1=36k 2 +12k = 12(3k+1)k. Note 2|(3k+1)k since either k or 3k+1 is even. Thus 24|(n 2 −1). Case #2: If n mod 6 = 5, then n=6k+5. n 2 −1 = (n−1)·(n+1) = (6k+4)·(6k+6) = 12·(3k+2)·(k+1). Either k+1 or 3k+2 is even. Thus, 24|(n 2 −1).Case #2: If n mod 6 = 5, then n=6k+5. n 2 −1 = (n−1)·(n+1) = (6k+4)·(6k+6) = 12·(3k+2)·(k+1). Either k+1 or 3k+2 is even. Thus, 24|(n 2 −1). Example 3

8.25 CompSci 102© Michael Frank Proof by Examples? A universal statement can never be proven by using examples, unless the universe can be validly reduced to only finitely many examples, and your proof covers all of them!A universal statement can never be proven by using examples, unless the universe can be validly reduced to only finitely many examples, and your proof covers all of them! Theorem: ¬  x,y  Z: x 2 +3y 2 = 8.Theorem: ¬  x,y  Z: x 2 +3y 2 = 8. –Proof: If |x|≥3 or |y|≥2 then x 2 +3y 2 >8. This leaves x 2  {0,1,4} and 3y 2  {0,3}. The largest pair sum to 4+3 = 7 8. This leaves x 2  {0,1,4} and 3y 2  {0,3}. The largest pair sum to 4+3 = 7 < 8. Example 4

8.26 CompSci 102© Michael Frank A Constructive Existence Proof Theorem: For any integer n>0, there exists a sequence of n consecutive composite integers.Theorem: For any integer n>0, there exists a sequence of n consecutive composite integers. Same statement in predicate logic:  n>0  x  i (1  i  n)  (x+i is composite)Same statement in predicate logic:  n>0  x  i (1  i  n)  (x+i is composite) Proof follows on next slide…Proof follows on next slide… Example 7

8.27 CompSci 102© Michael Frank The proof... Given n>0, let x = (n + 1)! + 1.Given n>0, let x = (n + 1)! + 1. Let i  1 and i  n, and consider x+i.Let i  1 and i  n, and consider x+i. Note x+i = (n + 1)! + (i + 1).Note x+i = (n + 1)! + (i + 1). Note (i+1)|(n+1)!, since 2  i+1  n+1.Note (i+1)|(n+1)!, since 2  i+1  n+1. Also (i+1)|(i+1). So, (i+1)|(x+i).Also (i+1)|(i+1). So, (i+1)|(x+i).  x+i is composite.  x+i is composite.   n  x  1  i  n : x+i is composite. Q.E.D.   n  x  1  i  n : x+i is composite. Q.E.D.

8.28 CompSci 102© Michael Frank Nonconstructive Existence Proof Theorem: There are infinitely many prime numbers.Theorem: There are infinitely many prime numbers. –Any finite set of numbers must contain a maximal element, so we can prove the theorem if we can just show that there is no largest prime number. –I.e., show that for any prime number, there is a larger number that is also prime. –More generally: For any number,  a larger prime. –Formally: Show  n  p>n : p is prime.

8.29 CompSci 102© Michael Frank The proof, using proof by cases... Given n>0, prove there is a prime p>n.Given n>0, prove there is a prime p>n. Consider x = n!+1. Since x>1, we know that (x is prime)  (x is composite).Consider x = n!+1. Since x>1, we know that (x is prime)  (x is composite). Case 1: Suppose x is prime. Obviously x>n, so let p=x and we’re done.Case 1: Suppose x is prime. Obviously x>n, so let p=x and we’re done. Case 2: x has a prime factor p. But if p  n, then p mod x = 1. So p>n, and we’re done.Case 2: x has a prime factor p. But if p  n, then p mod x = 1. So p>n, and we’re done.

8.30 CompSci 102© Michael Frank Adapting Existing Proofs Theorem: There are infinitely many primes of the form 4k+3, where k  N.Theorem: There are infinitely many primes of the form 4k+3, where k  N. –Recall we proved there are infinitely many primes because if p 1,…,p n were all the primes, then (∏p i )+1 must be prime or have a prime factor greater than p n,  contradiction! –Proof: Similarly, suppose q 1,…,q n lists all primes of the form 4k+3, and analogously consider Q = 4(∏q i )+3.and analogously consider Q = 4(∏q i )+3. –Unfortunately, since q 1 = 3 is possible, 3|Q and so Q does have a prime factor among the q i, so this doesn’t work! So instead, consider Q = 4(∏q i )−1 = 4(∏q i −1)+3. This has the right form, and has no q i as a factor since  i: Q ≡ −1 (mod q i ).So instead, consider Q = 4(∏q i )−1 = 4(∏q i −1)+3. This has the right form, and has no q i as a factor since  i: Q ≡ −1 (mod q i ). Example 5

8.31 CompSci 102© Michael Frank Conjecture and Proof We know that some numbers of the form 2 p −1 are prime when p is prime.We know that some numbers of the form 2 p −1 are prime when p is prime. –These are called the Mersenne primes. Can we prove the inverse, that a n −1 is composite whenever either a>2, or (a=2 but n is composite)?Can we prove the inverse, that a n −1 is composite whenever either a>2, or (a=2 but n is composite)? –All we need is to find a factor greater than 1. Note a n −1 factors into (a−1)(a n−1 +…+a+1).Note a n −1 factors into (a−1)(a n−1 +…+a+1). –When a>2, (a−1)>1, and so we have a factor. –When n is composite,  r,s>1: n=rs. Thus, given a=2, a n = 2 n = 2 rs = (2 r ) s, and since r>1, 2 r > 2 so 2 n − 1 = b s −1 with b = 2 r > 2, which now fits the first case. Example 6

8.32 CompSci 102© Michael Frank Conjecture & Counterexamples Conjecture:  integers n>0, n 2 −n+41 is prime.Conjecture:  integers n>0, n 2 −n+41 is prime. –Hm, let’s see if we can find any counter-examples: 1 2 −1+41 = 41 (prime)1 2 −1+41 = 41 (prime) 2 2 −2+41 = 4−2+41 = 43 (prime)2 2 −2+41 = 4−2+41 = 43 (prime) 3 2 −3+41 = 9−3+41 = 47 (prime) Looking good so far!!3 2 −3+41 = 9−3+41 = 47 (prime) Looking good so far!! –Can we conclude after showing that it checks out in, say, 20 or 30 cases, that the conjecture must be true? NEVER NEVER NEVER NEVER NEVER!NEVER NEVER NEVER NEVER NEVER! –Of course, 41 2 −41+41 is divisible by 41!! Example 8