Professional Documents
Culture Documents
Example 3.1
Compute the first 5 terms of the following sequences:
n
(i) an = , n ≥1
n +1
1 2 3 4 5
a1 = , a2 = , a3 = , a 4 = , a5 =
2 3 4 5 6
n −1
(ii) bn = , n≥2
n
1 2 3 4 5
b2 = , b3 = , b4 = , b5 = , b6 =
2 3 4 5 6
(iii) cn = (−1) n , n ≥ 1
c1 = −1, c2 = 1, c3 = −1, c4 = 1, c5 = −1
Definition 3.2
A geometric progression is a sequence of the form
a, ar, ar2, …, arn
where the initial term a and the common ratio r are real numbers.
Example 3.2
The sequences
bn = (−1)n, n ≥ 1 a = −1, r = −1, {−1, 1, −1, 1, …}
33
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Definition 3.3
An explicit formula (general formula) for a sequence is a rule that shows
how the value of ak depends on k.
Example 3.3
Find an explicit formula for sequences with the following first 5 terms:
(i) 1, 12 , 14 , 18 , 161
1
an = n−1
2
(iii) 1, − 14 , 19 , − 161 , 1
25
ak =
(− 1)k +1
k2
Summation Notation
n
We use the notation ∑aj to represent am + am + 1 + … + an .
j =m
The variable j is called the index of summation.
The index of summation runs through all integers starting with its lower
limit m and ending with its upper limit n.
Note
If we add the terms of a sequence an, n ≥ 1, we get an expression of the
m
form a1 + a2 + a3 + … + am = ∑ an which is called a series.
n =1
Example 3.4
n
(− 1)
i
(− 1)0 + (− 1)1 + (− 1)2 + (− 1)3 + L
(i) ∑ i +1 0 +1 1+1 2 +1 3 +1
=
i =0
= 1 − 12 + 13 − 14 + L
34
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
n +1
1 2 3 n +1 k
(ii) + +
n n +1 n + 2
+ ... +
2n
= ∑ n + k −1
k =1
n
k k +1
(ii) Compute ∑ k + 1 − k + 2
k =1
**
12 −
2
3
2
k +1 3 −
3
n
k
∑ k +1 k + 2
− = +
M
4
k =1
n n +1
n+1 − n+ 2
1 n +1
= −
2 n+2
5
(iii) What is the value of ∑k2 ?
k =2
5
** ∑ k 2 = 2 2 + 32 + 4 2 + 5 2 = 4 + 9 + 16 + 25 = 54
k =2
Theorem 3.1
If a and r are real numbers and r ≠ 0 , then
ar n +1 − a
n
∑ ar j = r − 1 , r ≠ 1
j =0 (n + 1)a, r = 1
Change of Variable
The symbol used to represent the index of a summation can be replaced
5 4
by any other symbol. For example, ∑j 2
= ∑ (k + 1) 2 .
j =1 k =0
Example 3.5
Transform the following summation by making the specified change of
variable:
6
1
(i) ∑ j + 1 , change of variable: k = j + 1
j =0
j = 0, k = 1 and j = 6, k = 7
35
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
6 7
1 1
So ∑ =∑
j + 1 k =1 k
j =0
n +1
(ii) ∑ n − j + 1 , change of variable: k = j – 1.
j =1
j = 1, k = 0 and j = n + 1, k = n
n +1 n
So ∑ n − j + 1 = ∑ (n − k )
j =1 k =0
n +1
j
(iii) ∑ n + j , change of variable: k = j – 1.
j =1
j = 1, k = 0 and j = n + 1, k = n
n +1
j n
k +1
So ∑ =∑
j =1 n + j k =0 n + k + 1
Example 3.6
Double Summations:
4 3 4 4
∑∑ ij = ∑ (i + 2i + 3i ) =∑ (6i ) = 6(1 + 2 + 3 + 4) = 60
i =1 j =1 i =1 i =1
Product Notation
Π denotes a product.
n
Π ak = am ⋅ am+1 ⋅ am+ 2 ⋅ L ⋅ an
k =m
Example 3.7
Compute the following products:
1 k 1
(i) Π =
k =1 k + 1 2
3
(ii) Π k (k + 1) = 1(2 ) ⋅ 2(3) ⋅ 3(4 ) = 144
k =1
5 1 1 1 1 1 1 1
(iii) Π = =
k =1 k 1 2 3 4 5 120
36
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Note
m m m
(i) ∑ an + ∑ bn = ∑ (an + bn )
n =1 n =1 n =1
m m
(ii) ∑ can = c∑ an
n =1 n =1
m
m
m
(iii) Π a n Π bn = Π (an bn )
n =1 n=1 n=1
Factorial Notation
For each positive integer n, the quantity n factorial, denoted n!, is defined
to be the product of all the integers from 1 to n.
n!= n(n − 1)(n − 2 )K(3)(2 )(1)
Example 3.8
Simplify the following expressions:
1 1 1 1 7
(i) + = + =
2! 4! 3! 3! (2 )(24 ) 6(6 ) 144
(n + 1)! (n + 1)n!
(i) = = (n + 1)
n! n!
n! n(n − 1)(n − 2 )(n − 3)!
(ii) = = n(n − 1)(n − 2 )
(n − 3)! (n − 3)!
1) for i := 1 to n
print a[i]
next i
2) for j := 0 to n – 1
print a[j + 1]
next j
3) for k := 2 to n + 1
print a[k – 1]
next k
Mathematical Induction
Mathematical induction is one of the more recently developed techniques
of proof in the history of mathematics. It is used to check conjectures
about the outcomes of processes that occur repeatedly and according to
definite patterns.
38
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Principle of Ordinary Mathematical Induction
Let P(n) be a predicate that is defined for integers n, and let a be a fixed
integer. Suppose the following two statements are true:
(1) P(a) is true.
(2) For all integers k ≥ a, if P(k) is true then P(k+1) is true.
Then the statement “for all integers n ≥ a, P(n)” is true.
Note
In a proof by mathematical induction, it is not assumed that P(k) is true
for all positive integers!
Basis step:
n = 1, LHS = 1, RHS = 1
39
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
LHS = RHS
So P(1).
Inductive step:
Suppose that P(k) is true for a positive integer k ≥ 1; that is,
1 + 3 + 5 + …+ (2k – 1) = k2.
When n = k + 1,
1 + 3 + 5 + … + (2k – 1) + (2(k + 1) – 1) = k 2 + (2(k + 1) – 1)
= k2 + 2k + 1
= (k + 1) 2 .
Hence P(k + 1) is true.
By mathematical induction, P(n) is true for all n ≥ 1.
n
n(n + 1)
Let P(n): ∑r = 2
r =1
Basis Step:
When n = 1, LHS = 1, RHS = 1(12+1) = 1
So LHS = RHS and P(1) is true.
Inductive Step:
Suppose P(k) is true for a positive integer k ≥ 1 that is
k (k + 1)
1+2+…+k= .
2
(k + 1)(k + 2)
Show P(k + 1) is true: 1 + 2 + … + (k + 1) =
2
When n = k + 1,
k (k + 1)
1 + 2 + … + k + (k + 1) = + (k + 1)
2
(k + 1)(k + 2)
= .
2
40
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
So P(k + 1) is true.
By mathematical induction, P(n) is true for all n ≥ 1.
Example 3.12
Use mathematical induction to prove that
n
1
∑ r 2 = 12 + 2 2 + ... + n 2 = 6 n(n + 1)(2n + 1) .
r =1
1
Let P(n): 12 + 2 2 + ... + n 2 = n(n + 1)(2n + 1)
6
Basis step:
1
n = 1, LHS = 1 and RHS = (2)(3) = 1
6
So LHS = RHS and P(1) is true
Inductive step:
Suppose P(k) is true for a positive integer k ≥ 1; that is,
1
12 + 2 2 + ... + k 2 = k (k + 1)(2k + 1)
6
1
Show 12 + 2 2 + ... + (k + 1) = (k + 1)((k + 1) + 1)(2(k + 1) + 1)
2
6
When n = k + 1
(1
2
)
+ 2 2 + ... + k 2 + (k + 1)
2
=
1
6
k (k + 1)(2k + 1) + (k + 1)
2
1
[
= (k + 1) 2k 2 + k + 6k + 6
6
]
1
= ( k + 1)(k + 2 )(2k + 3)
6
Hence P(k + 1) is true.
By mathematical inductions P(n) is true for all positive integers n.
Example 3.13
Use mathematical induction to prove that
2
n
1
∑ r = 1 + 2 + ... + n = 2 n(n + 1) .
3 3 3 3
r =1
41
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
2
n
1
Let P(n): ∑ r = 1 + 2 + ... + n = n(n + 1)
3 3 3 3
r =1 2
Basis step:
2
1
n = 1, LHS = 1 and RHS = (1)(2 ) = 1
2
So LHS = RHS and P(1) is true
Inductive step:
Suppose P(k) is true for a positive integer k ≥ 1; that is,
2
1
1 + 2 + ... + k = k (k + 1)
3 3 3
2
When n = k + 1
2
(1
3
)
+ 2 + ... + k + (k + 1)
3 3 3 1
= k (k + 1) + (k + 1)
3
2
1
[
= (k + 1) k 2 + 4k + 4
4
2
]
1
= (k + 1) (k + 2 )
2 2
4
2
1
= (k + 1)(k + 2 )
2
Hence P(k + 1) is true.
By mathematical induction, P(n) is true for all n ≥ 1.
r =1
42
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Example 3.14
Write down the kth term of the given series and deduce its sum to n terms.
(a) 1(1) + 2(3) + 3(5) + …
r =1 r =1 r =1
= [6 n(n + 1)(2n + 1)] + n
1
= n[16 (n + 1)(2n + 1) + 1]
r =1 r =1 r =1 r =1
= 9[6 n(n + 1)(2n + 1)] + 3[12 n(n + 1)] − 2n
1
= 32 n(n + 1)(2n + 1 + 1) − 2n
= 3n(n + 1)2 – 2n
43
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
(e) 1(4) + 2(7) + 3(10) + …
kth term of the series, U k = k (3k + 1) = 3k 2 + k .
n n n
∑U r = 3∑ r 2 + ∑ k
r =1 r =1 r =1
= [ (n + 1)(2n + 1)] + [12 n(n + 1)]
3 16 n
= n(n + 1)2
Example 3.15
Let P(n) be the property “n¢ can be obtained using 2¢ and 5¢ coins.”
Then P(n) is true for all integers n ≥ 4.
Basis Step:
n = 4, 4¢ = 2¢ + 2¢. So P(4) is true.
Inductive Step:
Suppose k¢ can be obtained using 2¢ and 5¢ coins for some integer k ≥
4.
2¢
2¢
5¢ 2¢ 2¢
Remove Add
If there is a 5¢ coin among those used to make up the k¢, replace it by
three 2¢, the result will be (k+1) ¢.
(k + 1)¢
Replace two 2¢ coins
by one 5¢ coin
2¢ 2¢ 5¢
Remove Add
44
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
If no 5¢ coin is used to make up the k¢, then at least two 2¢ coins must be
used because k ≥ 4.
Remove two 2¢ coins and replace them by a 5¢ coin, the result will be
(k+1) ¢.
Basis Step:
n = 1, 22(1) – 1 = 3 is divisible by 3.
So P(1) is true.
Inductive Step:
Suppose P(k) is true for a positive integer k ≥ 1 that is
22k – 1 is divisible by 3
Example 3.17
Use mathematical induction to prove that for all integers n ≥ 1,
7 n (3n + 1) − 1 is divisible by 9.
45
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Basis Step:
n = 1, 7(3 + 1) – 1 = 27 is divisible by 9
So P(1) is true.
Inductive Step:
Suppose P(k) is true for some integer k ≥ 1, that is
7k(3k + 1) – 1 is divisible by 9.
7k + 1(3(k + 1) + 1) – 1 = 7(7k)[3k + 4] – 1
= (7k)[21k + 28] – 1
= (7k)[3k + 1 + 18k + 27] – 1
= {(7k)[3k + 1] – 1} + (7k)[18k + 27]
k k
= {(7 )[3k + 1] – 1} + 9(7 )[2k + 3]
Proving an Inequality
Example 3.18
Use mathematical induction to prove that
2n + 1 < 2n, for all integers n ≥ 3.
Basis Step:
n = 3, LHS = 2(3) + 1 = 7, RHS = 23 = 8.
Hence LHS < RHS and so P(3) is true.
Inductive Step:
Suppose P(k) is true for some integer k ≥ 3, that is
2k + 1 < 2k
So P(k + 1) is true.
Hence, by mathematical induction, P(n) is true for all integers n ≥ 3.
Example 3.19
Use mathematical induction to prove the inequality n < 2n for all positive
integers n.
Basis Step:
n = 1, LHS = 1, RHS = 2
Hence LHS < RHS and P(1) is true.
Inductive Step:
Suppose P(k) is true for some integer k ≥ 1, that is
k < 2k
Basis Step:
n = 1, a1 = 2(51 – 1) = 2
By the definition of the sequence, a1 = 2, so P(1) is true.
47
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Inductive Step:
Suppose P(k) is true for some integer k ≥ 1, that is
ak = 2(5k − 1)
n
r n+1 − 1
Let P(n): ∑ri = r −1
i =0
Basis Step:
n = 0, LHS = r0 = 1
r 0+1 − 1
RHS = =1
r −1
So LHS = RHS, P(1) is true.
Inductive Step:
Suppose P(k) is true for some integer k ≥ 1, that is
k
r k +1 − 1
∑r = r −1
i
i =0
r k +2 − 1
k +1
Show that P(k + 1) is true: ∑ r = i
i =0 r −1
When n = k + 1,
48
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
k +1 k
∑r i
= ∑ r i + r (k +1)
i =0 i =0
k +1
− 1 k +1
r
= +r
r −1
r k +1 − 1 + r k +1 (r − 1)
=
r −1
r − 1 + r k + 2 − r k +1
k +1
=
r −1
k +2
r −1
=
r −1
So P(k +1) is true
Example 3.21
Let m be an integer greater than or equal to 3.
(i) Find 1 + 3 + 32 + … + 3m − 2.
(ii) Find 32 + 33 + 34 + … + 3m.
3m−2+1 − 1 3m−1 − 1
m− 2
(i) 1+3+3 +…+3 2 m−2
= ∑3 = i
=
i =0 3 − 1 2
(ii) (
32 + 33 + 34 + … + 3m = 32 1 + 3 + 32 + L + 3m−2 )
m−1
2 3 − 1 3m+1 − 9
=3 =
2 2
Method of Differences
If U r = f (r ) − f (r − 1) , then
n n
∑U r = ∑ { f (r ) − f (r − 1)}
r =1 r =1
f (1) − f (0 )
f (2 ) − f (1)
= +
M
f (n ) − f (n − 1)
= f(n) – f(0)
49
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Example 3.22
Find 1(2)(3) + 2(3)(4) + … + n(n+1)(n+2).
Let f(r) = r(r + 1)(r + 2)(r + 3) and f(r – 1) = (r – 1)r(r + 1)(r + 2).
Example 3.23
Sum to n terms 2(5) + 5(8) + 8(11) +…
Let f(r) = (3r – 1)(3r + 2)(3r + 5) and f(r – 1) = (3r – 4)(3r – 1)(3r + 2).
50
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
f (1) − f (0 )
1 f (2 ) − f (1)
= +
9 M
f (n ) − f (n − 1)
1
= [ f ( n) − f (0)]
9
1
= [(3n − 1)(3n + 2)(3n + 5) + 10] .
9
Example 3.24
1
Let f(r) = r2(r + 1)2, show that f(r) – f(r – 1) = r3.
4
Hence find the sum of the series 13 + 23 + 33 + … + n3.
f(r) = 14 r 2 (r + 1) , (r − 1)2 (r )2
2 1
f(r – 1) = 4
(
f(r) − f(r – 1) = 14 r 2 (r + 1) − (r − 1)
2 2
)
= 1 2
4r
(r 2
+ 2r + 1 − r 2 + 2 r − 1 )
3
=r
n
3 3 3
1 +2 +3 +…+n = 3
∑r3
r =1
n
= ∑ [ f (r ) − f (r − 1)]
r =1
f (1) − f (0 )
f (2 ) − f (1)
= +
M
f (n ) − f (n − 1)
= f(n) – f(0)
= 14 n 2 (n + 1)
2
Example 3.25
Let f(r) = r(r + 1)!. Simplify f(r) – f(r − 1) and hence sum to n terms the
series 5(2!) + 10(3!) + 17(4!) + 26(5!) + ….
∑ (r 2 + 1)r!
n
=
r =2
n
= ∑ [ f (r ) − f (r − 1)]
r =2
f (2 ) − f (1)
f (3) − f (2 )
= +
M
f (n ) − f (n − 1)
= f(n) – f(1)
= n(n + 1)! – 2
Fractions
Example 3.26
1 1 1
Sum to n terms the series + + + ...
3(5) 5(7) 7(9)
1
Let U r =
(2r + 1)(2r + 3)
1
Let f(r) = = (2r + 1)U r
2r + 3
Then
1 1
f(r − 1) = = = (2r + 3)U r
2(r − 1) + 3 2r + 1
52
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
n
= ∑U r
r =1
n
= ∑ − 12 [ f (r ) − f (r − 1)]
r =1
f (1) − f (0 )
1 f (2 ) − f (1)
= − +
2 M
f (n ) −
f (n − 1)
= − 12 ( f (n ) − f (0 ))
1 1 1
=− −
2 2n + 3 3
n
=
3(2n + 3)
Example 3.27
1 1 1
Sum to n terms the series + + + ....
3(5)(7) 5(7)(9) 7(9)(11)
1
Let Ur =
(2r + 1)(2r + 3)(2r + 5)
1
Let f(r) = = (2r + 1)U r , then
(2r + 3)(2r + 5)
1
f(r – 1) = = (2r + 5)U r
(2r + 1)(2r + 3)
f(r) – f(r – 1) = (2r + 1)U r − (2r + 5)U r
= −4Ur
1 1 1 1
+ + + .... +
3(5)(7) 5(7)(9) 7(9)(11) (2n + 1)(2n + 3)(2n + 5)
n
1
=∑
r =1 ( 2r + 1)( 2r + 3)(2r + 5)
1 n
= − ∑ [ f (r ) − f (r − 1)]
4 r =1
53
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
f (1) − f (0 )
1 f (2 ) − f (1)
= − +
4 M
f (n ) −
f (n − 1)
= − 14 ( f (n ) − f (0 ))
1 1 1
=− −
4 (2n + 3)(2n + 5) 15
1 15 − 4n 2 − 16n − 15
=−
4(15) (2n + 3)(2n + 5)
1 15 − 4n 2 − 16n − 15
=−
4(15) (2n + 3)(2n + 5)
n(n + 4 )
=
15(2n + 3)(2n + 5)
Program Verification
Suppose that we have designed an algorithm to solve a problem and have
written a program to implement it.
How can we be sure that the program always produces the correct
answer?
After all bugs have been removed so that the syntax is correct, we can
test the program with sample input.
It is not correct if an incorrect result is produced for any sample input.
But even if the program gives the correct answer for all sample input, it
may not always produce the correct answer (unless all possible input has
been tested).
We need a proof to show that the program always gives the correct
output.
Definition 3.4
A program is said to be correct if it produces the correct output for every
possible input.
A proof that a program is correct consists of two parts.
(1) establishes the partial correctness of the program, (show that the
correct answer is obtained if the program terminates)
(2) shows that the program always terminates.
54
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
To specify what it means for a program to produce the correct output,
two propositions are used.
(1) The initial assertion gives the properties that the input values must
have.
(2) The final assertion gives the properties that the output of the
program should have, if the program did what was intended.
Definition 3.5
A program, or program segment S, is said to be partially correct with
respect to the initial assertion p and the final assertion q if whenever p is
true for the input values of S and S terminates, then q is true for the
output values of S.
Notation
p{S}q indicates that the program, or program segment, S is partially
correct with respect to the initial assertion p and the final assertion q.
Example 3.28
Show that the program segment
y := 2
z := x + y
is correct with respect to the initial assertion p: x = 1 and the final
assertion q: z = 3.
Conditional statement
Suppose that a program segment has the form
if condition then
S
where S is a block of statements.
S is executed if condition is true, and it is not executed when condition is
false
55
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
To verify that this segment is correct with respect to the initial assertion p
and the final assertion q, show that
(i) when p is true and condition is also true, then q is true after S
terminates;
(ii) when p is true and condition is false, then q is true. since in this
case S does not execute
Example 3.29
Verify that the program segment
if x > y then
y := x
is correct with respect to the initial assertion T and the final assertion y ≥
x.
To verify that this program segment is correct with respect to the initial
assertion p and the final assertion q, show that
(i) when p is true and condition is also true, then q is true after S 1
terminates;
(ii) when p is true and condition is false, then q is true after S 2
terminates.
56
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Example 3.30
Verify that the program segment
if x < 0 then
abs := –x
else
abs := x
is correct with respect to the initial assertion T and the final assertion abs
= x.
Example 3.31
In the program segment shown below, show that if the predicate is true
before entry to the loop, then it is also true after exit from the loop.
Loop: while (m ≥ 0 and m ≤ 100)
m := m + 1
n := n − 1
end while
predicate: m + n = 100
Suppose the condition m + n = 100 is true before entry to the loop. Then
mold + nold = 100
57
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Recursively Define Sequences
Definition 3.6
(i) A sequence is defined recursively if certain initial values are
specified and later terms of the sequence are defined by relating
them to a number of earlier terms.
(ii) A recurrence relation for a sequence a0, a1, a2, … is a formula
that relates each term ak to certain of its predecessors ak − 1, ak − 2,
…, ak − i , where i is an integer and k is any integer greater than or
equal to i.
Example 3.32
Define a sequence b0, b1, b2,…. recursively as follows:
For all integers k ≥ 2,
bk = bk − 1 + kbk – 2 + 1 (recurrence relation)
b0 = 1, b1 = 2 (initial conditions)
Find b2, b3 and b4.
b2 = b2 − 1 + 2b2 – 2 + 1
= b1 + 2b0 + 1
= 2 + 2(1) + 1
=5
b3 = b3 − 1 + 3b3 – 2 + 1
= b2 + 3b1 + 1
= 5 + 3(2) + 1
= 12
b4 = b4 − 1 + 4b4 – 2 + 1
= b3 + 4b2 + 1
= 12 + 4(5) + 1
= 33
Example 3.33
Define a sequence c0, c1, c2,…. recursively as follows:
For all integers k ≥ 1,
ck = 3ck − 1 and c0 = 2 .
Find c1, c2 and c3.
(i) F2 = F2 − 1 + F2 − 2 = F1 + F 0 = 1 + 1 = 2
F3 = F3 − 1 + F3 − 2 = F2 + F 1 = 2 + 1 = 3
F4 = F4 − 1 + F4 − 2 = F3 + F 2 = 3 + 2 = 5
F5 = F5 − 1 + F5 − 2 = F4 + F 3 = 5 + 3 = 8
F6 = F6 − 1 + F6 − 2 = F5 + F 4 = 8 + 5 = 13
(ii) Fk = Fk − 1 + Fk − 2
= [F(k − 1) – 1 + F(k – 1) − 2] + Fk − 2
= [Fk − 2 + Fk − 3] + Fk − 2
= 2Fk − 2 + Fk − 3
= 2[F(k − 2) – 1 + F(k – 2) − 2] + Fk − 3
= 2[Fk − 3 + Fk − 4] + Fk − 3
= 3Fk − 3 + 2Fk − 4
Compound Interest
Example 3.36
RM100,000 is deposited in a bank account earning 4% interest
compounded annually. What is the amount in the account after 5 years?
59
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
For each positive integer n,
Let An = the amount in the account at the end of year n
and A0 = the initial amount in the account = 100 000
Example 3.37
Consider the set S of all strings in a’s and b’s. S is defined recursively as
follows:
I. Base: λ is in S, where λ is the null string.
II. Recursion: If s ∈ S, then
(a) sa ∈ S and
(b) sb ∈ S,
III. Restriction: Nothing is in S other than objects defined in 1
and 2 above.
Derive the fact that ab∈S.
(1) λ ∈ S, by (I)
(2) λa ∈ S , by (I) & (II)(a)
but λa = a
⇒ a ∈ S.
(3) ab ∈ S by (II)(b) & (2)
60
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Example 3.38
Below is a recursive definition to generate the set P of legal configuration
of parentheses.
I. Base: ( ) is in P
II. Recursion:
(a) if E is in P, so is (E).
(b) if E and F are in P, so is EF.
III. Restriction: No configurations of parentheses are in P other
than those derived from 1 and 2 above.
Derive the fact that (( ))( ) is in P.
(1) ( ) is in P, by (I)
(2) (( )) is in P, by (II)(a) and (1)
(3) (( ))( ) is in P, by (1), (2) and (II)(b)
n
The product from i =1 to n of the ai, denoted ∏ ai , is defined by
i =1
n −1
1 n
∏ ai = a1 and ∏ ai = ∏ ai ⋅ an if n > 1.
i =1 i =1 i =1
Definition 3.8
Given sets A1, A2, …, An, where n is a positive integer, the union of the Ai
n
from i = 1 to n, denoted UAi is defined by
i =1
1 n
n−1
U A i = A1 and U A i = U A i ∪ A n .
i =1 i =1 i =1
61
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
n
The intersection of the Ai from i =1 to n, denoted I A i , is defined by
i =1
1 n
n−1
I A i = A 1 and I i I A i ∩ A n .
A =
i =1 i =1 i =1
Example 3.39
Let a0, a1, a2, …. be the sequence defined recursively as follows:
For all integers k ≥ 1,
ak = ak − 1 + 2
a0 = 1
Use iteration to guess an explicit formula for the sequence.
a0 = 1
a1 = a0 + 2 = 1 + 2
a2 = a1 + 2 = 1+ 2 +2 = 1 + 2(2)
a3 = a2 +2 = 1+ 2 + 2 + 2 = 1 + 3(2)
a4 = a3 + 2 = 1+ 2+ 2+2 +2 = 1 + 4(2)
M
In general, an = 1 + 2n
Definition 3.9
A sequence a0, a1, a2, …. is called an arithmetic sequence if and only if
there is a constant d such that
ak = ak − 1 + d for all integers k ≥ 1.
Or equivalently,
an = a0 + dn for all integers n ≥ 0.
62
UCCM1333 INTRODUCTORY DISCRETE MATHEMATICS
Example 3.40
Let r be a fixed nonzero constant, and suppose a sequence a0, a1, a2, … is
defined recursively as follows:
ak = rak − 1 for all integers k ≥ 1
a0 = a.
Use iteration to guess an explicit formula for this sequence.
a0 = a
a1 = ra0
a2 = ra1 = r(ra0) = r2a0
a3 = ra2 = r(r2a0) = r3a0
M
an = rna0 = a0rn
Definition 3.10
A sequence a0, a1, a2, …. is called a geometric sequence if and only if
there is a constant r such that
ak = rk ak − 1 for arbitrary integer k ≥ 1.
Or, equivalently, an = a0 rn for arbitrary integer n ≥ 0.
63