sequences & summations cs 1050 rosen 3.2. sequence a sequence is a discrete structure used to...
TRANSCRIPT
![Page 1: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/1.jpg)
Sequences & Summations
CS 1050
Rosen 3.2
![Page 2: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/2.jpg)
Sequence
• A sequence is a discrete structure used to represent an ordered list.
• A sequence is a function from a subset of the set of integers (usually either the set {0,1,2,. . .} or {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 to represent sequence is {an}
![Page 3: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/3.jpg)
Examples
• {1, 1/2, 1/3, 1/4, . . .} or the sequence {an} where an = 1/n, nZ+ .
• {1,2,4,8,16, . . .} = {an} where an = 2n, nN.
• {12,22,32,42,. . .} = {an} where an = n2, nZ+
![Page 4: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/4.jpg)
Common SequencesArithmetic a, a+d, a+2d, a+3d, a+4d, …
n2 1, 4, 9, 16, 25, . . .
n3 1, 8, 27, 64, 125, . . .
n4 1, 16, 81, 256, 625, . . .
2n 2, 4, 8, 16, 32, . . .
3n 3, 9, 27, 81, 243, . . .
n! 1, 2, 6, 24, 120, . . .
![Page 5: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/5.jpg)
Summations• Notation for describing the sum of the terms am,
am+1, . . ., an from the sequence, {an}
n
am+am+1+ . . . + an = aj
j=m
• j is the index of summation (dummy variable)• The index of summation runs through all integers
from its lower limit, m, to its upper limit, n.
![Page 6: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/6.jpg)
Examples
j = ( j +1)j=0
4
∑j=1
5
∑ =1+2+3+4+5=15
1 j=1+1 2j=1
5
∑ +13+14+15
1+ 1 jj=2
5
∑ =1+1 2+1 3+1 4+15
![Page 7: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/7.jpg)
Summations follow all the rules of multiplication and addition!
c j= cj=j=1
n
∑j=1
n
∑ c(1+2+…+n) = c + 2c +…+ nc
r arjj=0
n
∑ = arj+1
j=0
n
∑ = arkk=1
n+1
∑ =
arn+1 + arkk=1
n
∑ =arn+1 −a+ arkk=0
n
∑
![Page 8: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/8.jpg)
Telescoping Sums
(ajj=1
n
∑ −aj−1) =(a1 −a0)+(a2 −a1) +
(a3 −a2)+...+(an −an−1) =an −a0
[k2
k=1
4
∑ −(k−1)2]=
(12 −02) +(22 −12)+(32 −22)+(42 −32)
42 =16−0=16
Example
![Page 9: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/9.jpg)
Closed Form Solutions
k=n(n+1)
2k=1
n
∑
A simple formula that can be used to calculate a sum without doing all the additions.
Example:
Proof: First we note that k2 - (k-1)2 = k2 - (k2-2k+1) = 2k-1. Since k2-(k-1)2 = 2k-1, then we can sum each side from k=1 to k=n
[k2
k=1
n
∑ − k−1( )2] = 2k−1( )
k=1
n
∑
![Page 10: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/10.jpg)
Proof (cont.)
[k2
k=1
n
∑ − k−1( )2] = 2k−1( )
k=1
n
∑
[k2
k=1
n
∑ − k−1( )2] = 2k+ −1( )
k=1
n
∑k=1
n
∑
n2 −02 =2 (k)+−nk=1
n
∑
n2 +n=2 (k)k=1
n
∑
kk=1
n
∑ =n2 +n
2
![Page 11: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/11.jpg)
Closed Form Solutions to Sumsj =0+1+...+n=n(n+1)/ 2
j=0
n
∑
j2j=0
n
∑ =02 +12 +...+n2 =n(n+1)(2n+1)/6
k3
k=1
n
∑ =n2 n+1( )2
4
arkk=0
n
∑ =arn+1 −ar −1
,r ≠1
![Page 12: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/12.jpg)
Double Summations
ij = ijj=1
3
∑⎡
⎣ ⎢ ⎤
⎦ ⎥ i=1
4
∑ = i+2i+3i( )i=1
4
∑j=1
3
∑i=1
4
∑ = 6i =i=1
4
∑
6+12+18+24=60
![Page 13: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/13.jpg)
Cardinality• Earlier we defined cardinality of a set as the
number of elements in the set. We can extend this idea to infinite sets.
• The sets A and B have the same cardinality if and only if there is a one-to-one correspondence from A to B.
• A set that is either finite or has the same cardinality as the set of natural numbers is called countable. A set that is not countable is called uncountable.
![Page 14: Sequences & Summations CS 1050 Rosen 3.2. Sequence A sequence is a discrete structure used to represent an ordered list. A sequence is a function from](https://reader035.vdocuments.us/reader035/viewer/2022072011/56649e245503460f94b11ed0/html5/thumbnails/14.jpg)
Cardinality• Cardinality of set of natural numbers?• An infinite set is countable if and only if it is
possible to list the elements in a sequence (indexed by the positive integers).– Why? A one-to-one correspondence f can be expressed
in terms of the sequence a1, a2, a3…., where a1 = f(1),
a2 =f(2), etc.– One-to-one correspondence for set of odd positive
integers (in terms of positive integers)?f(n) = 2n - 1