# Solving second order unhomogonous equations

1. Feb 3, 2008

### sweep123

1. The problem statement, all variables and given/known data
solve y"+y=xsin(x) , initial conditions y(0)=0, y'(0)=1

2. Relevant equations

3. The attempt at a solution
I know that when right hand side equals something like sin(x), then the particular integral is xc1sin(x)+xc2cos(x). I am unsure what the particular integral should be for above. can anyone help me. I have tried (x^2)c1sin(x)+(x^2)c2cos(x), but have not gotten a solution from it. Thanks

2. Feb 3, 2008

### Dick

You need a bigger family of trial functions. Try c1*x^2*sin(x)+c2*x^2*cos(x)+c3*x*sin(x)+c4*x*cos(x).

3. Feb 3, 2008

### Dmak

instead of looking at that equation you could try to look at an equivalent equation
$$L[y] = y'' + y = xe^{ix}$$, where $$i = \sqrt{-1}$$. then since $$i$$ is a particular root of the characteristic equation, y has a solution of the form
$$y = x^{2}A_{0}e^{ix}$$ from there it is easily shown that the complex part of the solution of $$y$$ is the solution of the original equation you proposed.

You could also try the variation of parameters method but I often avoid it because of messy integration

Last edited: Feb 3, 2008
4. Feb 3, 2008

### Dick

I really don't know what you are talking about, but neither the real nor the imaginary part of x^2*exp(ix) is a particular solution to y''+y=x*sin(x).

5. Feb 3, 2008

### Dmak

whoops what i meant was a particular solution of the form:
$$y = x(A_{0} + A_{1}x)e^{xi}$$ you have to derive the coefficients by evaluating $$L[y]$$ and matching up the coefficients $$A_{0}, A_{1}$$ with the right hand side of the equation ( $$xe^{ix}$$ ) then you use the imaginary portion of this solution, this one was more tedious than I thought and I would recommend using the variation of parameters method.

6. Feb 3, 2008

### sweep123

thanks. thats really helpful. is there anyway of knowing what the particular integral is for any unhomogenous second order differential equation, or is it just trial and error?

7. Feb 3, 2008

### sweep123

ive just tried substituting the particular integral
y(x)= c1(x^2)sin(x)+c2(x^2)cos(x)+xc3sin(x)+xc4cos(x) into y"+y=xsinx. I end up with
2c1sin(x)+4xc1cos(x)+2c2cos(x)-4xc2sin(x)+2c3cos(x)-2c4sin(x)=xsin(x)

This doesn't look solvable. Ive checked my differentiating a couple of times and it looks okay. Any suggestions where I may be going wrong?

Last edited: Feb 3, 2008
8. Feb 3, 2008

### Dmak

This would be a fine method: http://www.sosmath.com/diffeq/second/variation/variation.html

essentially find two homogeneous solutions $$y_{1}, y_{2}$$ then using those you can find a solution to the differentiall equation of the form,

$$\phi(x) = y_{1}u_{1} + y_{2}u_{2}$$
where
$$u'_{1} = \frac{-sin(x)y_{2}}{W[y_{1}, y_{2}]}$$
$$u'_{2} = \frac{sin(x)y_{1}}{W[y_{1}, y_{2}]}$$
and
$$W[y_{1}, y_{2}] = y_{1}'y_{2} - y_{1}y_{2}'$$

Last edited: Feb 3, 2008
9. Feb 3, 2008

### Dick

It is solvable. How about c1=c4=0 and c2=-1/4 and c3=1/4? You just have to try harder.

10. Feb 4, 2008

### sweep123

oh yeah. i should have spent a bit more time on that. Thanks