Discrete Mathematics and Applications Chapter 5: Sequences, Mathematical Induction and Recursion 5.1 Sequences Yan Zhang (yzhang16@usf.edu) Department of Computer Science and Engineering, USF Sequences • A sequence is a function. • Function 𝑓 ∶ 𝐴 → 𝐵 – Every element 𝑥 in 𝐴 is mapped to only one element 𝑦 in 𝐵, such that (𝑥, 𝑦) ∈ 𝑓. Domain: A 𝑓∶ 𝐴 → 𝐵 Codomain: B Not allowed 2 Sequences Definition • A sequence is a function. • Domain is either all the integers between two given integers or all the integers greater than or equal to a given integer. Finite sequences: 𝑎𝑚 , 𝑎𝑚+1 , 𝑎𝑚+2 , ⋯ , 𝑎𝑛 Domain 𝑚 𝑚+1 𝑚+2 ⋯ 𝑛 Codomain 𝑎𝑚 𝑎𝑚+1 𝑎𝑚+2 ⋯ 𝑎𝑛 Infinite sequences: 𝑎𝑚 , 𝑎𝑚+1 , 𝑎𝑚+2 , ⋯ Domain 𝑚 𝑚+1 𝑚+2 ⋯ Codomain 𝑎𝑚 𝑎𝑚+1 𝑎𝑚+2 ⋯ 𝑎𝑘 (read “𝑎 sub 𝑘”) is called a term. 𝑘 in 𝑎𝑘 is called a subscript or index. Initial term: 𝑎𝑚 Final term: 𝑎𝑛 3 Sequence Example 1 Finding Terms of Sequences Given by Explicit Formulas Define sequences 𝑎1, 𝑎2, 𝑎3, … and 𝑏2, 𝑏3, 𝑏4, … by the following explicit formulas: Compute the first five terms of both sequences. Solution: 𝑎1 = 𝑏2 = 1 1+1 2−1 2 1 2 1 , 2 2 2 = , 2+1 3 3−1 2 = , 3 3 3 3 = , 3+1 4 4−1 3 = , 4 4 = , 𝑎2 = 𝑎3 = 𝑎4 = = 𝑏4 = 𝑏5 = 𝑏3 = 4 4 = , 4+1 5 5−1 4 = , 5 5 𝑎5 = 𝑏6 = 5 5 = 5+1 6 6−1 5 = 6 6 Note: all terms of both sequences are identical. 4 Sequence Example 2 Finding an Explicit Formulas to Fit Given Initial Terms Find an explicit formula for a sequence that has the following initial terms: 1 1 1 1 1 1, − , , − , , − , ⋯ 4 9 16 25 36 Solution: • Denote the general term of the sequence by 𝑎𝑘 and suppose the first term is 𝑎1 . 𝑎1 = 1 , 12 𝑎2 = (−1) 1 , 22 𝑎3 = 1 , 32 𝑎4 = (−1) 1 , 42 𝑎5 = 1 ,𝑎 52 6 = (−1) 1 62 • An explicit formulator that gives the correct first six terms is: 1 𝑘+1 𝑎𝑘 = (−1) 𝑘2 5 Summation Notation Given a sequence 𝑎𝑚 , 𝑎𝑚+1 , 𝑎𝑚+2 , ⋯ , 𝑎𝑛 , Domain 𝑚 𝑚+1 𝑚+2 ⋯ 𝑛 Codomain 𝑎𝑚 𝑎𝑚+1 𝑎𝑚+2 ⋯ 𝑎𝑛 The summation from 𝑘 equals 𝑚 to 𝑛 of 𝑎-sub-𝑘: 𝑛 𝑘=𝑚 𝑎𝑘 = 𝑎𝑚 + 𝑎𝑚+1 + ⋯ +𝑎𝑛 Summation notation Expanded form 𝑘: the index of the summation 𝑚: the lower limit of the summation 𝑛: the upper limit of the summation 6 Summation Example – Computing Summations Let 𝑎1 = −2, 𝑎2 = −1, 𝑎3 = 0, 𝑎4 = 1, and 𝑎5 = 2. Compute the following: a. 5 𝑘=1 𝑎𝑘 5 𝑎𝑘 = 𝑎1 + 𝑎2 + 𝑎3 + 𝑎4 + 𝑎5 = −2 + −1 + 0 + 1 + 2 = 0 𝑘=1 b. c. 2 𝑘=2 𝑎𝑘 2 𝑘=2 𝑎𝑘 = 𝑎2 = −1 2 𝑘=1 𝑎2𝑘 2 𝑘=1 𝑎2𝑘 = 𝑎2 + 𝑎4 = −1 + 1 = 0 7 Summation Example – Changing from Summation Notation to Expanded Form Write the following summation in expanded form: Solution: 8 Summation Example – Changing from Expanded Form to Summation Notation Express the following using summation notation: Solution: The general term of this summation can be expressed as for integers k from 0 to n. Hence 9 Summation Notation - Recursive Definition If 𝑚 is any integer and 𝑚 < 𝑛, then 𝑚 𝑎𝑘 = 𝑎𝑚 𝑘=𝑚 𝑚+1 𝑚 𝑎𝑘 = 𝑎𝑘 + 𝑎𝑚+1 𝑘=𝑚 𝑘=𝑚 𝑚+2 𝑚+1 𝑎𝑘 = 𝑘=𝑚 𝑛 𝑎𝑘 + 𝑎𝑚+2 𝑘=𝑚 ⋯ 𝑛−1 𝑎𝑘 = 𝑘=𝑚 𝑎𝑘 + 𝑎𝑛 𝑘=𝑚 Recursive definition is useful to rewrite a summation, – by separating off the final term of a summation – by adding a final term to a summation. 10 Recursive Definition Example – Separating Off a Final Term and Adding On a Final Term a. Rewrite b. Write by separating off the final term. as a single summation. Solution: a. b. 11 Summation Notation - A Telescoping Sum • In certain sums each term is a difference of two quantities. For example: 𝑎𝑘 = 1 𝑘 1 − ,𝑘 𝑘+1 = 𝑚, ⋯ , 𝑛 • When you write such sums in expanded form, you sometimes see that all the terms cancel except the first and the last. 𝑎𝑘 + 𝑎𝑘+1 + 𝑎𝑘+2 1 1 1 1 1 1 = − + − + − 𝑘 𝑘+1 𝑘+1 𝑘+2 𝑘+2 𝑘+3 • Successive cancellation of terms collapses the sum like a telescope. 12 A Telescoping Sum Example Some sums can be transformed into telescoping sums, which then can be rewritten as a simple expression. For instance, observe that Use this identity to find a simple expression for 13 Product Notation Given a sequence 𝑎𝑚 , 𝑎𝑚+1 , 𝑎𝑚+2 , ⋯ , 𝑎𝑛 , Domain 𝑚 𝑚+1 𝑚+2 ⋯ 𝑛 Codomain 𝑎𝑚 𝑎𝑚+1 𝑎𝑚+2 ⋯ 𝑎𝑛 The product from 𝑘 equals 𝑚 to 𝑛 of 𝑎-sub-𝑘: 𝑛 𝑘=𝑚 𝑎𝑘 = 𝑎𝑚 ∙ 𝑎𝑚+1 ∙ ⋯ ∙ 𝑎𝑛 A recursive definition for the product notation is the following: If 𝑚 is any integer, then 14 Product Notation Example – Computing Products Compute the following products: a. b. Solution: a. b. 15 Properties of Summations and Products 16 Properties of Summation & Product Exercise Let 𝑎𝑘 = 𝑘 + 1 and 𝑏𝑘 = 𝑘 − 1 for all integers 𝑘. Write each of the following expressions as a single summation or product: a. b. 17 Properties of Summation & Product Exercise Solution: a. 18 Properties of Summation & Product Exercise Solution: b. 19 Change of Variable • The index symbol in a summation or product is internal to summation or product. • The index symbol can be replaced by any other symbol as long as the replacement is made in each location where the symbol occurs. 𝑛 𝑖=𝑚 𝑎𝑖 = 𝑛 𝑗=𝑚 𝑎𝑗 and 𝑛 𝑖=𝑚 𝑎𝑖 = 𝑛 𝑗=𝑚 𝑎𝑗 • As a consequence, the index of a summation or a product is called a dummy variable. • A dummy variable is a symbol that derives its entire meaning from its local context. Outside of that context, the symbol may have another meaning entirely. 20 Change of Variable Exercise 1 summation: change of variable: 21 Change of Variable Exercise 1 - Solution Solution: • First calculate the lower and upper limits of the new summation: Thus the new sum goes from j = 1 to j = 7. • Next calculate the general term of the new summation by replacing each occurrence of k by an expression in j : • Finally, put the steps together to obtain 22 Factorial Notation A recursive definition for factorial is the following: Given any nonnegative integer 𝑛, 23 Factorials Exercise Simplify the following expressions: a. b. c. d. Solution: a. e. d. e. b. 24 Factorials Exercise Solution c. 25 “n Choose r ” Notation Chose 2 objects from {a,b,c,d}: {a, b}, {a, c}, {a, d}, {b, c}, {b,d}, and {c, d}. 26 “n Choose r” Exercise Use the formula for computing expressions: a. b. to evaluate the following c. Solution: a. 27 “n Choose r” Exercise b. c. 28 n Choose r Properties • • • • • 𝑛 𝑘 𝑛 0 𝑛 𝑘 𝑛 𝑘 𝑛 𝑘 = = = = = 𝑛 for 0 ≤ 𝑘 ≤ 𝑛 𝑛−𝑘 𝑛 =1 𝑛 𝑛 𝑛−𝑘+1 for 𝑘 > 0 𝑘 𝑘−1 𝑛−1 𝑛 for 𝑘 < 𝑛 𝑛−𝑘 𝑘 𝑛−1 𝑛 for 𝑛, 𝑘 > 0 𝑘−1 𝑘 29 Exercise Prove that for all nonnegative integers 𝑛 and 𝑟 with 𝑟 + 1 ≤ 𝑛, 𝑛 𝑛−𝑟 𝑛 = . 𝑟+1 𝑟 𝑟+1 30 Exercise Prove that for all nonnegative integers 𝑛 and 𝑟 with 𝑟 + 1 ≤ 𝑛, 𝑛 𝑛−𝑟 𝑛 = . 𝑟+1 𝑟 𝑟+1 Hint: 𝑛−𝑟 𝑛 𝑛−𝑟 𝑛! = ∙ 𝑟 𝑟+1 𝑟 + 1 𝑟! 𝑛 − 𝑟 ! = 𝑛−𝑟 𝑟+1 = 𝑛! (𝑟+1)! 𝑛−𝑟−1 ! ∙ 𝑛! 𝑟! 𝑛−𝑟 ∙ 𝑛−𝑟−1 ! 𝑛 = 𝑟+1 31