# Homework Help: Nonhomogeneous difference equation question

1. May 9, 2012

### samoth2

1. The problem statement, all variables and given/known data
Find the general solution

2. Relevant equations
x(t+2)-3x(t+1)+2x(t)=3*5^t+sin(0.5πt)

3. The attempt at a solution
I start out by solving the homogeneous equation and end up with the two roots 1 and 2.

Then I try to use the method of undetermined coefficients to find a particular solution.

I guess that the solution is of the following form (I should probably include a cos term as well)

u(t)=C*3*5^t+D*sin(0.5πt)

then

u(t+1)=C*3*5^(t+1)+D*sin(0.5π(t+1))

and

u(t+2)=C*3*5^(t+2)+D*sin(0.5π(t+2))

I then insert these equations into the original equation to get

C*3*5^(t+2)+D*sin(0.5π(t+2))-3*(C*3*5^(t+1)+D*sin(0.5π(t+1)))+2*(C*3*5^t+D*sin(0.5πt))=3*5^t+sin(0.5πt)

move the terms around a bit to get

3*5^t(C*5^2-3*C*5+2*C)+D*sin(0.5π(t+2)-3*D*sin(0.5π(t+1))+2*D*sin(0.5πt)=3*5^5+sin(0.5πt)

From the first part I see that

(C*5^2-3*C*5+2*C)=1

so

C=1/12

I would like to do something similar for the sin part of the expression, but I'm not sure how to handle it.
I tried with sin(0.5π(t+2))=sin(0.5πt+π)=-sin(0.5πt) but then I don't know what to do with sin(0.5(t+1)).

If anyone has any hints, tips or tricks I would be happy.

I hope the equations are understandable otherwise I'll post them as a picture.

2. May 9, 2012

### sharks

Is this your original equation? It doesn't look like a non-homogeneous ODE to me.
$$x(t+2)-3x(t+1)+2x(t)=3(5^t)+sin(0.5πt)$$
I just noticed in your title you call it a "difference equation" and not "differential equation", in which case, i might have misunderstood the problem.

3. May 9, 2012

### samoth2

I just realized I can do subscripts. The original problem is this:

xt+2-3xt+1+2xt=3(5t)+sin(0.5πt)

Yeah it's a difference equation so we only have discrete moments of time.