SlideShare a Scribd company logo
1 of 35
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.
Gen solve recurrence

More Related Content

What's hot

Optimization Methods
Optimization MethodsOptimization Methods
Optimization Methodsmetamath
 
Types of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceTypes of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceNoman Ullah Khan
 
Goal based and utility based agents
Goal based and utility based agentsGoal based and utility based agents
Goal based and utility based agentsMegha Sharma
 
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set TheoryAMIT KUMAR
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gamemanika kumari
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing ThesisHemant Sharma
 
Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omegaRajesh K Shukla
 
Particles Swarm Optimization
Particles Swarm OptimizationParticles Swarm Optimization
Particles Swarm OptimizationBrian Raafiu
 
Deep sarsa, Deep Q-learning, DQN
Deep sarsa, Deep Q-learning, DQNDeep sarsa, Deep Q-learning, DQN
Deep sarsa, Deep Q-learning, DQNEuijin Jeong
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial SearchMegha Sharma
 
I. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in aiI. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in aivikas dhakane
 
Reinforcement Learning Q-Learning
Reinforcement Learning   Q-Learning Reinforcement Learning   Q-Learning
Reinforcement Learning Q-Learning Melaku Eneayehu
 
Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...Xin-She Yang
 
Fuzzy relations
Fuzzy relationsFuzzy relations
Fuzzy relationsnaugariya
 

What's hot (20)

Ch 6 final
Ch 6 finalCh 6 final
Ch 6 final
 
Optimization Methods
Optimization MethodsOptimization Methods
Optimization Methods
 
Fuzzy sets
Fuzzy sets Fuzzy sets
Fuzzy sets
 
Answer quiz minimax
Answer quiz minimaxAnswer quiz minimax
Answer quiz minimax
 
Types of environment in Artificial Intelligence
Types of environment in Artificial IntelligenceTypes of environment in Artificial Intelligence
Types of environment in Artificial Intelligence
 
Goal based and utility based agents
Goal based and utility based agentsGoal based and utility based agents
Goal based and utility based agents
 
L9 fuzzy implications
L9 fuzzy implicationsL9 fuzzy implications
L9 fuzzy implications
 
Fuzzy Set Theory
Fuzzy Set TheoryFuzzy Set Theory
Fuzzy Set Theory
 
Artificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe gameArtificial Intelligence- TicTacToe game
Artificial Intelligence- TicTacToe game
 
Church Turing Thesis
Church Turing ThesisChurch Turing Thesis
Church Turing Thesis
 
Little o and little omega
Little o and little omegaLittle o and little omega
Little o and little omega
 
Particles Swarm Optimization
Particles Swarm OptimizationParticles Swarm Optimization
Particles Swarm Optimization
 
Deep sarsa, Deep Q-learning, DQN
Deep sarsa, Deep Q-learning, DQNDeep sarsa, Deep Q-learning, DQN
Deep sarsa, Deep Q-learning, DQN
 
Adversarial Search
Adversarial SearchAdversarial Search
Adversarial Search
 
I. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in aiI. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in ai
 
Reinforcement Learning Q-Learning
Reinforcement Learning   Q-Learning Reinforcement Learning   Q-Learning
Reinforcement Learning Q-Learning
 
Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...
 
Fuzzy relations
Fuzzy relationsFuzzy relations
Fuzzy relations
 
Min-Max algorithm
Min-Max algorithmMin-Max algorithm
Min-Max algorithm
 
Alpha beta
Alpha betaAlpha beta
Alpha beta
 

Similar to Gen 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
 
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 Gen 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

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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
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
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptxPoojaSen20
 

Recently uploaded (20)

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
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
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🔝
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
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...
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
PSYCHIATRIC History collection FORMAT.pptx
PSYCHIATRIC   History collection FORMAT.pptxPSYCHIATRIC   History collection FORMAT.pptx
PSYCHIATRIC History collection FORMAT.pptx
 

Gen solve recurrence

  • 1.
  • 3. 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 + …
  • 4. Generating function Numeric function A(z) = 𝟏 𝟏−𝒂𝒛 A(z) = 1 1−𝑧 2 A(z) = 𝒛 𝟏−𝒛 𝟐 A(z) = 𝒂𝒛 𝟏−𝒂𝒛 𝟐 A(z) = 𝒆 𝒛 A(z) = 𝟏 + 𝒛 𝒏 𝒂 𝒓 (r + 1) r rar 𝟏 𝒏! 𝒏 < 𝒓, 𝟎 ≤ 𝒓 ≤ 𝒏 𝟎, 𝒓 > 𝒏
  • 5. 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
  • 6. 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    
  • 7. 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 + )
  • 8. 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 + )
  • 9. 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 
  • 10. 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) = 𝟑 −𝟓𝒛 𝟏 −𝟐𝒛 −𝟑𝒛 𝟐
  • 11. 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) = 𝟑 −𝟓𝒛 (𝟏 −𝟑𝒛)(𝟏+𝒛) 𝟑 −𝟓𝒛 (𝟏 −𝟑𝒛)(𝟏+𝒛) = 𝟏 (𝟏 −𝟑𝒛) 𝟐 (𝟏 + 𝒛) +
  • 12. 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
  • 13. 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
  • 14. 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:
  • 15. 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.
  • 16. 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.
  • 17. 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.
  • 18.  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.
  • 19. 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.
  • 20.  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.
  • 21. 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.
  • 22. 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.
  • 23. 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.
  • 24. 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.
  • 25. 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.
  • 26. 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.
  • 27.  = 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.
  • 28. 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.
  • 29. -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.
  • 30. 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.
  • 31. 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.
  • 32. 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.
  • 33. 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.
  • 34. 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.