How can I solve a recurrence equation of the form T(n) = aT(n-1) + bn?

  • Context: MHB 
  • Thread starter Thread starter DanSlevin
  • Start date Start date
  • Tags Tags
    Recurrence
Click For Summary

Discussion Overview

The discussion revolves around solving a recurrence equation of the form T(n) = aT(n - 1) + bn, with the initial condition T(1) = 1. Participants explore various methods for solving this equation, including unrolling the recurrence and using generating functions, while also addressing potential errors in their approaches.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes their attempts to solve the recurrence using top-down and bottom-up approaches but expresses difficulty in finding a solution.
  • Another participant introduces the concept of generating functions to express the recurrence and derives a formula for f(x), the generating function of T(n).
  • Some participants discuss the relationship between linear recurrence relations and linear differential equations, suggesting that solutions can be constructed from the homogeneous part and a particular solution.
  • There is a correction regarding the application of the recurrence relation, where one participant questions the omission of the 'n' in the term bn during calculations.
  • A later reply acknowledges the mistake and provides a revised calculation for T(n) that incorporates the correct terms.
  • Another participant suggests a different form of the recurrence relation and references a method for computing polynomials efficiently, indicating a potential alternative approach to the problem.

Areas of Agreement / Disagreement

Participants express various methods and approaches to solving the recurrence, but there is no consensus on a single solution or method. Disagreements arise regarding specific calculations and interpretations of the recurrence relation.

Contextual Notes

Some participants note potential errors in their calculations and assumptions, particularly regarding the handling of terms in the recurrence. The discussion reflects a range of mathematical reasoning and approaches without resolving the overall problem.

DanSlevin
Messages
7
Reaction score
0
I have a recurrence equation of the form T(n) = aT(n - 1) + bn where T(1) = 1. In trying to solve this equation, I have tried a top-down and bottom-up approach of "unrolling the equation" but found that I am still having trouble and am unable to solve. Any advice would be appreciated.
 
Physics news on Phys.org
DanSlevin said:
I have a recurrence equation of the form T(n) = aT(n - 1) + bn where T(1) = 1. In trying to solve this equation, I have tried a top-down and bottom-up approach of "unrolling the equation" but found that I am still having trouble and am unable to solve. Any advice would be appreciated.
Let $f(x)$ be generating function of $T_n$:

$$ f(x)=T_0+T_1x+T_2x^2+...$$Hence, we have:

$$ f(x)=\sum_{i=0}^{\infty}T_ix^i=1+ \sum_{i=2}^{\infty}T_ix^i=1+\sum_{i=2}^{\infty}(aT_{i - 1} + bn)x^i $$

$$=1+\sum_{i=2}^{\infty}aT_{i - 1}x^i+ \sum_{i=2}^{\infty}bix^i= 1+a\sum_{i=2}^{\infty}T_{i - 1}x^i+ bx\sum_{i=2}^{\infty}ix^{i-1}$$

$$ =1+a(f(x)-1)+\frac{bx}{(1-x)^2-1} $$So,

$$ f(x)=1+a(f(x)-1)+\frac{bx}{(1-x)^2-1} $$

or:

$$ f(x)=1+\frac{bx}{1-a}\frac{1}{(1-x)^2-1}$$Now, all you need is find the coefficient of $x^n$ in the above.
 
Last edited:
I believe I mistook your "...thinking." remark as telling me to just think. I'm sorry and thank you for time.
 
Last edited:
DanSlevin said:
I believe I mistook your "...thinking." remark as telling me to just think. I'm sorry and thank you for time.
It's ok. :)There is few mistakes in my post, I will try to fix them, but this is one way to the right answer...
 
A linear recurrance is a lot like a linear differerential equation- we can find the general solution to the associated "homogeneous" equation and a solution to the entire equation and add to get the general solution to the entire equation.

Here, the associated homogeneous equation is just T(n)= aT(n-1). If T(0)= C, T(1)= Ca, T(2)= (Ca)a= Ca^2, etc. In other words the general solution to the associated Homogeneous equation is T(n)= Ca^n. Now we need just a single solution to T(n)= aT(n-1)+ bn. If T(0)= 0, T(1)= aT(0)+ b= b, T(2)= aT(1)+ b= ab+ b, T(3)= aT(2)+ b= a^2b+ ab= (a^2+ a)b, T(4)= aT(3)+ b= (a^3+ a^2)b+ b= (a^3+ a^2+ a)b. See the pattern? T(n)= (a^(n-1)+ a^(n-2)+ ...+ a^2+ a)b.

Putting those together T(n)= Ca^n+ b(a^(n-1)+ a^(n-2)+ ...+ a^2+ a)

T(1)= 1 then becomes Ca+ b= 1 so that C= (1-b)/a.
 
HallsofIvy said:
A linear recurrance is a lot like a linear differerential equation- we can find the general solution to the associated "homogeneous" equation and a solution to the entire equation and add to get the general solution to the entire equation.

Here, the associated homogeneous equation is just T(n)= aT(n-1). If T(0)= C, T(1)= Ca, T(2)= (Ca)a= Ca^2, etc. In other words the general solution to the associated Homogeneous equation is T(n)= Ca^n. Now we need just a single solution to T(n)= aT(n-1)+ bn. If T(0)= 0, T(1)= aT(0)+ b= b, T(2)= aT(1)+ b= ab+ b, T(3)= aT(2)+ b= a^2b+ ab= (a^2+ a)b, T(4)= aT(3)+ b= (a^3+ a^2)b+ b= (a^3+ a^2+ a)b. See the pattern? T(n)= (a^(n-1)+ a^(n-2)+ ...+ a^2+ a)b.

Putting those together T(n)= Ca^n+ b(a^(n-1)+ a^(n-2)+ ...+ a^2+ a)

T(1)= 1 then becomes Ca+ b= 1 so that C= (1-b)/a.
Thank you for your reply. I'm a little confused with the part with T(3)= aT(2)+ b, shouldn't this be T(3)= aT(2)+ bn? I'm confused as to where the n went that was on the end.
 
DanSlevin said:
I have a recurrence equation of the form T(n) = aT(n - 1) + bn where T(1) = 1. In trying to solve this equation, I have tried a top-down and bottom-up approach of "unrolling the equation" but found that I am still having trouble and am unable to solve. Any advice would be appreciated.

Let's write the recurrence relation in a slight different form...

$y_{n+1}= x\ y_{n} + c_{n+1}\ ,\ y_{0}=c_{0}$ (1)

In the 'tutorial posts' about difference equation I wrote for MHF this case was specifically examined and the solution is given by...

$y_{n}= c_{0}\ x^{n} + c_{1}\ x^{n-1} +...+ c_{n-1}\ x + c_{n}$ (1)

... and it is easy to see that (1) is a polynomial. This procedure allows to compute a polynomial of order n with a minimum number of operations [n sums and n multiplications...] and it is known as "Horner method for computing polynomials'...

Kind regards

$\chi$ $\sigma$
 
DanSlevin said:
Thank you for your reply. I'm a little confused with the part with T(3)= aT(2)+ b, shouldn't this be T(3)= aT(2)+ bn? I'm confused as to where the n went that was on the end.

Oh, bother! Yes, you are right I completely missed the "n" there!

If we take T(0)= 0, T(1)= aT(0)+ b(1)=b. T(2)= aT(0)+ b(2)= ab+ 2b= (a+2)b. T(3)= aT(2)+ b(3)= (a^2+ 2a+ 3)b. T(4)= aT(3)+ b(4)= (a^3+ 2a^2+ 3a+ 4)b. T(5)= aT(4)+ 5b= (a^4+ 2a^3+ 3a^3+ 4a+ 5)b. Now, we are getting a different pattern but yet a pattern.
 
Last edited by a moderator:

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 22 ·
Replies
22
Views
5K
  • · Replies 6 ·
Replies
6
Views
4K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 4 ·
Replies
4
Views
2K