SlideShare une entreprise Scribd logo
1  sur  6
RECURRENCE EQUATION BY TARUN GEHLOTS

We solve recurrence equations often in analyzing
complexity of algorithms, circuits, and such other
cases.

A homogeneous recurrence equation is written as:
a0tn + a1tn-1 + . . . . + aktn-k = 0.

Solution technique:

Step 1: Set up a corresponding Characteristic
Equation:
a0 xn + a1 x(n-1) + …. + ak x(n-k) = 0,
x(n-k) [a0 xk + a1 x(k-1) + … +ak ] = 0,

a0xk + a1xk-1 + . . . . + ak = 0 [ for x =/= 0]

Step 2: Solve the characteristic equation as a
polynomial equation. Say, the real roots are r1, r2, . . . . ,
rk. Note, there are k solutions for k-th order
polynomial equation.
Step 3: The general solution for the original
recurrence equation is:
tn = i=1kcirin

Step 4: Using initial conditions (if available) solve
for the coefficients in above equation in order to find
the particular solution.

Example 1:
tn – 3tn-1 – 4tn-2 = 0, for n >= 2. {Initial condition:
t0=0, t1=1}

Characteristic equation: xn – 3x(n-1) – 4x(n-2) = 0,
Or, x(n-2) [x2 –3x –4] = 0,
Or, x2 – 3x – 4 = 0,
Or, x2 + x – 4x – 4 = 0,
Or, x(x+1) –4(x+1) = 0,
Or, (x+1)(x-4) = 0,
Therefore, roots are, x = -1, 4.

So, the general solution of the given recurrence
equation is:
tn = c1*(-1)n + c2*(4n)

Use t0 = c1 + c2 = 0, and t1 = -c1 + 4c2 = 1. [Note,
we need two initial conditions for two coefficients.]
Sove for c1 and c2,
c1 = -(1/5), c2 = (1/5).

So, the particular solution is:
tn = (1/5)[4n – (-1)n] = (4n)

End example.

Inhomogeneous recurrence equation

a0tn + a1tn-1 + . . . . + aktn-k = bnp(n), where b is a
          constant and p(n) is a polynomial of order n.

Solution technique:

Step 0: Homogenize the given equation to an
equivalent homogeneous recurrence equation form.

Step 1 through 3 (or 4) are the same as in the case of
solving homogeneous recurrence equation.

Example 2:

tn – 2tn-1 = 3n. [Note, this is a special case with p(n)
=1, polynomial of 0-th order, and there is no initial
condition – so we get the general solution only.]

Transform with n->n+1:
tn+1 – 2tn = 3n+1   Eqn(1).

Multiply original eqn with 3 on both the sides:
3tn – 6tn-1 = 3n+1 Eqn(2).

Subtract Eqn(2) from Eqn(1):
tn+1 – 5tn + 6tn-1 = 0, this is a homogeneous
recurrence equation which is equivalent to the given
inhomogeneous equation.

Characteristic equation: x2 – 5 x + 6 = 0.
Which is (x-2)(x-3) = 0.

So, roots are x = 2, 3.

General solution of the given recurrence equation is:
tn = c1*(2n) + c2*(3n) = (3n)

End example 2.

Homogenizing may need multiple steps.

Example 3:

tn – 2tn-1 = n

So, tn+1 – 2tn = n+1
Subtracting the former (given) eqn from the latter
eqn,
tn+1 – 3tn + 2tn-1 = 1

Still not a homogeneous eqn. Second stage of
homogenizing,
tn+2 – 3tn+1 + 2tn = 1

Subtract once again,
tn+2 – 4tn+1 + 5tn - 2tn-1 = 0

Now it is a homogeneous recurrence equation and
one can solve it in the usual way.

End example 3e.

An important special case:

If the characteristic eqn. is like
(x-2)(x-3)2 = 0,      [CAN YOU CONSTRUCT THE
ORIGINAL HOMOGENEOUS RECURRENCE EQN
BACK?]

The roots are x = 2, 3, 3 for a polynomial eqn. of
order 3.

The general solution for the given recurrence eqn. is
then,
tn = c1*(2n) + c2*(3n) + c3*n*(3n)

Note the additional n in the third term.

If the roots were
x = 3, 3, 3, then

The general solution would be
tn = c1*(3n) + c2*n*(3n) + c3*(n2)*( 3n),

and so on so forth…


A special type of recurrence equation that is
frequently encountered in algorithms' analyses
                    i
T(n) = aT(n/b) + cn , for some constant integer i, and
constants of coefficients a and c.

Three cases:
     i
a = b , the solution is T(n) = O(ni log b n);
     i                                  a
a > b , the solution is T(n) = O(nlog_b );
     i
a < b , the solution is T(n) = O(ni);

Contenu connexe

Tendances

Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsswapnac12
 
Rabin Carp String Matching algorithm
Rabin Carp String Matching  algorithmRabin Carp String Matching  algorithm
Rabin Carp String Matching algorithmsabiya sabiya
 
ΠΛΗ31 ΜΑΘΗΜΑ 1.4
ΠΛΗ31 ΜΑΘΗΜΑ 1.4 ΠΛΗ31 ΜΑΘΗΜΑ 1.4
ΠΛΗ31 ΜΑΘΗΜΑ 1.4 Dimitris Psounis
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsVivek Bhargav
 
Quantum computer adder grover
Quantum computer adder groverQuantum computer adder grover
Quantum computer adder groverOishiKenta
 
Orthogonal coordinate systems- Cartesian ,Cylindrical ,Spherical
Orthogonal coordinate systems- Cartesian ,Cylindrical ,SphericalOrthogonal coordinate systems- Cartesian ,Cylindrical ,Spherical
Orthogonal coordinate systems- Cartesian ,Cylindrical ,SphericalDr.SHANTHI K.G
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingR Islam
 
Forward and Backward chaining in AI
Forward and Backward chaining in AIForward and Backward chaining in AI
Forward and Backward chaining in AIMegha Sharma
 
Prolog programming
Prolog programmingProlog programming
Prolog programmingHarry Potter
 
10-SLR parser practice problems-02-06-2023.pptx
10-SLR parser practice problems-02-06-2023.pptx10-SLR parser practice problems-02-06-2023.pptx
10-SLR parser practice problems-02-06-2023.pptxvenkatapranaykumarGa
 
Forms of learning in ai
Forms of learning in aiForms of learning in ai
Forms of learning in aiRobert Antony
 

Tendances (20)

Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Rabin Carp String Matching algorithm
Rabin Carp String Matching  algorithmRabin Carp String Matching  algorithm
Rabin Carp String Matching algorithm
 
ΠΛΗ31 ΜΑΘΗΜΑ 1.4
ΠΛΗ31 ΜΑΘΗΜΑ 1.4 ΠΛΗ31 ΜΑΘΗΜΑ 1.4
ΠΛΗ31 ΜΑΘΗΜΑ 1.4
 
Lecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithmsLecture 5: Asymptotic analysis of algorithms
Lecture 5: Asymptotic analysis of algorithms
 
Quantum computer adder grover
Quantum computer adder groverQuantum computer adder grover
Quantum computer adder grover
 
Ai 8 puzzle problem
Ai 8 puzzle problemAi 8 puzzle problem
Ai 8 puzzle problem
 
Orthogonal coordinate systems- Cartesian ,Cylindrical ,Spherical
Orthogonal coordinate systems- Cartesian ,Cylindrical ,SphericalOrthogonal coordinate systems- Cartesian ,Cylindrical ,Spherical
Orthogonal coordinate systems- Cartesian ,Cylindrical ,Spherical
 
LR(1) and SLR(1) parsing
LR(1) and SLR(1) parsingLR(1) and SLR(1) parsing
LR(1) and SLR(1) parsing
 
ΠΛΗ31 ΜΑΘΗΜΑ 1.3
ΠΛΗ31 ΜΑΘΗΜΑ 1.3ΠΛΗ31 ΜΑΘΗΜΑ 1.3
ΠΛΗ31 ΜΑΘΗΜΑ 1.3
 
Verilogforlab
VerilogforlabVerilogforlab
Verilogforlab
 
ΠΛΗ30 ΜΑΘΗΜΑ 3.1
ΠΛΗ30 ΜΑΘΗΜΑ 3.1ΠΛΗ30 ΜΑΘΗΜΑ 3.1
ΠΛΗ30 ΜΑΘΗΜΑ 3.1
 
Euler graph
Euler graphEuler graph
Euler graph
 
Plh21 typologio
Plh21 typologioPlh21 typologio
Plh21 typologio
 
Forward and Backward chaining in AI
Forward and Backward chaining in AIForward and Backward chaining in AI
Forward and Backward chaining in AI
 
4 bit Binary counter
4 bit Binary counter4 bit Binary counter
4 bit Binary counter
 
Graph coloring problem
Graph coloring problemGraph coloring problem
Graph coloring problem
 
Prolog programming
Prolog programmingProlog programming
Prolog programming
 
10-SLR parser practice problems-02-06-2023.pptx
10-SLR parser practice problems-02-06-2023.pptx10-SLR parser practice problems-02-06-2023.pptx
10-SLR parser practice problems-02-06-2023.pptx
 
Brute force method
Brute force methodBrute force method
Brute force method
 
Forms of learning in ai
Forms of learning in aiForms of learning in ai
Forms of learning in ai
 

En vedette

Intervals of validity
Intervals of validityIntervals of validity
Intervals of validityTarun Gehlot
 
Modelling with first order differential equations
Modelling with first order differential equationsModelling with first order differential equations
Modelling with first order differential equationsTarun Gehlot
 
Real meaning of functions
Real meaning of functionsReal meaning of functions
Real meaning of functionsTarun Gehlot
 
How to draw a good graph
How to draw a good graphHow to draw a good graph
How to draw a good graphTarun Gehlot
 
Describing and exploring data
Describing and exploring dataDescribing and exploring data
Describing and exploring dataTarun Gehlot
 
Linear approximations
Linear approximationsLinear approximations
Linear approximationsTarun Gehlot
 
An applied approach to calculas
An applied approach to calculasAn applied approach to calculas
An applied approach to calculasTarun Gehlot
 
Graphs of trigonometric functions
Graphs of trigonometric functionsGraphs of trigonometric functions
Graphs of trigonometric functionsTarun Gehlot
 
Solution of nonlinear_equations
Solution of nonlinear_equationsSolution of nonlinear_equations
Solution of nonlinear_equationsTarun Gehlot
 
Probability and statistics as helpers in real life
Probability and statistics as helpers in real lifeProbability and statistics as helpers in real life
Probability and statistics as helpers in real lifeTarun Gehlot
 
C4 discontinuities
C4 discontinuitiesC4 discontinuities
C4 discontinuitiesTarun Gehlot
 
The shortest distance between skew lines
The shortest distance between skew linesThe shortest distance between skew lines
The shortest distance between skew linesTarun Gehlot
 
Review taylor series
Review taylor seriesReview taylor series
Review taylor seriesTarun Gehlot
 
The newton raphson method
The newton raphson methodThe newton raphson method
The newton raphson methodTarun Gehlot
 
Linear programming
Linear programmingLinear programming
Linear programmingTarun Gehlot
 
Limitations of linear programming
Limitations of linear programmingLimitations of linear programming
Limitations of linear programmingTarun Gehlot
 

En vedette (20)

Logicgates
LogicgatesLogicgates
Logicgates
 
Intervals of validity
Intervals of validityIntervals of validity
Intervals of validity
 
Modelling with first order differential equations
Modelling with first order differential equationsModelling with first order differential equations
Modelling with first order differential equations
 
Real meaning of functions
Real meaning of functionsReal meaning of functions
Real meaning of functions
 
How to draw a good graph
How to draw a good graphHow to draw a good graph
How to draw a good graph
 
Describing and exploring data
Describing and exploring dataDescribing and exploring data
Describing and exploring data
 
Linear approximations
Linear approximationsLinear approximations
Linear approximations
 
Critical points
Critical pointsCritical points
Critical points
 
An applied approach to calculas
An applied approach to calculasAn applied approach to calculas
An applied approach to calculas
 
Graphs of trigonometric functions
Graphs of trigonometric functionsGraphs of trigonometric functions
Graphs of trigonometric functions
 
Solution of nonlinear_equations
Solution of nonlinear_equationsSolution of nonlinear_equations
Solution of nonlinear_equations
 
Matrix algebra
Matrix algebraMatrix algebra
Matrix algebra
 
Probability and statistics as helpers in real life
Probability and statistics as helpers in real lifeProbability and statistics as helpers in real life
Probability and statistics as helpers in real life
 
C4 discontinuities
C4 discontinuitiesC4 discontinuities
C4 discontinuities
 
The shortest distance between skew lines
The shortest distance between skew linesThe shortest distance between skew lines
The shortest distance between skew lines
 
Thermo dynamics
Thermo dynamicsThermo dynamics
Thermo dynamics
 
Review taylor series
Review taylor seriesReview taylor series
Review taylor series
 
The newton raphson method
The newton raphson methodThe newton raphson method
The newton raphson method
 
Linear programming
Linear programmingLinear programming
Linear programming
 
Limitations of linear programming
Limitations of linear programmingLimitations of linear programming
Limitations of linear programming
 

Similaire à Recurrence equations

Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrencesAtul Verma
 
LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS
 LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS
LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTSAartiMajumdar1
 
recurence solutions
recurence solutionsrecurence solutions
recurence solutionssoumya8396
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsDr. Maamoun Ahmed
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesWaqas Akram
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrencesWaqas Akram
 
Elementary Differential Equations 11th Edition Boyce Solutions Manual
Elementary Differential Equations 11th Edition Boyce Solutions ManualElementary Differential Equations 11th Edition Boyce Solutions Manual
Elementary Differential Equations 11th Edition Boyce Solutions ManualMiriamKennedys
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms IiSri Prasanna
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMAlpana Ingale
 
Recurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees freeRecurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees freeWhite44420
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdfRishikeshJha33
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxGadaFarhan
 
Impact of Linear Homogeneous Recurrent Relation Analysis
Impact of Linear Homogeneous Recurrent Relation AnalysisImpact of Linear Homogeneous Recurrent Relation Analysis
Impact of Linear Homogeneous Recurrent Relation Analysisijtsrd
 
Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence RelationPapu Kumar
 

Similaire à Recurrence equations (20)

Daa linear recurrences
Daa linear recurrencesDaa linear recurrences
Daa linear recurrences
 
LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS
 LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS
LINEAR RECURRENCE RELATIONS WITH CONSTANT COEFFICIENTS
 
recurence solutions
recurence solutionsrecurence solutions
recurence solutions
 
Solving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relationsSolving linear homogeneous recurrence relations
Solving linear homogeneous recurrence relations
 
Time complexity
Time complexityTime complexity
Time complexity
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
Solving recurrences
Solving recurrencesSolving recurrences
Solving recurrences
 
3.pdf
3.pdf3.pdf
3.pdf
 
Ch07 7
Ch07 7Ch07 7
Ch07 7
 
Elementary Differential Equations 11th Edition Boyce Solutions Manual
Elementary Differential Equations 11th Edition Boyce Solutions ManualElementary Differential Equations 11th Edition Boyce Solutions Manual
Elementary Differential Equations 11th Edition Boyce Solutions Manual
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 
Ch07 5
Ch07 5Ch07 5
Ch07 5
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 
Recurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees freeRecurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees free
 
Ch07 6
Ch07 6Ch07 6
Ch07 6
 
Maths
MathsMaths
Maths
 
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
8.-DAA-LECTURE-8-RECURRENCES-AND-ITERATION-METHOD.pdf
 
T2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptxT2311 - Ch 4_Part1.pptx
T2311 - Ch 4_Part1.pptx
 
Impact of Linear Homogeneous Recurrent Relation Analysis
Impact of Linear Homogeneous Recurrent Relation AnalysisImpact of Linear Homogeneous Recurrent Relation Analysis
Impact of Linear Homogeneous Recurrent Relation Analysis
 
Recurrence Relation
Recurrence RelationRecurrence Relation
Recurrence Relation
 

Plus de Tarun Gehlot

Materials 11-01228
Materials 11-01228Materials 11-01228
Materials 11-01228Tarun Gehlot
 
Continuity and end_behavior
Continuity and  end_behaviorContinuity and  end_behavior
Continuity and end_behaviorTarun Gehlot
 
Continuity of functions by graph (exercises with detailed solutions)
Continuity of functions by graph   (exercises with detailed solutions)Continuity of functions by graph   (exercises with detailed solutions)
Continuity of functions by graph (exercises with detailed solutions)Tarun Gehlot
 
Factoring by the trial and-error method
Factoring by the trial and-error methodFactoring by the trial and-error method
Factoring by the trial and-error methodTarun Gehlot
 
Introduction to finite element analysis
Introduction to finite element analysisIntroduction to finite element analysis
Introduction to finite element analysisTarun Gehlot
 
Finite elements : basis functions
Finite elements : basis functionsFinite elements : basis functions
Finite elements : basis functionsTarun Gehlot
 
Finite elements for 2‐d problems
Finite elements  for 2‐d problemsFinite elements  for 2‐d problems
Finite elements for 2‐d problemsTarun Gehlot
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statisticsTarun Gehlot
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabTarun Gehlot
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentialsTarun Gehlot
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximationTarun Gehlot
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functionsTarun Gehlot
 
Propeties of-triangles
Propeties of-trianglesPropeties of-triangles
Propeties of-trianglesTarun Gehlot
 
Gaussian quadratures
Gaussian quadraturesGaussian quadratures
Gaussian quadraturesTarun Gehlot
 
Basics of set theory
Basics of set theoryBasics of set theory
Basics of set theoryTarun Gehlot
 
Numerical integration
Numerical integrationNumerical integration
Numerical integrationTarun Gehlot
 
Applications of set theory
Applications of  set theoryApplications of  set theory
Applications of set theoryTarun Gehlot
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functionsTarun Gehlot
 

Plus de Tarun Gehlot (20)

Materials 11-01228
Materials 11-01228Materials 11-01228
Materials 11-01228
 
Binary relations
Binary relationsBinary relations
Binary relations
 
Continuity and end_behavior
Continuity and  end_behaviorContinuity and  end_behavior
Continuity and end_behavior
 
Continuity of functions by graph (exercises with detailed solutions)
Continuity of functions by graph   (exercises with detailed solutions)Continuity of functions by graph   (exercises with detailed solutions)
Continuity of functions by graph (exercises with detailed solutions)
 
Factoring by the trial and-error method
Factoring by the trial and-error methodFactoring by the trial and-error method
Factoring by the trial and-error method
 
Introduction to finite element analysis
Introduction to finite element analysisIntroduction to finite element analysis
Introduction to finite element analysis
 
Finite elements : basis functions
Finite elements : basis functionsFinite elements : basis functions
Finite elements : basis functions
 
Finite elements for 2‐d problems
Finite elements  for 2‐d problemsFinite elements  for 2‐d problems
Finite elements for 2‐d problems
 
Error analysis statistics
Error analysis   statisticsError analysis   statistics
Error analysis statistics
 
Matlab commands
Matlab commandsMatlab commands
Matlab commands
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Linear approximations and_differentials
Linear approximations and_differentialsLinear approximations and_differentials
Linear approximations and_differentials
 
Local linear approximation
Local linear approximationLocal linear approximation
Local linear approximation
 
Interpolation functions
Interpolation functionsInterpolation functions
Interpolation functions
 
Propeties of-triangles
Propeties of-trianglesPropeties of-triangles
Propeties of-triangles
 
Gaussian quadratures
Gaussian quadraturesGaussian quadratures
Gaussian quadratures
 
Basics of set theory
Basics of set theoryBasics of set theory
Basics of set theory
 
Numerical integration
Numerical integrationNumerical integration
Numerical integration
 
Applications of set theory
Applications of  set theoryApplications of  set theory
Applications of set theory
 
Miscellneous functions
Miscellneous  functionsMiscellneous  functions
Miscellneous functions
 

Recurrence equations

  • 1. RECURRENCE EQUATION BY TARUN GEHLOTS We solve recurrence equations often in analyzing complexity of algorithms, circuits, and such other cases. A homogeneous recurrence equation is written as: a0tn + a1tn-1 + . . . . + aktn-k = 0. Solution technique: Step 1: Set up a corresponding Characteristic Equation: a0 xn + a1 x(n-1) + …. + ak x(n-k) = 0, x(n-k) [a0 xk + a1 x(k-1) + … +ak ] = 0, a0xk + a1xk-1 + . . . . + ak = 0 [ for x =/= 0] Step 2: Solve the characteristic equation as a polynomial equation. Say, the real roots are r1, r2, . . . . , rk. Note, there are k solutions for k-th order polynomial equation.
  • 2. Step 3: The general solution for the original recurrence equation is: tn = i=1kcirin Step 4: Using initial conditions (if available) solve for the coefficients in above equation in order to find the particular solution. Example 1: tn – 3tn-1 – 4tn-2 = 0, for n >= 2. {Initial condition: t0=0, t1=1} Characteristic equation: xn – 3x(n-1) – 4x(n-2) = 0, Or, x(n-2) [x2 –3x –4] = 0, Or, x2 – 3x – 4 = 0, Or, x2 + x – 4x – 4 = 0, Or, x(x+1) –4(x+1) = 0, Or, (x+1)(x-4) = 0, Therefore, roots are, x = -1, 4. So, the general solution of the given recurrence equation is: tn = c1*(-1)n + c2*(4n) Use t0 = c1 + c2 = 0, and t1 = -c1 + 4c2 = 1. [Note, we need two initial conditions for two coefficients.]
  • 3. Sove for c1 and c2, c1 = -(1/5), c2 = (1/5). So, the particular solution is: tn = (1/5)[4n – (-1)n] = (4n) End example. Inhomogeneous recurrence equation a0tn + a1tn-1 + . . . . + aktn-k = bnp(n), where b is a constant and p(n) is a polynomial of order n. Solution technique: Step 0: Homogenize the given equation to an equivalent homogeneous recurrence equation form. Step 1 through 3 (or 4) are the same as in the case of solving homogeneous recurrence equation. Example 2: tn – 2tn-1 = 3n. [Note, this is a special case with p(n) =1, polynomial of 0-th order, and there is no initial condition – so we get the general solution only.] Transform with n->n+1:
  • 4. tn+1 – 2tn = 3n+1 Eqn(1). Multiply original eqn with 3 on both the sides: 3tn – 6tn-1 = 3n+1 Eqn(2). Subtract Eqn(2) from Eqn(1): tn+1 – 5tn + 6tn-1 = 0, this is a homogeneous recurrence equation which is equivalent to the given inhomogeneous equation. Characteristic equation: x2 – 5 x + 6 = 0. Which is (x-2)(x-3) = 0. So, roots are x = 2, 3. General solution of the given recurrence equation is: tn = c1*(2n) + c2*(3n) = (3n) End example 2. Homogenizing may need multiple steps. Example 3: tn – 2tn-1 = n So, tn+1 – 2tn = n+1
  • 5. Subtracting the former (given) eqn from the latter eqn, tn+1 – 3tn + 2tn-1 = 1 Still not a homogeneous eqn. Second stage of homogenizing, tn+2 – 3tn+1 + 2tn = 1 Subtract once again, tn+2 – 4tn+1 + 5tn - 2tn-1 = 0 Now it is a homogeneous recurrence equation and one can solve it in the usual way. End example 3e. An important special case: If the characteristic eqn. is like (x-2)(x-3)2 = 0, [CAN YOU CONSTRUCT THE ORIGINAL HOMOGENEOUS RECURRENCE EQN BACK?] The roots are x = 2, 3, 3 for a polynomial eqn. of order 3. The general solution for the given recurrence eqn. is then,
  • 6. tn = c1*(2n) + c2*(3n) + c3*n*(3n) Note the additional n in the third term. If the roots were x = 3, 3, 3, then The general solution would be tn = c1*(3n) + c2*n*(3n) + c3*(n2)*( 3n), and so on so forth… A special type of recurrence equation that is frequently encountered in algorithms' analyses i T(n) = aT(n/b) + cn , for some constant integer i, and constants of coefficients a and c. Three cases: i a = b , the solution is T(n) = O(ni log b n); i a a > b , the solution is T(n) = O(nlog_b ); i a < b , the solution is T(n) = O(ni);