# A second order non homo differential equation

1. Jan 11, 2010

### James889

Hi,

i have the following non-homo differential equation.

$$y^{\prime\prime}+4y = 2~cos~x + 3x~sin~x$$

$$\begin{cases} y(0) = 1 \\ y^{\prime}(0) = 2 \end{cases}$$

Since there is a 3x term in front of sin x.
What is the form of the solution for this problem?

if it hadn't been there it probably would have been $$Asin~x + Bcos~x$$

//James

2. Jan 11, 2010

### Staff: Mentor

For your particular solution, try yp = Asinx + Bcosx + Cxsinx + Dxcosx. The Asinx + Bcosx that you were going to try would work if the right side had been just 2cosx.

Presumably you already know the solutions to the related homogeneous equation...

3. Jan 11, 2010

### James889

Yes, the homo equation isn't a problem. Hm how did you know that the correct form was Asinx + Bcosx + Cxsinx + Dxcosx. ?

4. Jan 11, 2010

### Staff: Mentor

It's kind of a long story, so I'll try to make it a little shorter.

Right side Particular soln
constant A
kx A + Bx
kx^2 A + Bx + Cx^2
etc.

m*sin x Asinx + Bcosx
n*cos x ditto
m*sinx + n*cosx ditto

m*xsin x Asinx + Bcosx + Cxsinx + Dxcosx
n*xcos x ditto
m*xsinx + n*xcosx ditto

m*x^2*sin x Asinx + Bcosx + Cxsinx + Dxcosx + Ex^2*sinx + Fx^2*cosx
n*x^2*cos x ditto
m*x^2*sinx + n*x^2*cosx ditto
etc.

e^x Ae^x
xe^x Ae^x + Bxe^x
x^2*e^x Ae^x + Bxe^x + Cx^2*e^x
etc.

All of the above assume that the particular solution is NOT also a solution of the homogeneous problem.

There are a few more, but this should get you started.
Mark

5. Jan 11, 2010

### James889

Would the case be different if i were given a solution?

6. Jan 11, 2010

### vela

Staff Emeritus
Consider the form of the differential equation the forcing function would satisfy. The term $\cos x$ satisfies $y''+y=(D^2+1)y=0$, where $D$ is the differentiation operator. The $x$ in front of the $\sin x$ indicates you have a double root, which suggests that term is a solution to $(D^2+1)^2y=0$ (which $\cos x$ is also a solution of). You can use this to convert the inhomogeneous equation

$$(D^2+4)y=y''+4y=2\cos x+3x\sin x$$

into a homogeneous one by applying $(D^2+1)^2$ to both sides to get

$$(D^2+1)^2(D^2+4)y = (D^2+1)^2(2\cos x+3x\sin x)$$
$$(D^2+1)^2(D^2+4)y = 0$$

The general solution to this homogeneous equation is

$$y=A\sin x+B\cos x+Cx\sin x+Dx\cos x+E\sin 2x+F\cos 2x$$

The last two terms are the ones you found when you solved the original homogeneous equation. The remaining terms are what you try as your particular solution.

In practice, there's a pattern to what kinds of terms appear in the particular solution based on the terms in the forcing function, so you can just write down what the solution should look like without going through this operator mess.