Sequences
o Sequences represent ordered lists of elements.
o OR a list of elements usually written in a row.
• 1, 2, 3, 4, 5, …1, 1/2, 1/3, 1/4, 1/5, …
o A sequence is defined as a function from a subset
of N 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.
– N={1, 2, 3, …} /whole numbers {0, 1, 2, 3, …}.
– S: { 2 4 6 8 10 …}
– {an} =a1, a2, a3, a4 …, an, …
Explicit Formula
o It is convenient to describe a sequence with a
formula.
o S: { 2 4 6 8 10 …}
o an = 2n
o 1, 3, 5, 7, 9, … an = 2n – 1
o 2, 5, 10, 17, 26, … an = n2 + 1
o Find formula for
o
1 1 1 1 1 1 1
1 , , , ,
2 2 3 3 4 4 5
    L
1 1
for all integers 1
1
kb n
k k
  

ARITHMETIC SEQUENCE
o Every term after the first is obtained from the
preceding term by adding a constant number
o The difference of any two consecutive terms is
called the common difference d
o 5, 9, 13, 17, … d= 4
ARITHMETIC SEQUENCE
o Let a be the first term and d be the common difference
of an arithmetic sequence. Then the sequence is a,
a+d, a+2d, …
a1 = first term = a = a + (1-1) d
a2 = second term = a + d = a + (2-1) d
By symmetry
an = nth term = a + (n - 1)d for all integers n 1.
• 3, 9, 15, 21, …
Here a = 3
d = 9 - 3 = 6
n = 20
a20 = ?
Since an = a + (n - 1) d;
a20 = 3 + (20 - 1) 6
= 3 + 114
= 117
GEOMETRIC SEQUENCE
o Every term after the first is obtained from the
preceding term by multiplying it with a constant
number (called the common ratio “r”)is called a
geometric sequence or geometric progression
(G.P.).
1, 2, 4, 8, 16, … (common ratio = 2)
an = nth term = arn-1; for all integers n  1
a, ar, ar2, ar3, …
SEQUENCES IN COMPUTER
PROGRAMMING
o An important data type in computer programming consists
of finite sequences known as one-dimensional arrays;
o The names of k students in a class may be
represented by an array of k elements “name”
as:
name [0], name[1], name[2], …, name[k-1]
SERIES
o The sum of the terms of a sequence forms a series.
– If a1, a2, a3, … represent a sequence of numbers, then the
corresponding series is
– a1 + a2 + a3 + …
o Summations
• =am + am+1 + am+2 + … + an.
• j is called the index of summation,
running from its lower limit m to its
upper limit n.
o Compute 𝑗=1
4
𝑗2
1+4+9+16=30
o 𝑗=1
3
2𝑗 − 1 =1+3+5=9
Summation Notation to Expanded
Form
o Write expanded form of
1 ( 1) 1 ( 1) ( 1)
1 2 3 4 1
1 1 1 ( 1)
1
2 3 4 1
n
n
n
n
  
     


     

L
L
0 1 2 3
0
( 1) ( 1) ( 1) ( 1) ( 1) ( 1)
1 0 1 1 1 2 1 3 1 1
i nn
i i n
     
     
     
 L
Induction
oThe principle of mathematical induction is
a useful tool for proving that a certain
predicate is true for all natural numbers.
Induction
o If we have a propositional function P(n), and we want
to prove that P(n) is true for any natural number n, we
do the following:
1. Show that P(1) is true.
(basis step)
2. Show that if P(n) then P(n + 1) for any n  N.
(inductive step)
3. Then P(n) must be true for any n  N.
(conclusion)
Induction
1. Basis Step:
P(1) is true.
For n = 1, left hand side of P(1) is the sum of all the
successive integers starting at 1 and ending at 1,
so LHS = 1 and RHS is
1(1 1) 2
. . 1
2 2
R H S

  
( 1)
( ):1 2 3
2
n n
P n n

    L
Induction
2. Inductive Step: Suppose P(k) is true for,
some integers k  1
I.
To prove P(k + 1) is true. That is,
II.
( 1)
1 2 3
2
k k
k

    L
( 1)( 2)
1 2 3 ( 1)
2
k k
k
 
     L
Induction
Consider L.H.S. of (2)
Hence by principle of Mathematical Induction the given
result true for all integers greater or equal to 1
1 2 3 ( 1) 1 2 3 ( 1)
( 1)
( 1) using (1)
2
( 1) 1
2
2
( 1)
2
( 1)( 2)
RHS of (2)
2
k k k
k k
k
k
k
k
k
k k
           

  
 
    
 
    
 
 
L L
Induction
o 1+3+5+…+(2n -1) = n2 for all integers n ≥1.
o Let P(n) be the equation 1+3+5+…+(2n -1) = n2
o Show that P(1) is true.
(basis step)
For n = 1, L.H.S of P(1) = 1 and
R.H.S =2(1)-1 = 1
Hence the equation is true for n = 1
Induction
o Suppose P(k) is true for some integer k ≥ 1.
(inductive step)
1 + 3 + 5 + … + (2k - 1) = k2 …………………(1)
To prove P(k+1) is true; i.e.,
1 + 3 + 5 + … +[2(k+1)-1] = (k+1)2 ………….……(2)
Consider L.H.S. of (2)
Thus P(k+1) is also true. Hence by mathematical induction, the given
equation is true for all integers n ≥ 1
2
2
1 3 5 [2( 1) 1] 1 3 5 (2 1)
1 3 5 (2 1) (2 1)
(2 1) using (1)
( 1)
R.H.S. of (2)
k k
k k
k k
k
           
       
  
 

L L
L

Sequences

  • 2.
    Sequences o Sequences representordered lists of elements. o OR a list of elements usually written in a row. • 1, 2, 3, 4, 5, …1, 1/2, 1/3, 1/4, 1/5, … o A sequence is defined as a function from a subset of N 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. – N={1, 2, 3, …} /whole numbers {0, 1, 2, 3, …}. – S: { 2 4 6 8 10 …} – {an} =a1, a2, a3, a4 …, an, …
  • 3.
    Explicit Formula o Itis convenient to describe a sequence with a formula. o S: { 2 4 6 8 10 …} o an = 2n o 1, 3, 5, 7, 9, … an = 2n – 1 o 2, 5, 10, 17, 26, … an = n2 + 1 o Find formula for o 1 1 1 1 1 1 1 1 , , , , 2 2 3 3 4 4 5     L 1 1 for all integers 1 1 kb n k k    
  • 4.
    ARITHMETIC SEQUENCE o Everyterm after the first is obtained from the preceding term by adding a constant number o The difference of any two consecutive terms is called the common difference d o 5, 9, 13, 17, … d= 4
  • 5.
    ARITHMETIC SEQUENCE o Leta be the first term and d be the common difference of an arithmetic sequence. Then the sequence is a, a+d, a+2d, … a1 = first term = a = a + (1-1) d a2 = second term = a + d = a + (2-1) d By symmetry an = nth term = a + (n - 1)d for all integers n 1. • 3, 9, 15, 21, … Here a = 3 d = 9 - 3 = 6 n = 20 a20 = ? Since an = a + (n - 1) d; a20 = 3 + (20 - 1) 6 = 3 + 114 = 117
  • 6.
    GEOMETRIC SEQUENCE o Everyterm after the first is obtained from the preceding term by multiplying it with a constant number (called the common ratio “r”)is called a geometric sequence or geometric progression (G.P.). 1, 2, 4, 8, 16, … (common ratio = 2) an = nth term = arn-1; for all integers n  1 a, ar, ar2, ar3, …
  • 7.
    SEQUENCES IN COMPUTER PROGRAMMING oAn important data type in computer programming consists of finite sequences known as one-dimensional arrays; o The names of k students in a class may be represented by an array of k elements “name” as: name [0], name[1], name[2], …, name[k-1]
  • 8.
    SERIES o The sumof the terms of a sequence forms a series. – If a1, a2, a3, … represent a sequence of numbers, then the corresponding series is – a1 + a2 + a3 + … o Summations • =am + am+1 + am+2 + … + an. • j is called the index of summation, running from its lower limit m to its upper limit n. o Compute 𝑗=1 4 𝑗2 1+4+9+16=30 o 𝑗=1 3 2𝑗 − 1 =1+3+5=9
  • 9.
    Summation Notation toExpanded Form o Write expanded form of 1 ( 1) 1 ( 1) ( 1) 1 2 3 4 1 1 1 1 ( 1) 1 2 3 4 1 n n n n                   L L 0 1 2 3 0 ( 1) ( 1) ( 1) ( 1) ( 1) ( 1) 1 0 1 1 1 2 1 3 1 1 i nn i i n                    L
  • 10.
    Induction oThe principle ofmathematical induction is a useful tool for proving that a certain predicate is true for all natural numbers.
  • 11.
    Induction o If wehave a propositional function P(n), and we want to prove that P(n) is true for any natural number n, we do the following: 1. Show that P(1) is true. (basis step) 2. Show that if P(n) then P(n + 1) for any n  N. (inductive step) 3. Then P(n) must be true for any n  N. (conclusion)
  • 12.
    Induction 1. Basis Step: P(1)is true. For n = 1, left hand side of P(1) is the sum of all the successive integers starting at 1 and ending at 1, so LHS = 1 and RHS is 1(1 1) 2 . . 1 2 2 R H S     ( 1) ( ):1 2 3 2 n n P n n      L
  • 13.
    Induction 2. Inductive Step:Suppose P(k) is true for, some integers k  1 I. To prove P(k + 1) is true. That is, II. ( 1) 1 2 3 2 k k k      L ( 1)( 2) 1 2 3 ( 1) 2 k k k        L
  • 14.
    Induction Consider L.H.S. of(2) Hence by principle of Mathematical Induction the given result true for all integers greater or equal to 1 1 2 3 ( 1) 1 2 3 ( 1) ( 1) ( 1) using (1) 2 ( 1) 1 2 2 ( 1) 2 ( 1)( 2) RHS of (2) 2 k k k k k k k k k k k k                                   L L
  • 15.
    Induction o 1+3+5+…+(2n -1)= n2 for all integers n ≥1. o Let P(n) be the equation 1+3+5+…+(2n -1) = n2 o Show that P(1) is true. (basis step) For n = 1, L.H.S of P(1) = 1 and R.H.S =2(1)-1 = 1 Hence the equation is true for n = 1
  • 16.
    Induction o Suppose P(k)is true for some integer k ≥ 1. (inductive step) 1 + 3 + 5 + … + (2k - 1) = k2 …………………(1) To prove P(k+1) is true; i.e., 1 + 3 + 5 + … +[2(k+1)-1] = (k+1)2 ………….……(2) Consider L.H.S. of (2) Thus P(k+1) is also true. Hence by mathematical induction, the given equation is true for all integers n ≥ 1 2 2 1 3 5 [2( 1) 1] 1 3 5 (2 1) 1 3 5 (2 1) (2 1) (2 1) using (1) ( 1) R.H.S. of (2) k k k k k k k                           L L L