0% found this document useful (0 votes)
152 views12 pages

Report On Recursion

The document is a report on recurrence relations and generating functions submitted by four students. It contains: 1. An introduction to discrete mathematics and everyday applications. 2. An explanation of the Fibonacci problem and recurrence relations using the Fibonacci sequence as an example. 3. Details on first order and second order linear homogeneous recurrence relations, including the backtracking and characteristic equation methods for solving them. 4. A definition of generating functions as a way to associate a continuous function with a discrete sequence to enable analysis using calculus. Examples are provided of generating functions for different sequences. 5. An explanation of how generating functions can be used to solve recurrence relations by translating the relation into an equation involving

Uploaded by

gouri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views12 pages

Report On Recursion

The document is a report on recurrence relations and generating functions submitted by four students. It contains: 1. An introduction to discrete mathematics and everyday applications. 2. An explanation of the Fibonacci problem and recurrence relations using the Fibonacci sequence as an example. 3. Details on first order and second order linear homogeneous recurrence relations, including the backtracking and characteristic equation methods for solving them. 4. A definition of generating functions as a way to associate a continuous function with a discrete sequence to enable analysis using calculus. Examples are provided of generating functions for different sequences. 5. An explanation of how generating functions can be used to solve recurrence relations by translating the relation into an equation involving

Uploaded by

gouri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Karnataka Law Society’s

Gogte Institute of Technology, Belgaum.

Report on,

Recurrence Relation & Generating Function


Submitted to: Prof. Jeetendra R. Gurjar
By,

Name Roll No. USN Signature


Shradha.M.Patil I2 2GI20CS144

Gouri.N.Huddar I 45 2GI20EE009

Omprakash Jat I 47 2GI20IS020

Smruti .S.Bhandiwad I 49 2GI20IS041

Page 1 of 12
Contents:
1. Introduction to Discrete Mathematics

2. Fibonacci Problem

3. Recurrence Relations

4. Generating Functions

5. Applications of Generating functions

Page 2 of 12
What is Discrete Mathematics?
 Discrete mathematics is the study of mathematical structures that are
countable or otherwise distinct and separable. 
  Examples of structures that are discrete are combinations, graphs,
and logical statements. Discrete structures can be finite or infinite.
 Discrete mathematics is in contrast to continuous mathematics, which
deals with structures which can range in value over the real numbers , or
have some non-separable quality. 
Everyday Applications of Discrete Mathematics
Computers
The software and files are both stored as huge strings of 1s and 0s. Binary
math is discrete mathematics.
Google Maps 
It uses discrete mathematics to determine fastest driving routes and times
Cryptography
Encryption and decryption are part of cryptography, which is part of
discrete mathematics. For example, secure internet shopping uses public-
key cryptography
Digital image processing
It uses discrete mathematics to merge images or apply filters
Example:
Tower of Hanoi
The objective of the puzzle is to move entire stack to another rod
obeying the following rules :
• Only one disk may move at a time.
• Each move consists of taking upper disk from one of the rods & sliding it
onto another rod, on top of the other disks that may already be present on
that rod.
• No disk may be placed on top of a smaller disk.

Page 3 of 12
 Step 1 − Move n-1 disks from source to aux
 Step 2 − Move nth disk from source to dest
 Step 3 − Move n-1 disks from aux to dest
Total Number of moves needed to solve for | | given ‘N’ disks : 2n – 1 |

Fibonacci Problem:
 A farmer raises rabbits. Each rabbit gives birth when 2 months old and
then each month there after.
 Question: How many rabbits will the farmer have after n months? Try it
on small numbers.
 Fn ... the number of rabbits after n month. Each rabbit alive the n-1th
month remains nth month. Each rabbit alive the n − 2th month adds one
more rabbit to nth month.
F1 = 1
F2 = 1
Fn+1 = Fn + Fn−1 if n ≥ 2
 This formula is an example of a recurrence formula (as opposite to an
explicit formula).
 Recurrence formulas are often easy to obtain (and easy to code). Often
we extend the sequence by starting,
F0 = 0,
F1 = 0,
F2 = 1 Fn+1 = Fn + Fn−1 if n ≥ 1

Page 4 of 12
 Sequence of Fibonacci numbers 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,
233, . .
 For that reason, Fibonacci numbers have been studied in detail. Some
basic identities: F0 + F1 + F2 + · · · + Fn = Fn+2 − 1 F1 + F3 + F5 + · · ·
+ F2n−1 = F2n F0 − F1 + F2 − F3 + · · · − F2n−1 + F2n = F2n−1 − 1
Fn−1Fn+1 − F 2 n = (−1)n

Recurrence relations:
A recurrence relation is an equation that recursively defines a sequence where
the next term is a function of the previous terms (Expressing Fn as some
combination of Fi with i<n).
Example − Fibonacci series − Fn=Fn−1+Fn−2Fn, Tower of Hanoi − Fn=2Fn−1

Types of recurrence relations


 First order Recurrence relation: -
 A recurrence relation of the form: an = can-1 + f(n) for n>=1
where c is a constant and f(n) is a known function is called linear
recurrence relation of first order with constant coefficient. If f(n) = 0, the
relation is homogeneous otherwise non-homogeneous.
Example :- xn = 2xn-1 – 1, an = nan-1 + 1, etc.
Backtracking Method
The first method is called backtracking, and consists of taking a
linear recurrence defining an, and replace the terms an-1,an-2,... with
the relation that defines an, but where n is replaced by n - 1, n - 2, etc.
 Example:- an=an-1 +3 , a1=2
Then an-1 = an-2 +3
an-2 = an-3 +3
an-3 = an-4 +3 and so on.
Therefore,
an=an-1 +3
=(an-2 +3 )+3 =an-2 +2*3
=(an-3 +3)+6 =an-3 +3*3 . . .

Page 5 of 12
=a1+(n-1)*3.
So,
an =2+(n-1)*3

Second order liner homogenous recurrence relation:


Definition:
A recurrence relation of the form
Ban + Can-1 + Dan-2 = 0 ——> (1)

is called a second order linear homogeneous recurrence relation with constant


coefficients.
Solution to this is in form an = rn where r!=0
Putting this in (1)
Brn + Crn-1 + Drn-2 = 0
r2 + r + 1 = 0 —–> (2)

Thus, an = rn is solution of (1) if r satisfies quadratic equation (2). This equation
is called characteristic equation for relation (1).
Various Cases
1. Real and Distinct roots
2. Complex roots
3. Repeated Real Roots

Procedure to solve:
 Given equation
 Change the given equation a n into r n
 Divide by the lowest valueof r
 Quadric equation
 Find the two roots r1 , r2
 Solve

Case 1: When Roots are Real & Distinct


If the two roots k1, k2 of equation are real and distinct then, we take
an = A(k1)n + B(k2)n 

Page 6 of 12
as general solution of (1) where A and B are arbitrary real constants.
Example:
an =5a n−1−6 an−2 where a 0=1 a1=1
= r n −5 r n−1+6 r n−2=0

= Divide by lowest power


= r 2−5 r + 6=0

= r1 =3 r2 =2
= an = A(r1)n + B(r2)n
= n=0, n=1,
= A+B=1 3A+2B=1
= Solving we get A=-1 B=-2
= an = -1(3)n + 2(2)n
Case 2: When Roots are Real & Equal
If the two roots k1, k2 of equation are real and equal, with k as common value
then, we take
an = (A + Bn)kn 
as general solution of (1) where A and B are arbitrary real constants.
Case 3: When Roots are Complex
If the two roots k1 and k2 of equation are complex then, k1 and k2 are complex
conjugate of each other i.e k1 = p + iq and k2 = p – iq and we take

an = rn(Acosnθ + Bsinnθ) 


as general solution of (1) where A and B are arbitrary complex constants, r = |k1|
= |k2| = √p2 + q2 and θ = tan-1(q/p).

Generating Function:
Page 7 of 12
Working with a continuous function is sometimes much easier than working
with a sequence. For example, in the analysis of functions, calculus is very
useful. However, the discrete nature of sequences prevents us from using
calculus on sequences. A generating function is a continuous function
associated with a given sequence. For this reason, generating functions are very
useful in analyzing discrete problems involving sequences of numbers or
sequences of functions.
Definition
Let a 0 , a 1, a 2, a 3….. ∞ be a sequence of real numbers denoted as {a n}
Then a series in power of x, such that
G(x)= a 0+ a1 x +a 2 x 2+ a3 x3 …..  ∞

G(x)=∑ an x n , is called a generating function of series {a n}
n=0

Example:
1) If we have a sequence with a n=n+1 Then the generating function for this
sequence is,

G(x)= ∑ (n+1) x n
n=0

Find the generating function for the series 1, -1 , 1 , -1 , 1,…. ∞


Solution:
Let a n=1, -1 , 1 , -1 ,….. ∞
WKT,
G(x)= a 0+ a1 x +a 2 x 2+ a3 x3 …..  ∞
a 0=1 , a 1=-1 , a 2=1,…..

G(x)= 1−x + x 2−x 3 …..  ∞


1
G(x)= 1+ x {Closed form of the series }

Similarly, The generating function for the series 1, 1, 1, 1.. ∞ is,


1
G(x)= 1−x

2) Find the Generating function for the sequence 3, 7, 11, 15….

Page 8 of 12
Solution:
Let a n=3, 7, 11, 15….. ∞
We know that,
G(x)= a 0+ a1 x +a 2 x 2+ a3 x3 …..  ∞
a 0=3, a 1=7 , a 2=15,…..

G(x)= 3+7 x +11 x 2+15 x 3 …..  


xG(x)= 3 x+ 7 x 2 +11 x 3 …..   (Multiply by x and subtract)
(1-x)G(x)= 3+ 4 x+ 4 x 2 +4 x 3 ….. 
4x
(1-x)G(x)= 3+ 1−x

3 4x
G(x)= 1−x + 2
(1−x)

Page 9 of 12
Page 10 of 12
Solving Recurrence Relation Using
Generating function:
Generating function can be used to solve recurrence relation
Procedure :
Translate a recurrence relation for the terms of a sequence into an equation
involving generating function
This equation can be solved to find a closed form of the generating function
From this closed form, the coefficients of the power series for the generating
function can be found solving the original recurrence relation
Solve the recurrence relation a k =3 ak −1for k=1,2,3.. and given a 0=2
Solution:
Let G(x) be the generating function for the sequence {a k}

i.e. G(x)= ∑ ak x k
k=0

∞ ∞
xG(x)= ∑ ak x = ∑ ak−1 x k
k+1

k=0 k =1

Using the recurrence relation, we get


∞ ∞

G(x) – 3xG(x) = ∑ ak x k −3 ∑ a k−1 x k


k=0 k=1


G(x) – 3xG(x) = a 0+ ¿ ∑ ¿ ¿ ) x k
k=0

(1 – 3x)G(x) = 2
2
G(x)= 1−3 x

G(x)=2 ∑ 3k x k
k=0

Hence a k= 2 ⋅3k

Page 11 of 12
Applications of Generating function
 Generating functions are used in a wide area from statistics to mechanics,
from combinations to cryptology, especially in topics involving
sequences.

They help us
 to find the explicit formula for the general term of a sequence
 to find recurrence relations
 to compute averages and some other statistical properties
 to prove some mathematical identities

Page 12 of 12

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy