Professional Documents
Culture Documents
Niloufar Shafiei
Sequences
1
Sequences
A sequence is a function from a subset of the set
integers (usually {0,1,2,…} or {1,2,3,…}) to a set S.
i ai
AZ B
2
Sequences (example)
Consider is the sequence {n2}.
The list of the terms of this sequence is :
1,4,9,16,…
3
Geometric progression
A geometric progression is a sequence of the form
4
Geometric progression (example)
Is {(-1)n} geometric progression?
1,-1,1,-1,…
Yes, a=1 and r=-1
6
Arithmetic progression (example)
Is {-1+4n} Arithmetic progression?
-1,3,7,11,…
Yes, a=-1 and d=4
7
String
Finite sequences of form a1,a2,…,an are called
strings.
Example:
‘abcd’ is a string of length four.
8
Sequences (example)
Find a formula for the following sequence.
1, 1/2, 1/4, 1/8, 1/16, …
Solution:
{1/2n}
It is a geometric progression.
a=1 and r=1/2
9
Sequences (example)
Find formula for the following sequence.
1, 3, 5, 7, 9, …
Solution:
{1+2n}
It is an arithmetic progression.
a=1 and d=2
10
Sequences (example)
Find formula for the following sequence.
1, -1, 1, -1, 1, …
Solution:
{(-1)n}
It is a geometric progression.
a=1 and r=-1
11
Sequences (example)
How can you produce the terms of the
following sequence?
1, 2, 2, 3, 3, 3, 4, 4, 4, 4, …
Solution:
A rule for generating this sequence is that
integer n appears exactly n times.
12
Sequences (example)
How can you produce the terms of the following
sequence?
5, 11, 17, 23, 29, 35, 41, …
Solution:
A rule for generating this sequence is 5+6(n).
It is an arithmetic progression.
a=5 and d=6
13
Useful sequences
{n2 }
1, 4, 9, 16, 25, 36, 49, …
{n3 }
1,8,27,64,125,216,343,512,…
{2n }
2,4,8,16,32,64,128,256,…
{3n }
3,9,27,81,243,729,2187,…
14
Sequences (example)
Find formula for the following sequence.
1, 7, 25, 79, 241, 727, 2185, …
Solution:
Compare it to {3n}.
{3n-2 }
15
Summations
The sum of the terms am, am+1, …, an from the
sequence {an} is:
am+ am+1+ …+ an
n
aj
j=m
mjn aj
Solution:
100
1/k
k=1
17
Summations (example)
3
What is the value of i2
i=1
Solution:
3
i2 = 1 + 4 + 9 = 14
i=1
18
Shifting the index of summation
Sometimes it is useful to shift the index of summation.
For example:
3
Consider i2.
i=1
(5 + 10 + 15) + (1 + 4 + 9) =
30 + 14 =
44
22
Sums of terms of geometric
progression
n
(arn+1 - a) / (r-1) if r 1
arj =
j=0
(n + 1)a if r=1
23
Sums of terms of geometric
progression
Proof: n
Let S = arj.
j=0
n
rS = r arj
j=0
(multiply both sides by r)
n
= arj+1
j=0 (by the distributive property)
n+1
= ark (shifting the index of summation)
k=1 24
Sums of terms of geometric
progression
Proof: n
rS = ( ark ) + (arn+1 - a)
k=0 (removing k=n+1 term and adding k=0 term)
= S + (arn+1 - a)
rS = S + (arn+1 - a)
S = (arn+1 - a) / (r - 1) (if r 1 )
n
If r = 1, then S = arj = (n+1)a
j=0 25
Double summation
Double summations are used in the analysis of
nested loops in computer programs.
For example:
loop 1: for i=1 to 4
loop 2: for j=1 to 3
x=x+1
4 3
1
i=1 j=1
26
Double summation (example)
To evaluate the double summation, first expand the inner
summation and then continue by computing the outer
summation
4 3
i(j) =
i=1 j=1
i(1 + 2 + 3) =
(i + 2i + 3i) =
(1+2+3) + (2+4+6) + (3+6+9) + (4+8+12) =
9 + 12 + 18 + 24 = 60
27
Summations and functions
The summation notation can be used to add
some values of a function.
Example:
Assume f(x) = x+2. f(x) = ?
x{2,3,5}
28
Useful summation formula
n
ark (r 0 ) (arn+1 - a) / (r-1) , (r 1 )
k=0
n
k n(n+1) / 2
k=1
n
k2 n(n+1)(2n+1) / 6
k=1
29
Useful summation formula
n
k3 n2(n+1)2 / 4
k=1
30
Useful summation formula
(example)
100
Find k2.
k=50
Solution:
k2 = 100 49
k2 - k2 =
k=1 k=1
1 a
2 b
3 c
d
4
A B
32
Cardinality
A set that is either finite or has the same cardinality as the
set of positive integers is called countable.
33
Cardinality (example)
Show that the set of odd integers is a countable set.
Solution:
Show it has the same cardinality as positive integers.
(There is a bijection from positive integers to odd
integers.)
f(n) = 2n-1
1 1
2 3
5
3
:
:
34
Cardinality (example)
Show that the set of positive rational numbers is a countable set.
Solution:
Show it has the same cardinality as positive integers. (There is a
bijection from positive integers to odd integers.)
f(n) = 2n-1
Assume f(n)=f(m).
2n-1 = 2m-1
So, n=m.
So, f is one-to-one.
Assume m is an integer.
f(m) = 2m -1 = n.
n that is odd integer and f(m)=n.
So, f is onto. Thus, f is bijection.
35
Recommended exercises
3,5,13,15,17,19,20,27, 31,33,35,37,40
36