SlideShare a Scribd company logo
1 of 36
Solving
Recurrences
using
Generating
Functions
To solve the recurrence relation by
generating functions, we have numeric
function for the closed form expression of
generating function
A(z) = a0 + a1z + a2z2 + a3z3 + …
Generating function Numeric function
A(z) =
𝟏
πŸβˆ’π’‚π’›
A(z) =
1
1βˆ’π‘§ 2
A(z) =
𝒛
πŸβˆ’π’› 𝟐
A(z) =
𝒂𝒛
πŸβˆ’π’‚π’› 𝟐
A(z) = 𝒆 𝒛
A(z) = 𝟏 + 𝒛 𝒏
𝒂 𝒓
(r + 1)
r
rar
𝟏
𝒏!
𝒏 < 𝒓, 𝟎 ≀ 𝒓 ≀ 𝒏
𝟎, 𝒓 > 𝒏
Example 1:
Solve recurrence relation by generating function
1. Multiply both sides by zr
Steps to follow
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
a r - 2 1
r
- 3
2
r
= 0r
z ar-
z ar-
z
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
2. Since r ο‚³ 2, summing for all r, we get
arzr – 2 ar-1zr – 3 ar-2zr = 0
r = 2
ο‚₯
r = 2
ο‚₯
r = 2
ο‚₯
Solving individually
For the 1st term:
 arzr = a2z2 + a3z3 + a4z4 + οƒ—οƒ—οƒ—r = 2
ο‚₯
A(z) = a0 + a1z + a2z2 + a3z3 + …
 arzr = A(z) - a0 - a1zr = 2
ο‚₯
  
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
For the 2nd term:
 ar-1zr = a1z2 + a2z3 + a3z4 + οƒ—οƒ—οƒ—
r = 2
ο‚₯
Factoring out z:
 ar-1zr = z[A(z) – a0 ]r = 2
ο‚₯
A(z) = a0 + a1z + a2z2 + a3z3 + …
Z(a1z + a2z2 + a3z3 + οƒ—οƒ—οƒ—)
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
For the 3rd term:
 ar-2zr = a0z2 + a1z3 + a2z4 + οƒ—οƒ—οƒ—
r = 2
ο‚₯
Factoring out z2:
 ar-2zr = z2[A(z)]r = 2
ο‚₯
A(z) = a0 + a1z + a2z2 + a3z3 + …
z2( a0 + a1z + a2z2 + οƒ—οƒ—οƒ—)
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
Substitute
 ar-2zr = z2[A(z)]r = 2
 arzr – 2 ar-1zr – 3  ar-2zr = 0
r = 2
ο‚₯
r = 2
ο‚₯
r = 2
ο‚₯
by
 arzr = A(z) - a0 - a1zr = 2
ο‚₯
ο‚₯
 ar-1zr = z[A(z) – a0 ]r = 2
ο‚₯
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
We get
z2[A(z)]A(z) - a0 - a1z z[A(z) – a0 ]– 2 – 3
Substitute the value of a0 = 3; a1 = 1
A(z) – 3 - (1)z z[A(z) – 3 ]– 2 – 3z2[A(z)]
simplify
A(z) =
πŸ‘ βˆ’πŸ“π’›
𝟏 βˆ’πŸπ’› βˆ’πŸ‘π’› 𝟐
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
By partial fraction
A(z) =
πŸ‘ βˆ’πŸ“π’›
𝟏 βˆ’πŸπ’› βˆ’πŸ‘π’› 𝟐
A(z) =
πŸ‘ βˆ’πŸ“π’›
(𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛)
πŸ‘ βˆ’πŸ“π’›
(𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛)
=
𝟏
(𝟏 βˆ’πŸ‘π’›)
𝟐
(𝟏 + 𝒛)
+
Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1
πŸ‘ βˆ’πŸ“π’›
(𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛)
=
𝟏
(𝟏 βˆ’πŸ‘π’›)
𝟏
(𝟏 + 𝒛)
+
From the table previously presented:
A(z) =
𝟏
πŸβˆ’π’‚π’›
𝒂 𝒓
ar = 1 οƒ— 3r + 2 οƒ— (-1)r
Example 2
G(x) = a0 + a1x + a2x2 + οƒ— οƒ— οƒ— =  anxn:
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Let G(x) be the generating function for the sequence
a0; a1; a2; : : :. That is,
We will use generating functions to obtain a formula
for an.
ο‚₯
n=0
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
The first step in the process is to use the
recurrence relation to replace
This can only be done when n ο‚³ 2,
an by an-1 - 6an-2.
so the first two terms (arising form the initial
conditions) need to be separated from the
sigma notation to obtain:
G(x) = a0 + a1x +  anxn
= a0 + a1x + (an-1 - 6an-1)xn
= a0 + a1x +  an-1xn- 6an-1xn
ο‚₯
n=2
ο‚₯
n=2
ο‚₯
n=2
ο‚₯
n=2
= a0 + a1x + x  an-1xn-1- 6x2an-2xn-2
ο‚₯
n=2
ο‚₯
n=2
In the last line above, constants and powers of x have
been factored out
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
so that the power to which x is raised β€œinside"
each sum exactly matches the subscript on the
coefficient ai.
which will make it easy to recognize each
summation as being G(x), with a few terms
possibly missing.
The reason for doing this is that the next step is
to make a change of index (on the subscripts),
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
In the first sum
When n = 2, k = 1
ο‚₯
n=2
Put k = n - 1
 an-1xn-1
As n goes to infinity, so does k.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
ο‚₯
k=2
 akxk = G(x) - ao
the sum becomes
With this change of index,
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
In the next sum
ο‚₯
n=2
 an-2xn-2
When n = 2, k = 0
Put k = n - 2
As n goes to infinity, so does k.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
ο‚₯
k=0
 akxk = G(x)
the sum becomes
With this change of index,
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Combining these steps,
we arrive at
G(x) = a0 + a1x + x(G(x) - a0) - 6x2G(x).
After plugging in the known values for
a0 and a1,
then rearranging
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
G(x) =
𝟏 + πŸ’π’™
𝟏 βˆ’ 𝒙 + πŸ”π’™ 𝟐
this becomes
(1 - x + 6x2)G(x) = 1 + 4x.
Hence, we obtain the closed form
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Notice the similarity of the coefficients in
1 - x + 6x2 and an – an-1 + 6an-2.
The next step is to use partial fractions to
determine the power series representation
of
1
1 βˆ’ π‘₯ + 6π‘₯2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
We will eventually want the
sum of coefficient of xn and
four times the coefficient of xn-1
in this series.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Next, we want to write
1- x + 6x2
If  and  are integers,
they are positive among the
divisors of 6 and their negatives.
(1- x)(1- x).=
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Multiplying
(1- x)(1- x).
we have,
1 - x - x + x2
 = 6
 = 1- 
lead to
-  - = -1 or
1- x + 6x2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
 = 6
Therefore,
(1- ) = 6
- 2 = 6
and the quadratic formula gives
∝ =
1 Β± 𝑖 23
2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Let,
𝛼 =
1 βˆ’ 𝑖 23
2
𝛽 =
1 + 𝑖 23
2
So that
If, 1
1 βˆ’ π‘₯ + 6π‘₯2
=
𝐴
1 βˆ’ 𝛼π‘₯
+
𝐡
1 βˆ’ 𝛽π‘₯
=
𝐴 1 βˆ’ 𝛽π‘₯ + 𝐡(1 βˆ’ 𝛼π‘₯)
(1 βˆ’ 𝛼π‘₯)(1 βˆ’ 𝛽π‘₯)
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
-A - B = 0
then, equating coefficients of like powers of x
from the leftmost and rightmost expressions
gives the two equations in the two
unknowns A and B:
A + B = 1
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
so that ( -  )A =  .
Since  -  = -i 23,
the quantity
𝐴 =
𝛼
βˆ’i 23
=
1 βˆ’ 𝑖 23
βˆ’2i 23
𝑖 23
i 23
οƒ— =
23 + 𝑖 23
46
B = 1 - A =
and, therefore,
23 βˆ’ 𝑖 23
46
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Hence,
1
1 βˆ’ π‘₯ + 6π‘₯2
=
𝐴
1 βˆ’ 𝛼π‘₯
+
𝐡
1 βˆ’ 𝛽π‘₯
ο‚₯
n=0
A 𝛼nxn= +
ο‚₯
n=0
B 𝛽nxn
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
The coefficient of xn is
A𝛼 + 𝐡𝛽 = +
23 + 𝑖 23
46
1 βˆ’ 𝑖 23
2
𝑛
23 βˆ’ 𝑖 23
46
1 + 𝑖 23
2
𝑛
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
The coefficient of xn in
G(x) =(1+πŸ’π±)
and 4 times the coefficient of xn-1 in,
is the sum of the coefficient of xn in
1
1 βˆ’ π‘₯ + 6π‘₯2
𝟏
𝟏 βˆ’ 𝒙 + πŸ”π’™ 𝟐
1
1 βˆ’ π‘₯ + 6π‘₯2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
which equals
+
23 + 𝑖 23
46
1 βˆ’ 𝑖 23
2
𝑛
23 βˆ’ 𝑖 23
46
1 + 𝑖 23
2
𝑛
+ +
23 + 𝑖 23
46
1 βˆ’ 𝑖 23
2
π‘›βˆ’1
23 βˆ’ 𝑖 23
46
1 + 𝑖 23
2
π‘›βˆ’1
4 οƒ— 4 οƒ—
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
Generating functions solve recurrence

More Related Content

What's hot

Unit vi
Unit viUnit vi
Unit vimrecedu
Β 
CMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical InductionCMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical Inductionallyn joy calcaben
Β 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relationsnszakir
Β 
Introduction to Differential Equations
Introduction to Differential EquationsIntroduction to Differential Equations
Introduction to Differential EquationsVishvaraj Chauhan
Β 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxMdSiddique20
Β 
Discrete Mathematics - Mathematics For Computer Science
Discrete Mathematics -  Mathematics For Computer ScienceDiscrete Mathematics -  Mathematics For Computer Science
Discrete Mathematics - Mathematics For Computer ScienceRam Sagar Mourya
Β 
The chain rule
The chain ruleThe chain rule
The chain ruleJ M
Β 
Numerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesNumerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesDr. Nirav Vyas
Β 
Mathematical induction by Animesh Sarkar
Mathematical induction by Animesh SarkarMathematical induction by Animesh Sarkar
Mathematical induction by Animesh SarkarAnimesh Sarkar
Β 
First Order Differential Equations
First Order Differential EquationsFirst Order Differential Equations
First Order Differential EquationsItishree Dash
Β 
Markov Chains
Markov ChainsMarkov Chains
Markov Chainsguest8901f4
Β 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical inductionrey castro
Β 
Nams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsNams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsRuchi Maurya
Β 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equationsAhmed Haider
Β 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relationsallyn joy calcaben
Β 
Continutiy of Functions.ppt
Continutiy of Functions.pptContinutiy of Functions.ppt
Continutiy of Functions.pptLadallaRajKumar
Β 
partial diffrentialequations
partial diffrentialequationspartial diffrentialequations
partial diffrentialequations8laddu8
Β 

What's hot (20)

Unit vi
Unit viUnit vi
Unit vi
Β 
Jacobi method
Jacobi methodJacobi method
Jacobi method
Β 
CMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical InductionCMSC 56 | Lecture 11: Mathematical Induction
CMSC 56 | Lecture 11: Mathematical Induction
Β 
Fuzzy Logic
Fuzzy LogicFuzzy Logic
Fuzzy Logic
Β 
Chapter 2: Relations
Chapter 2: RelationsChapter 2: Relations
Chapter 2: Relations
Β 
Introduction to Differential Equations
Introduction to Differential EquationsIntroduction to Differential Equations
Introduction to Differential Equations
Β 
Class 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptxClass 14 3D HermiteInterpolation.pptx
Class 14 3D HermiteInterpolation.pptx
Β 
Discrete Mathematics - Mathematics For Computer Science
Discrete Mathematics -  Mathematics For Computer ScienceDiscrete Mathematics -  Mathematics For Computer Science
Discrete Mathematics - Mathematics For Computer Science
Β 
The chain rule
The chain ruleThe chain rule
The chain rule
Β 
Numerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen valuesNumerical Methods - Power Method for Eigen values
Numerical Methods - Power Method for Eigen values
Β 
Mathematical induction by Animesh Sarkar
Mathematical induction by Animesh SarkarMathematical induction by Animesh Sarkar
Mathematical induction by Animesh Sarkar
Β 
First Order Differential Equations
First Order Differential EquationsFirst Order Differential Equations
First Order Differential Equations
Β 
Markov Chains
Markov ChainsMarkov Chains
Markov Chains
Β 
Mathematical induction
Mathematical inductionMathematical induction
Mathematical induction
Β 
Nams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methodsNams- Roots of equations by numerical methods
Nams- Roots of equations by numerical methods
Β 
Generating function
Generating functionGenerating function
Generating function
Β 
Ordinary differential equations
Ordinary differential equationsOrdinary differential equations
Ordinary differential equations
Β 
CMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of RelationsCMSC 56 | Lecture 15: Closures of Relations
CMSC 56 | Lecture 15: Closures of Relations
Β 
Continutiy of Functions.ppt
Continutiy of Functions.pptContinutiy of Functions.ppt
Continutiy of Functions.ppt
Β 
partial diffrentialequations
partial diffrentialequationspartial diffrentialequations
partial diffrentialequations
Β 

Similar to Generating functions solve recurrence

Natural and Clamped Cubic Splines
Natural and Clamped Cubic SplinesNatural and Clamped Cubic Splines
Natural and Clamped Cubic SplinesMark Brandao
Β 
Chapter 3 - Inverse Functions.pdf
Chapter 3 - Inverse Functions.pdfChapter 3 - Inverse Functions.pdf
Chapter 3 - Inverse Functions.pdfManarKareem1
Β 
Sbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSaidatina Khadijah
Β 
5.3 geometric sequences and sums t
5.3 geometric sequences and sums t5.3 geometric sequences and sums t
5.3 geometric sequences and sums tmath260
Β 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsDr. Maamoun Ahmed
Β 
Imc2016 day2-solutions
Imc2016 day2-solutionsImc2016 day2-solutions
Imc2016 day2-solutionsChristos Loizos
Β 
Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrencesAtul Verma
Β 
2018 mtap for g10 with answers
2018 mtap for g10 with answers2018 mtap for g10 with answers
2018 mtap for g10 with answersJashey Dee
Β 
Calculus And Its Applications 10th Edition Bittinger Solutions Manual
Calculus And Its Applications 10th Edition Bittinger Solutions ManualCalculus And Its Applications 10th Edition Bittinger Solutions Manual
Calculus And Its Applications 10th Edition Bittinger Solutions Manualfujumazaja
Β 
Chapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfChapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfManarKareem1
Β 
Integration techniques
Integration techniquesIntegration techniques
Integration techniquesKrishna Gali
Β 
Average value by integral method
Average value by integral methodAverage value by integral method
Average value by integral methodArun Umrao
Β 
Ejercicios resueltos de analisis matematico 1
Ejercicios resueltos de analisis matematico 1Ejercicios resueltos de analisis matematico 1
Ejercicios resueltos de analisis matematico 1tinardo
Β 

Similar to Generating functions solve recurrence (20)

Maths
MathsMaths
Maths
Β 
Natural and Clamped Cubic Splines
Natural and Clamped Cubic SplinesNatural and Clamped Cubic Splines
Natural and Clamped Cubic Splines
Β 
Formular
FormularFormular
Formular
Β 
Chapter 3 - Inverse Functions.pdf
Chapter 3 - Inverse Functions.pdfChapter 3 - Inverse Functions.pdf
Chapter 3 - Inverse Functions.pdf
Β 
Sbma 4603 numerical methods Assignment
Sbma 4603 numerical methods AssignmentSbma 4603 numerical methods Assignment
Sbma 4603 numerical methods Assignment
Β 
5.3 geometric sequences and sums t
5.3 geometric sequences and sums t5.3 geometric sequences and sums t
5.3 geometric sequences and sums t
Β 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relations
Β 
Imc2016 day2-solutions
Imc2016 day2-solutionsImc2016 day2-solutions
Imc2016 day2-solutions
Β 
Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrences
Β 
2018 mtap for g10 with answers
2018 mtap for g10 with answers2018 mtap for g10 with answers
2018 mtap for g10 with answers
Β 
Calculus And Its Applications 10th Edition Bittinger Solutions Manual
Calculus And Its Applications 10th Edition Bittinger Solutions ManualCalculus And Its Applications 10th Edition Bittinger Solutions Manual
Calculus And Its Applications 10th Edition Bittinger Solutions Manual
Β 
CPP.pptx
CPP.pptxCPP.pptx
CPP.pptx
Β 
Calculo integral - Larson
Calculo integral - LarsonCalculo integral - Larson
Calculo integral - Larson
Β 
Chapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfChapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdf
Β 
Integration techniques
Integration techniquesIntegration techniques
Integration techniques
Β 
TABREZ KHAN.ppt
TABREZ KHAN.pptTABREZ KHAN.ppt
TABREZ KHAN.ppt
Β 
Average value by integral method
Average value by integral methodAverage value by integral method
Average value by integral method
Β 
Recurrence
RecurrenceRecurrence
Recurrence
Β 
Gcse Maths Resources
Gcse Maths ResourcesGcse Maths Resources
Gcse Maths Resources
Β 
Ejercicios resueltos de analisis matematico 1
Ejercicios resueltos de analisis matematico 1Ejercicios resueltos de analisis matematico 1
Ejercicios resueltos de analisis matematico 1
Β 

Recently uploaded

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
Β 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
Β 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
Β 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
Β 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
Β 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
Β 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
Β 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppCeline George
Β 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
Β 
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdfssuser54595a
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
Β 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
Β 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
Β 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
Β 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
Β 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
Β 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
Β 

Recently uploaded (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
Β 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
Β 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
Β 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
Β 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
Β 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Β 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
Β 
URLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website AppURLs and Routing in the Odoo 17 Website App
URLs and Routing in the Odoo 17 Website App
Β 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
Β 
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAΠ‘Y_INDEX-DM_23-1-final-eng.pdf
Β 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
Β 
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”Model Call Girl in Bikash Puri  Delhi reach out to us at πŸ”9953056974πŸ”
Model Call Girl in Bikash Puri Delhi reach out to us at πŸ”9953056974πŸ”
Β 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Β 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Β 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Β 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Β 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
Β 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Β 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Β 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Β 

Generating functions solve recurrence

  • 1.
  • 2.
  • 4. To solve the recurrence relation by generating functions, we have numeric function for the closed form expression of generating function A(z) = a0 + a1z + a2z2 + a3z3 + …
  • 5. Generating function Numeric function A(z) = 𝟏 πŸβˆ’π’‚π’› A(z) = 1 1βˆ’π‘§ 2 A(z) = 𝒛 πŸβˆ’π’› 𝟐 A(z) = 𝒂𝒛 πŸβˆ’π’‚π’› 𝟐 A(z) = 𝒆 𝒛 A(z) = 𝟏 + 𝒛 𝒏 𝒂 𝒓 (r + 1) r rar 𝟏 𝒏! 𝒏 < 𝒓, 𝟎 ≀ 𝒓 ≀ 𝒏 𝟎, 𝒓 > 𝒏
  • 6. Example 1: Solve recurrence relation by generating function 1. Multiply both sides by zr Steps to follow ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 a r - 2 1 r - 3 2 r = 0r z ar- z ar- z
  • 7. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 2. Since r ο‚³ 2, summing for all r, we get arzr – 2 ar-1zr – 3 ar-2zr = 0 r = 2 ο‚₯ r = 2 ο‚₯ r = 2 ο‚₯ Solving individually For the 1st term:  arzr = a2z2 + a3z3 + a4z4 + οƒ—οƒ—οƒ—r = 2 ο‚₯ A(z) = a0 + a1z + a2z2 + a3z3 + …  arzr = A(z) - a0 - a1zr = 2 ο‚₯   
  • 8. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 For the 2nd term:  ar-1zr = a1z2 + a2z3 + a3z4 + οƒ—οƒ—οƒ— r = 2 ο‚₯ Factoring out z:  ar-1zr = z[A(z) – a0 ]r = 2 ο‚₯ A(z) = a0 + a1z + a2z2 + a3z3 + … Z(a1z + a2z2 + a3z3 + οƒ—οƒ—οƒ—)
  • 9. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 For the 3rd term:  ar-2zr = a0z2 + a1z3 + a2z4 + οƒ—οƒ—οƒ— r = 2 ο‚₯ Factoring out z2:  ar-2zr = z2[A(z)]r = 2 ο‚₯ A(z) = a0 + a1z + a2z2 + a3z3 + … z2( a0 + a1z + a2z2 + οƒ—οƒ—οƒ—)
  • 10. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 Substitute  ar-2zr = z2[A(z)]r = 2  arzr – 2 ar-1zr – 3  ar-2zr = 0 r = 2 ο‚₯ r = 2 ο‚₯ r = 2 ο‚₯ by  arzr = A(z) - a0 - a1zr = 2 ο‚₯ ο‚₯  ar-1zr = z[A(z) – a0 ]r = 2 ο‚₯
  • 11. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 We get z2[A(z)]A(z) - a0 - a1z z[A(z) – a0 ]– 2 – 3 Substitute the value of a0 = 3; a1 = 1 A(z) – 3 - (1)z z[A(z) – 3 ]– 2 – 3z2[A(z)] simplify A(z) = πŸ‘ βˆ’πŸ“π’› 𝟏 βˆ’πŸπ’› βˆ’πŸ‘π’› 𝟐
  • 12. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 By partial fraction A(z) = πŸ‘ βˆ’πŸ“π’› 𝟏 βˆ’πŸπ’› βˆ’πŸ‘π’› 𝟐 A(z) = πŸ‘ βˆ’πŸ“π’› (𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛) πŸ‘ βˆ’πŸ“π’› (𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛) = 𝟏 (𝟏 βˆ’πŸ‘π’›) 𝟐 (𝟏 + 𝒛) +
  • 13. Solving Recurrence relation using Generating Functions ar - 2ar-1 - 3ar-2 = 0, for r ο‚³ 2, a0 = 3; a1 = 1 πŸ‘ βˆ’πŸ“π’› (𝟏 βˆ’πŸ‘π’›)(𝟏+𝒛) = 𝟏 (𝟏 βˆ’πŸ‘π’›) 𝟏 (𝟏 + 𝒛) + From the table previously presented: A(z) = 𝟏 πŸβˆ’π’‚π’› 𝒂 𝒓 ar = 1 οƒ— 3r + 2 οƒ— (-1)r
  • 14. Example 2 G(x) = a0 + a1x + a2x2 + οƒ— οƒ— οƒ— =  anxn: Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2. Let G(x) be the generating function for the sequence a0; a1; a2; : : :. That is, We will use generating functions to obtain a formula for an. ο‚₯ n=0
  • 15. Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2. The first step in the process is to use the recurrence relation to replace This can only be done when n ο‚³ 2, an by an-1 - 6an-2. so the first two terms (arising form the initial conditions) need to be separated from the sigma notation to obtain:
  • 16. G(x) = a0 + a1x +  anxn = a0 + a1x + (an-1 - 6an-1)xn = a0 + a1x +  an-1xn- 6an-1xn ο‚₯ n=2 ο‚₯ n=2 ο‚₯ n=2 ο‚₯ n=2 = a0 + a1x + x  an-1xn-1- 6x2an-2xn-2 ο‚₯ n=2 ο‚₯ n=2 In the last line above, constants and powers of x have been factored out Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 17. so that the power to which x is raised β€œinside" each sum exactly matches the subscript on the coefficient ai. which will make it easy to recognize each summation as being G(x), with a few terms possibly missing. The reason for doing this is that the next step is to make a change of index (on the subscripts), Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 18. In the first sum When n = 2, k = 1 ο‚₯ n=2 Put k = n - 1  an-1xn-1 As n goes to infinity, so does k. Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 19. ο‚₯ k=2  akxk = G(x) - ao the sum becomes With this change of index, Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 20. In the next sum ο‚₯ n=2  an-2xn-2 When n = 2, k = 0 Put k = n - 2 As n goes to infinity, so does k. Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 21. ο‚₯ k=0  akxk = G(x) the sum becomes With this change of index, Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 22. Combining these steps, we arrive at G(x) = a0 + a1x + x(G(x) - a0) - 6x2G(x). After plugging in the known values for a0 and a1, then rearranging Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 23. G(x) = 𝟏 + πŸ’π’™ 𝟏 βˆ’ 𝒙 + πŸ”π’™ 𝟐 this becomes (1 - x + 6x2)G(x) = 1 + 4x. Hence, we obtain the closed form Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 24. Notice the similarity of the coefficients in 1 - x + 6x2 and an – an-1 + 6an-2. The next step is to use partial fractions to determine the power series representation of 1 1 βˆ’ π‘₯ + 6π‘₯2 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 25. We will eventually want the sum of coefficient of xn and four times the coefficient of xn-1 in this series. Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 26. Next, we want to write 1- x + 6x2 If  and  are integers, they are positive among the divisors of 6 and their negatives. (1- x)(1- x).= Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 27. Multiplying (1- x)(1- x). we have, 1 - x - x + x2  = 6  = 1-  lead to -  - = -1 or 1- x + 6x2 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 28.  = 6 Therefore, (1- ) = 6 - 2 = 6 and the quadratic formula gives ∝ = 1 Β± 𝑖 23 2 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 29. Let, 𝛼 = 1 βˆ’ 𝑖 23 2 𝛽 = 1 + 𝑖 23 2 So that If, 1 1 βˆ’ π‘₯ + 6π‘₯2 = 𝐴 1 βˆ’ 𝛼π‘₯ + 𝐡 1 βˆ’ 𝛽π‘₯ = 𝐴 1 βˆ’ 𝛽π‘₯ + 𝐡(1 βˆ’ 𝛼π‘₯) (1 βˆ’ 𝛼π‘₯)(1 βˆ’ 𝛽π‘₯) Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 30. -A - B = 0 then, equating coefficients of like powers of x from the leftmost and rightmost expressions gives the two equations in the two unknowns A and B: A + B = 1 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 31. so that ( -  )A =  . Since  -  = -i 23, the quantity 𝐴 = 𝛼 βˆ’i 23 = 1 βˆ’ 𝑖 23 βˆ’2i 23 𝑖 23 i 23 οƒ— = 23 + 𝑖 23 46 B = 1 - A = and, therefore, 23 βˆ’ 𝑖 23 46 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 32. Hence, 1 1 βˆ’ π‘₯ + 6π‘₯2 = 𝐴 1 βˆ’ 𝛼π‘₯ + 𝐡 1 βˆ’ 𝛽π‘₯ ο‚₯ n=0 A 𝛼nxn= + ο‚₯ n=0 B 𝛽nxn Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 33. The coefficient of xn is A𝛼 + 𝐡𝛽 = + 23 + 𝑖 23 46 1 βˆ’ 𝑖 23 2 𝑛 23 βˆ’ 𝑖 23 46 1 + 𝑖 23 2 𝑛 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 34. The coefficient of xn in G(x) =(1+πŸ’π±) and 4 times the coefficient of xn-1 in, is the sum of the coefficient of xn in 1 1 βˆ’ π‘₯ + 6π‘₯2 𝟏 𝟏 βˆ’ 𝒙 + πŸ”π’™ 𝟐 1 1 βˆ’ π‘₯ + 6π‘₯2 Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.
  • 35. which equals + 23 + 𝑖 23 46 1 βˆ’ 𝑖 23 2 𝑛 23 βˆ’ 𝑖 23 46 1 + 𝑖 23 2 𝑛 + + 23 + 𝑖 23 46 1 βˆ’ 𝑖 23 2 π‘›βˆ’1 23 βˆ’ 𝑖 23 46 1 + 𝑖 23 2 π‘›βˆ’1 4 οƒ— 4 οƒ— Solving Recurrences using Generating Functions Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο‚³ 2.