# Difference equations - just a little clarification wanted

1. Nov 6, 2005

### Benny

Hi, I have a question regarding the solution of linear difference equations. Provided that the 'RHS' is not too complicated, will the same "method of undetermined coefficients" for differential equations work for difference equations.

For example consider the second order difference equation $$x_{n + 2} + 4x_{n + 1} + 4x_n = n$$. The homogeneous solution should be $$x_n = A\left( { - 2} \right)^n + Bn\left( { - 2} \right)^n$$. If this was a differential equation the trial function would be initally be y = Cx + D. But since something with an x is already in the homogeneous solution we would multiply by x^2 and the trial function would be y = Cx^3 + Dx^2. (I think that's what would be done in the method of undetermined coefficients...I usually don't use that procedure to solve DEs so I'm not entirely sure)

In the case of this difference equation the 'guess' particular solution would initially be x_n = C + Dn. But an 'n' is already in the homogeneous equation, so, generally, in such a situation would I multiply the trial function by some power of n? If so how would I decide which power of n to multiply the trial function by? Any help would be great thanks.

2. Nov 6, 2005

### HallsofIvy

Staff Emeritus
Yes, that is exactly true.
Now you've lost me. If this were the differential equation y"+ 4y'+ 4y= x, then the solution to the homogenous equation, y"+ 4y'+ 4y= 0, which has characteristic equation r2+ 4r+ 4= (r+ 2)2= 0 would be y(x)= Ce-2x+ Dxe-2x. Since the RHS, x, does NOT involve either e-2 or xe-2x, you would try a solution simply of the form y= Ax+ B. Then y'= A, y"= 0 so the equation becomes 0+4A+ 4Ax+4B= x. That is 4A= 1 and 4A+4B= 0: A= 1/4, B= -1/4. The general solution to the entire differential equation is y(x)= Ce-2x+ Dxe-2x+ (1/4)x- 1/4.
For the difference equation xn+2+ 4x1+ 4x= n,
the "homogenous" equation is xn+2+ 4x1+ 4x= 0. Its characteristic equation is r2+ 4r+ 4= (r+2)2= 0 as before so the general solution to the homogenous equation is, as you say, xn= A(-2)n+ Bn(-2)n.
If the right hand side involved (-2)n, then you would multiply by another "n": n2(-2)n. That is, to find a specific solution to xn+2+ 4xn+1+ 4xn= (-2)n, you would try a solution of the form
xn= Cn2(-2)n, Then
xn+1= C(n+1)2(-2)n+1
= -2Cn2(-2)n- 4Cn(-2)n-2A(-2)n
xn+2= C(n+2)2(-2)n+2
= 4Cn2(-2)n+ 16Cn(-2)n+ 16C(-2)n.
4xn+1= -8Cn2(-2)n-16Cn(-2)n+16A(-2)n
4xn= 4Cn2(-2)n
so the equation reduces to 8C(-2)n= (-2)n and we must have C= 1/8. The general solution to that difference equation is
xn= A(-2)n+ Bn(-2)n- (1/8)n2(-2)n = (A+ Bn- (1/8)n2)(-2)n.
However, for the equation you give: xn+2+ 4xn+1+ 4xn= n, the right hand side does NOT involve (-2)n so we would just try xn= Cn+ D. Then xn+1= Cn+ C+ D and
xn+2= Cn+ 2C+ D.
4xn+1= 4Cn+ 4C+ 4D
4xn= 4Cn
The equation becomes 9Cn+ 6C+ 5D= n so 9C= 1, 6C+ 5D= 0. C= 1/9,
D= -(6/9)/5= -2/15. The general solution to the difference equation xn+2+ 4xn+1+ 4xn= n is xn= A(-2)n+ Bn(-2)n+ (1/9)n- 2/15.

Last edited: Nov 6, 2005
3. Nov 6, 2005

### Benny

Thanks for the clarification and extra information.