# Science and engineering math: Difference equation, non-homogeneous

1. Mar 18, 2012

### chatterbug219

1. The problem statement, all variables and given/known data

Solve the difference equation: an+2 - 5an+1 + 6an = 4n
Subject to a0 = 0 & a1 = 1

2. Relevant equations

an = Arn

3. The attempt at a solution
I got two solutions for the first part for when it is homogeneous by substituting an = Arn into the equation and solving for r.
an = A(3)n
an = A(2)n

I just don't know where to start for non-homogeneous. I tried an = B*4n and I got B*4n+2 -5B*4n+1 + 6B*4n = 4n but I don't know where to go from there.

2. Mar 18, 2012

### tiny-tim

welcome to pf!

hi chatterbug219! welcome to pf!
erm

4n+2/4n = … ?

3. Mar 18, 2012

### chatterbug219

So B = 1/2
And plugging that in...
an = (1/2)(4n) for the particular solution
Making the general solution:
an = A(2)n + (1/2)(4n)
Right?

4. Mar 19, 2012

### tiny-tim

hi chatterbug219!

(just got up :zzz:)
you mean an = A(2)n + B(3)n + (1/2)(4n)

(or you could write it 2n(2n-1 + A) + 3nB )

5. Mar 19, 2012

### chatterbug219

No...if you plug in the initial conditions they final answers don't match up...
Only 2 works

6. Mar 19, 2012

### tiny-tim

yes, but to solve for the initial condition, you also need to find A

7. Mar 19, 2012

### Ray Vickson

The simplest way is to determine the generating function $A(z) = \sum_{n=0}^{\infty} a_n z^n$, then invert it to find $\{ a_n \}.$ Google "difference equations" to see hundreds of examples.

RGV