You are on page 1of 23

THE UNIVERSITY OF THE WEST INDIES

ASSIGNMENT 2
SEMESTER I, 2012/2013
Code and Name of Course: COMP2101/CS20S Discrete Mathematics



Assignment 2 - Group Assignment
AREA
DESCRIPTION
Objectives To have students apply the knowledge garnered during weeks 5 to 10
To have students work within a group setting with the allocation of work but
still ensuring that the knowledge is spread throughout the group

Title Assignment 2 Group Assignment

Deliverable The answers for the questions which follow the given instructions.

A summary of the contribution made by each student in the group.

Instructions 1. Review Lectures of weeks 5 to 10 of the course, the COMP2101 Text and
any other related Discrete Mathematics material
2. Read the Assignment 2 Sheet thoroughly
3. Submit the gradable solution by using the
COMP2101 Assignment 2 - Group located within the ASSIGNMENTS
Section of the OURVLE COMP2101/CS20S Course Environment. This
may also be accessed by choosing the Assignments section below
Activities

Format The solution for this assignment must be submitted as a Microsoft Word
document.

Your ID number should form part of the Microsoft Word file name. The file
name should take the format COMP2101 Assignment 2 Semester 1 2012-
2013 XXXXXXXX YYYYYYYY ZZZZZZZZ where XXXXXXXX, etc.
represents the student ID numbers.




Upload
Constraint
Assignment should be uploaded in the relevant space provided in
OURVLE (See Instructions section above). A message indicating File
uploaded successfully will acknowledge that the file has been sent
successfully.

Do NOT assume your project has been received if you do not get this
acknowledgement.


Group
Restrictions
This is a group assignment.

Each group must have a minimum of 2 members and a maximum of four (4)
members.


Late
Assignments
Late assignments are accepted. These are however graded then 25%
deducted for each day of late submission.


Expectation It is expected that students will discuss means to a solution within their group.
The actual work written is expected to reflect the groups decision. Where
replication of work is identified between groups, each paper will be graded.
The allocated grade to each groups piece of work for where this anomaly is
identified will be the grade divided by the number of replications discovered.



Scoring Rubric

Your electronic submission will be evaluated on:
1. The response submitted for each question (See detail individual marks
below) 45 marks
2. Group Dynamics i.e. for accomplishing the task as a group 5 marks.
Marks allocated based on correct inclusion of each student id number and
name and a brief description as to the contribution made within the group.
The actual grade of 50 marks will be displayed. The actual grade allocated is
the percentage of the maximum marks (5 points)



Due Date

Monday, November 19, 2012

Question 1 [8 mks]
A coding system encodes messages using strings of octal digits (base 8). A codeword is
considered valid if and only if it contains an even number of 7s.

i. Find a recurrence relation for the number of valid codewords of length n.
State initial conditions. [4]
ii. Solve this recurrence relation using generating functions. [4]


Question 2 [2 mks]
a. Determine the limit of f(x) as x for the following:

3 3
5
) (
+

=
x
x
x f [1]

b. For the sequence a and b defined by
a
1
= 2, a
n
= 3a
n 1
, n 2, and b
n
= 2
n
(n 1)

Find
) )( (
7
3
5
2
[
= = j
j
i
i
b a
[1]


Question 3 [5 mks]
Find a formula for the sequence c defined by

=
=
n
i
i n
b c
1
Where b is the sequence {1, 2, 4, 4, 7, 8, 10, } [5]


Question 4 [3 mks]
Let f(n) and g(n) be functions defined on the set of positive integers
Prove or disprove the following:
if f (n) = (h(n)) and g(n) = ( k(n))
then f(n)g(n) = (h(n)k(n)). [3]


Question 5 [2 mks]
What is the limit of
=

n
k
k
n as x
0
? State all necessary
conditions for this limit to exist. [2]
Question 6 [7 mks]
Use generating functions to find a closed form solution for each of the following
recurrence relations:

i. a
0
= 1 and a
n
= 3a
n-1
+ 2 for n 1 [3]

ii. s
0
= 6, s
1
= 5 and 9S
n
= 6S
n-1
- S
n-2
for n 0 [4]


Question 7 [8 mks]
Let a,b,c be integers such that a 1, b > 1 and c > 0. Let f: N R be functions
where N is the set of Natural numbers and R is the set of Real numbers
such that
f(1) = c and f(n) = af(n/b) + c
for n = b
k
, where k is a positive integer greater than 1.

(a) By using the principles of Recurrence Relation, find a general formula
for f(n) [4]
(b) Hence show that if a 1, then f(n) = ) (
1
) 1 (
log
log
a
a
b
b
n
a
an c
O =


[4]


Question 8 [4 mks]
Consider the geometric series:
3 + 12/7 + 48/49 + 192/343 +

i. Determine a formula for S
n

where S
n
is the sum of the first n terms of the series? [3]

ii. What is the limit of S
n
[1]


Question 9 [6 mks]
Find the generating function for the sequence

{1, 4, 13, 28, 49, } [6]
Question 1 [8 mks]
A coding system encodes messages using strings of octal digits (base 8). A codeword is
considered valid if and only if it contains an even number of 7s.

i. Find a recurrence relation for the number of valid codewords of length n.
State initial conditions. [4]
ii. Solve this recurrence relation using generating functions. [4]

Solution 1
[i. Logical steps outlined towards finding general equation - 3 marks ]
[ Finding general equation f(n) or S
n
- 1 mark ]
[ii. Correct initial layout of solution 1
st
3 statements - 1 mark ]
[ Application of Correct combining i.e. Subtraction - 1 mark ]
[ Logical steps towards correct solution - 2 marks ]

i.
Solution A - IF ZERO 7S IS NOT CONSIDERED TO BE EVEN
Set of strings of {0, 1, 2, 3, 4, 5, 6, 7}

Valid String contains an even number of 7s e.g. 765703377112 or 001767 or 77

Let n be the length of the codeword
S
n
be the number of valid codewords of length n or

S
n
is the number of codewords of length n with an even number of 7s

i.e. S
n-1
is the number of codewords of length n-1 with an even number of 7s
S
n-2
is the number of codewords of length n-2 with an even number of 7s
etc.

By Counting
S
0
= 0
S
1
= 0
S
2
= 1
S
3
= 21
.
.

Firstly,
The valid codewords begins with a 7 or Not

Let S
A
be the number of valid codewords of length n that Do Not begin with 7
S
B
be the number of valid codewords of length n that begins with 7
Then
S
n
= S
A
+ S
B


Consider S
A
[Does Not Begin with 7, i.e. begins with 0 or 1 or ... or 6]
Let us say a valid codeword that begins with 0
The other n-1 octal digits must contain an even number of 7s i.e. S
n-1
As there are 7 such cases
S
A
= 7S
n-1

Consider S
B
[Begins with 7]
The other n-1 octal digits must contain an odd number of 7s
For these n-1 octal digits
The number of odds = Total number of codewords
minus The number of evens
minus The number without 7s (not odd or even)
Therefore,
As we are now considering the n-1 octal digits
S
B
= 8
n-1
- S
n-1
- 7
n-1


Therefore, As
S
n
= S
A
+ S
B


The Recurrence Relation
S
n
= 7S
n-1
+ 8
n-1
- S
n-1
- 7
n-1
Simplified
S
n
= 6S
n-1
+ 8
n-1
- 7
n-1
for n > 1


For The Initial Conditions

When n = 1,
S
1
= 0
S
1
= 6S
0
+ 8
0
- 7
0

Therefore
S
0
= 0

Solution B - IF ZERO 7S IS CONSIDERED TO BE EVEN
Set of strings of {0, 1, 2, 3, 4, 5, 6, 7}

Valid String contains an even number of 7s e.g. 765703377112 or 001767 or 77
or 0123456065 or 333333 or 00 or 5

Let n be the length of the codeword
S
n
be the number of valid codewords of length n or

S
n
is the number of codewords of length n with an even number of 7s

i.e. S
n-1
is the number of codewords of length n-1 with an even number of 7s
S
n-2
is the number of codewords of length n-2 with an even number of 7s
etc.

By Counting
S
1
= 7
S
2
= 7
2
+ 1 = 50
S
3
= 7
3
+ 3x7 = 364
.
.

Firstly,
The valid codewords begins with a 7 or Not

Let S
A
be the number of valid codewords of length n that Do Not begin with 7
S
B
be the number of valid codewords of length n that begins with 7
Then
S
n
= S
A
+ S
B


Consider S
A
[Does Not Begin with 7, i.e. begins with 0 or 1 or ... or 6]
Let us say a valid codeword that begins with 0
The other n-1 octal digits must contain an even number of 7s i.e. S
n-1
As there are 7 such cases
S
A
= 7S
n-1

Consider S
B
[Begins with 7]
The other n-1 octal digits must contain an odd number of 7s
For these n-1 octal digits
The number of odds = Total number of codewords
minus The number of evens
minus The number without 7s (not odd or even)
Therefore,
As we are now considering the n-1 octal digits
S
B
= 8
n-1
- S
n-1


Therefore, As
S
n
= S
A
+ S
B


The Recurrence Relation
S
n
= 7S
n-1
+ 8
n-1
- S
n-1

Simplified
S
n
= 6S
n-1
+ 8
n-1
for n > 1


For The Initial Conditions

When n = 1,
S
1
= 7
S
1
= 6S
0
+ 8
0

Therefore
S
0
= 1


ii.
Solution A - IF ZERO 7S IS NOT CONSIDERED TO BE EVEN
S
0
= 0
S
1
= 0
S
n
= 6S
n-1
+ 8
n-1
- 7
n-1
for n > 1

Let S = s
0
+ s
1
x + s
2
x
2
+ s
3
x
3
+ ... + s
n
x
n
+ ...
6xS = 6s
0
x + 6s
1
x
2
+ 6s
2
x
3
+ ... + 6s
n-1
x
n
+ ...

It follows
S
n
- 6S
n-1
= 8
n-1
- 7
n-1
for n > 1

By Subtraction
S(1- 6x) = s
0
+ (s
1
- 6s
0
)x + (s
2
-6s
1
)x
2
+ (s
3
-6s
2
)x
3
+... + (s
n
-6s
n-1
)x
n
+ ...

S
2
= 1
S
3
= 6 + 64 49 = 21

S(1- 6x) = (8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+...+ (8
n-1
-7
n-1
)x
n
+...

S = [ (8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+...+ (8
n-1
-7
n-1
)x
n
+... ] / (1-6x)

As 1/(1-6x) = 1 + 6x + 6
2
x
2
+ 6
3
x
3
+ ... + 6
n
x
n
+ ...

S = [(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] *
(1+6x+6
2
x
2
+6
3
x
3
+ .. + 6
n
x
n
+ ...)

S = 1 [(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] +
6x [(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] +
6
2
x
2
[(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] +
6
3
x
3
[(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] +
.
.
6
n
x
n
[(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] +
...
= (8-7)x
2
+ (8
2
-7
2
+6(8-7))x
3
+ (8
3
-7
3
+6(8
2
-7
2
)+6
2
(8-7))x
4
+
(8
4
-7
4
+6(8
3
-7
3
) +6
2
(8
2
-7
2
) +6
3
(8-7))x
5
+ ... +
[8
n-1
-7
n-1
+6(8
n-2
-7
n-2
) +6
2
(8
n-3
-7
n-3
)+...+6
n-3
(8
2
-7
2
)+6
n-2
(8-7) ]x
n
+...

Therefore (before simplification) the closed form solution of the recurrence relation is
[ 8
n-1
-7
n-1
+6(8
n-2
-7
n-2
) +6
2
(8
n-3
-7
n-3
)+...+6
n-3
(8
2
-7
2
)+6
n-2
(8-7) ]
Simplified
[ 6
0
(8
n-1
-7
n-1
)+6(8
n-2
-7
n-2
) +6
2
(8
n-3
-7
n-3
)+...+6
n-3
(8
2
-7
2
)+6
n-2
(8-7) ]
(

=
+ +
2
0
1 2 1 2
) 7 8 ( 6
n
k
k n k n k

(

=

2
0
1 1
) 7 8 ( 6
n
k
k n k n k


The closed form solution of the recurrence relation is
(

=

2
0
1 1
) 7 8 ( 6
n
k
k n k n k



Solution B - IF ZERO 7S IS CONSIDERED TO BE EVEN
S
0
= 1
S
1
= 7
S
n
= 6S
n-1
+ 8
n-1
for n > 1

Let S = s
0
+ s
1
x + s
2
x
2
+ s
3
x
3
+ ... + s
n
x
n
+ ...
6xS = 6s
0
x + 6s
1
x
2
+ 6s
2
x
3
+ ... + 6s
n-1
x
n
+ ...

It follows
S
n
- 6S
n-1
= 8
n-1
for n > 1

By Subtraction
S(1- 6x) = s
0
+ (s
1
- 6s
0
)x + (s
2
-6s
1
)x
2
+ (s
3
-6s
2
)x
3
+... + (s
n
-6s
n-1
)x
n
+ ...

S
2
= 7
2
+ 1 = 50
S
3
= 7
3
+ 3x7 = 364

S(1- 6x) = 1 + x + 8
1
x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+...

S = [1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ... ] / (1-6x)

As 1/(1-6x) = 1 + 6x + 6
2
x
2
+ 6
3
x
3
+ ... + 6
n
x
n
+ ...

S = [(8
1
-7
1
)x
2
+(8
2
-7
2
)x
3
+(8
3
-7
3
)x
4
+..+(8
n-1
-7
n-1
)x
n
+..] *
(1+6x+6
2
x
2
+6
3
x
3
+ .. + 6
n
x
n
+ ...)

S = 1 [1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ...] +
6x [1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ...] +
6
2
x
2
[1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ...+
6
3
x
3
[1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ...+
.
.
6
n
x
n
[(1 + x + 8x
2
+ 8
2
x
3
+ 8
3
x
4
+ ... + 8
n-1
x
n
+ ...] +
...
= 1 + (1+6)x + (8+6+6
2
)x
2
+ (8
2
+6(8) +6
2
+6
3
)x
3
+
(8
3
+6(8
2
)+6
2
(8)+ 6
3
+6
4
)x
4
+
(8
4
+6(8
3
) +6
2
(8
2
) +6
3
(8) + 6
4
+6
5
)x
5
+
... +
[8
n-1
+6(8
n-2
) +6
2
(8
n-3
)+...+6
n-3
(8
2
)+6
n-2
(8) + 6
n-1
+6
n
]x
n
+...

Therefore (before simplification) the closed form solution of the recurrence relation is
[ 8
n-1
+6(8
n-2
) +6
2
(8
n-3
)+...+6
n-3
(8
2
)+6
n-2
(8) + 6
n-1
+6
n
]
Simplified
[ 6
0
8
n-1
+6
1
(8
n-2
) +6
2
(8
n-3
)+...+6
n-3
(8
2
)+6
n-2
(8
1
) + 6
n-1
(8
0
) +6
n
]
(

=
n
n
k
k n k
6 ) 8 ( 6
1
0
1


The closed form solution of the recurrence relation is
(

=

1
0
1
) 8 ( 6 6
n
k
k n k n




Question 2 [2 mks]
a. Determine the limit of f(x) as x for the following:

3 3
5
) (
+

=
x
x
x f [1]
b. For the sequence a and b defined by
a
1
= 2, a
n
= 3a
n 1
, n 2, and b
n
= 2
n
(n 1)

Find
) )( (
7
3
5
2
[
= = j
j
i
i
b a
[1]

Solution 2
[a. Correct solution - 1 mark ]
[ Where question is attempted but incorrect - mark ]
[b. Correct solution - 1 mark ]
[ Where question is attempted but incorrect - mark ]

a.
3 3
5
) (
+

=
x
x
x f

Dividing numerator and denominator by x, we have
x
x f
3
3
5
) (
+

=

As x ,
x
3
0
3
5
3 3
5
) (
lim lim

=
+

=

x
x
x f
x x


b.
) )( (
7
3
5
2
[
= = j
j
i
i
b a
= (a
2
+ a
3
+ a
4
+ a
5
) * (b
3
* b
4
* b
5
* b
6
* b
7
)
= (6 + 18 + 54 + 162) * (16 * 48 * 128 * 320 * 768)

= 240 * 24159191040

= 5,798,205,849,600



Question 3 [5 mks]
Find a formula for the sequence c defined by

=
=
n
i
i n
b c
1
Where b is the sequence {1, 2, 4, 4, 7, 8, 10, } [5]

Solution 3
[For stating an Alternating AP-GP Sequence - 1 mark ]
[First terms a, Common difference d & ratio r, formulae for S
n
- 1 mark ]
[Solving S
n
to produce correct formulae - 2 marks ]
[Correct combination of AP and GP formulae to produce c
n
- 1 mark ]

For the sequence b defined by {1, 2, 4, 4, 7, 8, 10, }

b
1
= 1,
b
2
= 2,
b
3
= 4,
b
4
= 4
b
5
= 7,
b
6
= 8,
b
7
= 10,
b
8
= 16 (assumed)

For odd number indexes in the sequence, we have an Arithmetic Progression, with
a = 1
d = 3
For even number indexes in the sequence, we have a Geometric Progression, with
a = 2
r = 2

We have Alternating AP-GP sequence


For the AP sequence
S
n
= (n/2)(2a + (n-1)d)

= (n/2)(2x1 + (n-1)x3)

= (n/2)(2 + 3n - 3)

= (n/2)(3n - 1)

As in our AP formula c
1
represents S
1
for the odd number indexes
c
1
represents S
1
c
3
represents S
2
c
5
represents S
3
and so on

i.e. c
n
represents S
(n+1)/2

For odd number indexes
S
n
= ( n /2)(3n - 1)
By substitution
c
n
= ( ((n+1)/2) /2)(3((n+1)/2) - 1)

= ( (n+1)/4)((3n+3)/2 - 1)

= ( n/4 + 1/4 )( 3n/2 + )

= ( n + 1 )( 3n + 1 )

= (1/8)( n + 1 )( 3n + 1 )


For the GP sequence
S
n
= a(r
n
- 1)/(r 1)

= 2(2
n
- 1)/(2 1)

= 2(2
n
- 1)

As in our GP formula c
1
represents S
1
for the even number indexes
c
2
represents S
1
c
4
represents S
2
c
6
represents S
3
and so on

i.e. c
n
represents S
n/2

For even number indexes
S
n
= 2 (2
n
- 1)
By substitution
c
n
= 2 (2
n/2
- 1)


When n is odd,
c
n
= c
n
(for odd) + c
n-1
(for even)
= (1/8)( n + 1 )( 3n + 1 ) + 2(2
(n-1)/2
- 1)
When n is even,
c
n
= c
n
(for even) + c
n-1
(for odd)
= 2(2
n/2
- 1) + (1/8)( (n-1) + 1 )( 3(n-1) + 1 )
= 2(2
n/2
- 1) + (1/8)( n )( 3n - 3 + 1 )
= 2(2
n/2
- 1) + (1/8)( n )( 3n - 2 )


Question 4 [3 mks]
Let f(n) and g(n) be functions defined on the set of positive integers
Prove or disprove the following:
if f (n) = (h(n)) and g(n) = ( k(n))
then f(n)g(n) = (h(n)k(n)). [3]

Solution 4
[Stating f(n) and g(n) in terms of the inequality - 1 mark ]
[Stating that | f(n) | | g(n) | = | f(n) g(n) | for positive integers - mark ]
[Logical steps of the Proof - 1 marks ]

f(n) = O(h(n))
| f(n) | C
1
| h(n) |
where C
1
is a constant
g(n) = O(k(n))
| g(n) | C
2
| k(n) |
where C
2
is a constant
By Multiplication
| f(n) | | g(n) | C
1
C
2
| h(n) | | k(n) |
As f(n) and g(n) are functions defined on the set of positive integers
| f(n) | | g(n) | = | f(n) g(n) | C
1
C
2
| h(n) | | k(n) |

| f(n) g(n) | C
1
C
2
| h(n) | | k(n) |

| f(n) g(n) | C
3
| h(n) | | k(n) |
where C
3
is a new constant

Where h(n) and k(n) are functions defined on the set of positive integers
| f(n) g(n) | C
3
| h(n) | | k(n) | = C
3
| h(n) k(n) |

| f(n) g(n) | C
3
| h(n) k(n) |

f(n) g(n) = O(h(n) k(n))



Question 5 [2 mks]
What is the limit of
=

n
k
k
n as x
0
? State all necessary
conditions for this limit to exist. [2]
Solution 5
[Correct limit found - 1 marks ]
[Necessary conditions - mark ]

As n

=
n
k
k
x
0
= 1 + x + x
2
+ x
3
+

By Generating Functions definition, n as
1 + x + x
2
+ x
3
+ = 1 / (1 - x)

Condition: x 1



Question 6 [7 mks]
Use generating functions to find a closed form solution for each of the following
recurrence relations:

i. a
0
= 1 and a
n
= 3a
n-1
+ 2 for n 1 [3]

ii. s
0
= 6, s
1
= 5 and 9S
n
= 6S
n-1
- S
n-2
for n 0 [4]

Solution 6
[i. Correct initial layout of solution 1
st
2 statements - mark ]
[ Application of Correct combining i.e. Subtraction - mark ]
[ Logical steps towards correct solution - 2 marks]
[ Where full mark is not attained, but there was simplification of solution included ]
[ additional mark ]
[ii. Correct initial layout of solution 1
st
3 statements - 1 mark ]
[ Application of Correct combining i.e. Subtraction & Addition - 1 mark ]
[ Logical steps towards correct solution - 3 marks ]
[ Where full mark is not attained, but there was simplification of solution included ]
[ additional mark ]

i. Given
a
0
= 1
a
n
= 3a
n-1
+ 2 , n1

Consider the generating function
f(x) = a
0
+a
1
x+ a
2
x
2
++ a
n
x
n
+
3xf(x) = 3a
0
x+3a
1
x
2
++3a
n-1
x
n
+

It follows
a
n
- 3a
n-1
= 2

Subtracting
f(x) - 3xf(x) = a
0
+ (a
1
- 3a
0
)x + (a
2
- 3a
1
)x
2
++ (a
n
- 3a
n-1
)x
n
+
Now Substituting a
0
= 1, a
1
= 3a
0
,, a
n
= 3a
n-1

(1-3x)f(x) = 1 + 2x + 2x
2
++ 2x
n
+
= -1 + 2 (1 + x + x
2
++ x
n
+)

f(x) = (-1 + 2 (1 + x + x
2
++ x
n
+)) * (1 / (1-3x))
f(x) = (-1 + 2 (1 + x + x
2
++ x
n
+)) * (1 + 3x + 3
2
x
2
++ 3
n
x
n
+)

f(x) = -1 * (1 + 3x + 3
2
x
2
++ 3
n
x
n
+)
+ 2 [ 1 * (1 + 3x + 3
2
x
2
++ 3
n
x
n
+)
+ x * (1 + 3x + 3
2
x
2
++ 3
n
x
n
+)
+ x
2
* (1 + 3x + 3
2
x
2
++ 3
n
x
n
+

+ x
n
* (1 + 3x + 3
2
x
2
++ 3
n
x
n
+) ]

f(x) = -1 * (1 + 3x + 3
2
x
2
++ 3
n
x
n
+)
+ 2 [ 1 + (3 + 1)x + (3
2
+3+1)x
2
+ + (3
n
+3
n-1
++3
2
+3+1) x
n
+ ]

Therefore the closed form solution is
[ -3
n
+ 2 (3
n
+3
n-1
++3
2
+3+1) ]
or
(

+

=
n
k
k n
0
3 2 3


ii. S
0
= 6
S
1
= 5 and
9S
n
= 6S
n-1
- S
n-2
for n 2

Let S = s
0
+ s
1
x + s
2
x
2
+ s
3
x
3
+ ... + s
n
x
n
+ ...

9S = 9s
0
+ 9s
1
x + 9s
2
x
2
+ 9s
3
x
3
+ ... + 9s
n
x
n
+ ...
6xS = 6s
0
x + 6s
1
x
2
+ 6s
2
x
3
+ . . . + 6s
n-1
x
n
+ ...
x
2
S = s
0
x
2
+ s
1
x
3
+ . . . + s
n-2
x
n
+ ...

9S
n
- 6S
n-1
+ S
n-2
= 0

By Subtraction and Addition
S(9- 6x+x
2
) = 9s
0
+ (9s
1
- 6s
0
)x + (9s
2
-6s
1
+s
0
)x
2
+ ... + (9s
n
-6s
n-1
+ s
n-2
)x
n
+ ...
= 54 + 9x
Dividing through by 9
S(1- (2/3)x+(1/9)x
2
) = 6 + x

S(1-(1/3)x) (1-(1/3)x) = 6 + x
S = (6 + x) / [(1-(1/3)x)(1-(1/3)x)] or (6 + x) / [(1-(1/3)x)]
2


As 1/(1-(1/3)x) = 1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...

S = (6+x)(1+(1/3)x+(1/3)
2
x
2
+ ...+(1/3)
n
x
n
+ ...) (1+(1/3)x+(1/3)
2
x
2
+ ... +(1/3)
n
x
n
+ ...)
= (6+x) * [
1 (1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...) +
(1/3)x (1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...) +
(1/3)
2
x
2
(1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...) +
(1/3)
3
x
3
(1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...) +
.
.
(1/3)
n
x
n
(1 + (1/3)x + (1/3)
2
x
2
+ (1/3)
3
x
3
+ ... + (1/3)
n
x
n
+ ...)+ ]
= (6+x) [1+2(1/3)x + 3(1/3)
2
x
2
+ 4(1/3)
3
x
3
+...+ n(1/3)
n-1
x
n-1
+(n+1)(1/3)
n
x
n
+...]

= 6 * [1+2(1/3)x + 3(1/3)
2
x
2
+ 4(1/3)
3
x
3
+...+ n(1/3)
n-1
x
n-1
+(n+1)(1/3)
n
x
n
+...]
+ x [1+2(1/3)x + 3(1/3)
2
x
2
+ 4(1/3)
3
x
3
+...+ n(1/3)
n-1
x
n-1
+(n+1)(1/3)
n
x
n
+...]

= 6 + [6*2(1/3)+1]x + [6*3(1/3)
2
+2(1/3)]x
2
+ [6*4(1/3)
3
+3(1/3)
2
]x
3
+
+ [6*5(1/3)
4
+4(1/3)
3
]x
4
+...
+ [6*(n+1)(1/3)
n
+n(1/3)
n-1
]x
n
+...

Therefore (before simplification) the closed form solution of the recurrence relation is
[6 * (n+1) (1/3)
n
+ n (1/3)
n-1
]
Simplified
[6 * (n+1) (1/3)
n-1+1
+ n (1/3)
n-1
]
[(1/3)
n-1
(6 * (n+1) (1/3)
1
+ n) ]
[(1/3)
n-1
(6 * (1/3)
1
(n+1)

+ n) ]
[(1/3)
n-1
(2 * (n+1)

+ n) ]
[(1/3)
n-1
(3n+2) ]

The closed form solution of the recurrence relation is
[ (1/3)
n-1
(3n+2) ]
or [ (1/3)
n
(1/3)
-1
(3n+2) ]
or [ (1/3)
n
(3)

(3n+2) ]
or [ (1/3)
n
(9n+6) ]




Question 7 [8 mks]
Let a,b,c be integers such that a 1, b > 1 and c > 0. Let f: N R be functions
where N is the set of Natural numbers and R is the set of Real numbers
such that
f(1) = c and f(n) = af(n/b) + c
for n = b
k
, where k is a positive integer greater than 1.

(a) By using the principles of Recurrence Relation, find a general formula
for f(n) [4]
(b) Hence show that if a 1, then f(n) = ) (
1
) 1 (
log
log
a
a
b
b
n
a
an c
O =


[4]

Solution 7
[(a) Logical steps outlined towards finding general equation - 3 marks ]
[ Finding general equation f(n) - 1 mark ]
[(b) Making substitutions and finding f(n) = ca
log
b
n
+ c

=
1 log
0
n
i
i
b
a
- 1 mark ]
[ Proving Big-Oh - 2 marks ]
[ Proving Omega - 1 mark ]
[Where error is made in any of the above but proofs for Big-Oh and Omega were
attempted and full mark is not attained - mark ]

(a) f(n) = a f(n/b) + c .....1

Substituting for f(n/b)
= a [ a f(n/b
2
) + c ] + c

= a
2
f(n/b
2
) + c(a + 1) .....2

Substituting for f(n/b
2
)
= a
2
[ a f(n/b
3
) + c ] + c(a + 1)

= a
3
f(n/b
3
) + c(a
2
+ a + 1) .....3

Substituting for f(n/b
3
)
= a
3
[ a f(n/ b
4
) + c ] + c(a
2
+ a + 1)

= a
4
f(n/b
4
) + c(a
3
+ a
2
+ a + 1) .....4

= ......

Given that k is a positive integer greater than 1
f(n) = a
k
f(n/b
k
) + c

=
1
0
k
i
i
a



(b) As n = b
k


n/b
k
= 1 AND log
b
n = k

As k = log
b
n AND n/b
k
= 1 AND if a 1 AND f(1) = c
f(n) = a
k
f(n/b
k
) + c

=
1
0
k
i
i
a

= a
k
f(1) + c

=
1
0
k
i
i
a

= a
k
* f(1) + c * [a
k-1
+ a
k-2
++ a
3
+ a
2
+ a + 1]

As f(1) = c, and k = log
b
n

f(n) = ca
log
b
n
+ c

=
1 log
0
n
i
i
b
a

f(n) = ca
log
b
n
+ c [a
log
b
n-1
+ a
log
b
n-2
++ a
3
+ a
2
+ a + 1]

= c[a
log
b
n
+ a
log
b
n-1
+ a
log
b
n-2
++ a
3
+ a
2
+ a + 1]



Further, as log
b
n = k AND k is a positive integer greater than 1

f(n) c[a
log
b
n
+ a
log
b
n
+ a
log
b
n
++ a
log
b
n
+ a
log
b
n
+ a
log
b
n
+ a
log
b
n
]


c(n+1)a
log
b
n


Therefore
f(n) = O(a
log
b
n
)


Likewise
f(n) = ca
log
b
n
+ c

=
1 log
0
n
i
i
b
a

f(n) ca
log
b
n

Therefore
f(n) = (a
log
b
n
)

Hence
f(n) = (a
log
b
n
)



Question 8 [4 mks]
Consider the geometric series:
3 + 12/7 + 48/49 + 192/343 +

i. Determine a formula for S
n

where S
n
is the sum of the first n terms of the series? [3]

ii. What is the limit of S
n
[1]

Solution 8
[i. Common ratio, r - mark ]
[ Correct formula for S
n
- mark ]
[ Solving S
n
to produce a correct formula - 2 marks ]
[ii. Correct formula for |r| < 1 - mark ]
[ Correct solution for limit of S
n
- mark ]

i. For a geometric progression
u
n
= ar
n-1


u
1
= a = 3
u
2
= ar = 12/7

r = ar / a = (12/7) / 3
= 12/21
= 4/7

S
n
= a(r
n
- 1)/(r - 1)

S
n
= 3((4/7)
n
- 1) / (4/7 - 1)

= 3((4/7)
n
- 1) / -3/7

= 3(1 - (4/7)
n
) / 3/7

= 3(1 - (4/7)
n
) * 7/3

= 7(1 - (4/7)
n
)
or

7 - 7(4/7)
n

or

-7( (4/7)
n
- 1)
or

-7(4/7)
n
+ 7

ii. Where |r| < 1
Limit of S
n
= a / (1 r)
= 3 / (1 4/7)
= 3 / (3/7)
= 7


Question 9 [6 mks]
Find the generating function for the sequence

{1, 4, 13, 28, 49, } [6]
Solution 9
[Logical steps towards correct solution - 3 marks ]
[Correct interpretation of operations and computation - 2 marks ]
[Correct Final Solution - 1 mark ]
We have {1, 1, 1, 1, } 1 + x + x
2
+ x
3
+ x
4
+
x 1
1

By Differentiating
{1, 2, 3, 4,5 }
2
) 1 (
1
x



By Right-shifting, 1 place
{0, 1, 2, 3, 4, }
2
) 1 ( x
x


By Differentiating, again
For LHS
{1, 4, 9, 16, }
For RHS

2
2
) 1 (
) 1 (

= x x
x
x
y Let

dx
dp
dp
dv
U
dx
du
V
dx
dy
then
dx
dp
dp
dv
dx
dv
and
p v x p Let
Further
dx
dv
U
dx
du
V
dx
dy
then
v u y x v x u Let
+ =
=
= =
+ =
= = =

2
2
, 1
, ) 1 ( ,

3
3
3 2
3 2
3 2
2
2
) 1 (
1
) 1 (
2 1
) 1 (
2
) 1 (
1
) 1 ( 2 ) 1 (
) 1 ( ) 2 ( ) 1 ( ) 1 (
) 1 ( ) (
) 1 (
x
x
x
x x
x
x
x
x x x
p x x
dx
x d
dp
p d
x
dx
dx
x
dx
dy

+
=

+
=

=
+ =
+ =

+ =


Therefore

{1, 4, 9, 16, 25,}
3
) 1 (
1
x
x

+

By Right-shifting, 1 place
{0, 1, 4, 9, 16,,}
3
) 1 (
) 1 (
x
x x

+

By Scaling, with factor of 3
{0, 3, 12, 27, 48, }
3
) 1 (
) 1 ( 3
x
x x

+

By Addition of generating function {1, 1, 1, 1, ...}
For LHS
{1, 4, 13, 28, 49, }
For RHS

3
2
3
2 2
3
2
3
) 1 (
1 4
) 1 (
2 1 3 3
) 1 (
) 1 ( ) 1 ( 3
1
1
) 1 (
) 1 ( 3
x
x x
x
x x x x
x
x x x
x x
x x

+ +
=

+ + +
=

+ +
=

+
=

{1, 4, 13, 28, 49, }
3
2
) 1 (
1 4
x
x x

+ +

Therefore the generating function for the sequence {1, 4, 13, 28, 49, } is
3
2
) 1 (
1 4
x
x x

+ +

You might also like