
CS 441 Discrete Mathematics for CS Lecture 10 Sequences and summations Milos Hauskrecht [email protected] 5329 Sennott Square CS 441 Discrete mathematics for CS M. Hauskrecht Sequences Definition: A sequence is a function from a subset of the set of integers (typically the set {0,1,2,...} or the set {1,2,3,...} to a set S. We use the notation an to denote the image of the integer n. We call an a term of the sequence. Notation: {an} is used to represent the sequence (note {} is the same notation used for sets, so be careful). {an} represents the ordered list a1, a2, a3, ... 1 2 3 4 5 6 …. a1 a2 a3 a4 a5 a6 …. {an} CS 441 Discrete mathematics for CS M. Hauskrecht 1 Sequences Examples: 2 • (1) an = n , where n = 1,2,3... – What are the elements of the sequence? 1, 4, 9, 16, 25, ... n • (2) an = (-1) , where n=0,1,2,3,... – Elements of the sequence? 1, -1, 1, -1, 1, ... n • 3) an = 2 , where n=0,1,2,3,... – Elements of the sequence? 1, 2, 4, 8, 16, 32, ... CS 441 Discrete mathematics for CS M. Hauskrecht Arithmetic progression Definition: An arithmetic progression is a sequence of the form a, a+d,a+2d, …, a+nd where a is the initial term and d is common difference, such that both belong to R. Example: •sn= -1+4n for n=0,1,2,3, … • members: -1, 3, 7, 11, … CS 441 Discrete mathematics for CS M. Hauskrecht 2 Geometric progression Definition A geometric progression is a sequence of the form: a, ar, ar2, ..., ark, where a is the initial term, and r is the common ratio. Both a and r belong to R. Example: n •an = ( ½ ) for n = 0,1,2,3, … members: 1,½, ¼, 1/8, ….. CS 441 Discrete mathematics for CS M. Hauskrecht Sequences • Given a sequence finding a rule for generating the sequence is not always straightforward Example: • Assume the sequence: 1,3,5,7,9, …. • What is the formula for the sequence? • Each term is obtained by adding 2 to the previous term. 1, 1+2=3, 3+2=5, 5+2=7 • What type of progression this suggest? CS 441 Discrete mathematics for CS M. Hauskrecht 3 Sequences • Given a sequence finding a rule for generating the sequence is not always straightforward Example: • Assume the sequence: 1,3,5,7,9, …. • What is the formula for the sequence? • Each term is obtained by adding 2 to the previous term. • 1, 1+2=3, 3+2=5, 5+2=7 • It suggests an arithmetic progression: a+nd with a=1 and d=2 •an=1+2n CS 441 Discrete mathematics for CS M. Hauskrecht Sequences • Given a sequence finding a rule for generating the sequence is not always straightforward Example 2: • Assume the sequence: 1, 1/3, 1/9, 1/27, … • What is the sequence? • The denominators are powers of 3. 1, 1/3= 1/3, (1/3)/3=1/(3*3)=1/9, (1/9)/3=1/27 • This suggests a geometric progression: ark with a=1 and r=1/3 • (1/3 )n CS 441 Discrete mathematics for CS M. Hauskrecht 4 Recursively defined sequences • The n-th element of the sequence {an} is defined recursively in terms of the previous elements of the sequence and the initial elements of the sequence. Example : •an = an-1 + 2 assuming a0 = 1; •a0 = 1; •a1 = 3; •a2 = 5; •a3 = 7; • Can you write an non-recursively using n? •an = 1 + 2n CS 441 Discrete mathematics for CS M. Hauskrecht Fibonacci sequence • Recursively defined sequence, where •f0 = 0; •f1 = 1; •fn = fn-1 + fn-2 for n = 2,3, … •f2 = 1 •f3 = 2 •f4 = 3 •f5 = 5 CS 441 Discrete mathematics for CS M. Hauskrecht 5 Summations Summation of the terms of a sequence: n a j a m a m 1 ... a n j m The variable j is referred to as the index of summation. • m is the lower limit and • n is the upper limit of the summation. CS 441 Discrete mathematics for CS M. Hauskrecht Summations Example: • 1) Sum the first 7 terms of {n2} where n=1,2,3, ... • 7 7 2 a j j 1 4 16 25 36 49 140 jj1 1 • 2) What is the value of 8 8 j a j ( 1) 1 ( 1) 1 ( 1) 1 1 kk4 4 CS 441 Discrete mathematics for CS M. Hauskrecht 6 Arithmetic series Definition: The sum of the terms of the arithmetic progression a, a+d,a+2d, …, a+nd is called an arithmetic series. Theorem: The sum of the terms of the arithmetic progression a, a+d,a+2d, …, a+nd is n n n(n 1) S (a jd) na d j na d j11j 2 • Why? CS 441 Discrete mathematics for CS M. Hauskrecht Arithmetic series Theorem: The sum of the terms of the arithmetic progression a, a+d,a+2d, …, a+nd is n n n(n 1) S (a jd) na d j na d j11j 2 Proof: n n n n S (a jd) a jd na d j j11j1 j j1 n j 1 2 3 4 .... (n 2) (n 1) n j1 CS 441 Discrete mathematics for CS M. Hauskrecht 7 Arithmetic series Theorem: The sum of the terms of the arithmetic progression a, a+d,a+2d, …, a+nd is n n n(n 1) S (a jd) na d j na d j11j 2 Proof: n n n n S (a jd) a jd na d j j11j1 j j1 n j 1 2 3 4 .... (n 2) (n 1) n j1 n+1 n+1 … n+1 n *(n 1) 2 CS 441 Discrete mathematics for CS M. Hauskrecht Arithmetic series 5 Example: S (2 j3) j1 5 5 2 j3 jj1 1 5 5 21 3 j jj1 1 5 2*5 3 j j1 (5 1) 10 3 *5 2 10 45 55 CS 441 Discrete mathematics for CS M. Hauskrecht 8 Arithmetic series 5 Example 2: S (2 j3) j3 5 2 (2 j3) (2 j3) Trick j1 j1 5 5 2 2 21 3 j 21 3 j jj1 1 jj1 1 5513 42 CS 441 Discrete mathematics for CS M. Hauskrecht Double summations 4 2 Example: S (2i j) ij1 1 4 2 2 2i j ij1 1 j 1 4 2 2 2i 1 j ijj1 1 1 4 2 2i*2 j ij1 1 4 2i*2 3 i1 4 4 4i 3 ii1 1 4 4 4i 3 1 4*10 3*4 28 ii1 1 CS 441 Discrete mathematics for CS M. Hauskrecht 9 Geometric series Definition: The sum of the terms of a geometric progression a, ar, ar2, ..., ark is called a geometric series. Theorem: The sum of the terms of a geometric progression a, ar, ar2, ..., arn is n n n1 j j r 1 S (ar ) a r a j00j r 1 CS 441 Discrete mathematics for CS M. Hauskrecht Geometric series Theorem: The sum of the terms of a geometric progression a, ar, 2 n ar , ..., ar is n n n1 j j r 1 S (ar ) a r a j00j r 1 Proof: n S ar j a ar ar 2 ar 3 ... ar n j0 • multiply S by r n rS rar j ar ar 2 ar 3 ... ar n1 j0 • Substract rS S ar ar 2 ar 3 ... ar n1 a ar ar 2.. ar n ar n1 a ar n1 a r n1 1 S a r 1 r 1 CS 441 Discrete mathematics for CS M. Hauskrecht 10 Geometric series Example: 3 S 2(5) j j0 General formula: n n n1 j j r 1 S (ar ) a r a j00j r 1 3 54 1 S 2(5) j 2* j0 5 1 625 1 624 2* 2* 2*156 312 4 4 CS 441 Discrete mathematics for CS M. Hauskrecht Infinite geometric series • Infinite geometric series can be computed in the closed form for x<1 • How? k k 1 n n x 1 1 1 x lim k x lim k n0 n0 x 1 x 1 1 x • Thus: 1 x n n 0 1 x CS 441 Discrete mathematics for CS M. Hauskrecht 11.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages11 Page
-
File Size-