# Thread: [SOLVED] variation of parameters

1. ## [SOLVED] variation of parameters

Could someone show me where I am going wrong? I need to solve this using varation of parameters.

$\displaystyle y''+y=cos(x)$

First I found the solution to the homogeneous equation:
$\displaystyle y''+y=0$
$\displaystyle m^{2}+1=0$
$\displaystyle y_{c}=c_{1}sin(x)+c_{2}cos(x)$

Next, (note that y' is hard to see in math form)**
$\displaystyle y_{p}=u_{1}cos(x)+u_{2}sin(x)$
$\displaystyle y_{p}'=u_{1}'cos(x)-u_{1}sin(x)+u_{2}'sin(x)+u_{2}cos(x)$

Next I set this to 0:
$\displaystyle u_{1}'cos(x)+u_{2}'sin(x)=0$

This changes $\displaystyle y_{p}$ to:
$\displaystyle y_{p}'=-u_{1}sin(x)+u_{2}cos(x)$

$\displaystyle y''_{p}=-u_{1}'sin(x)-u_{1}cos(x)+u_{2}'cos(x)-u_{2}sin(x)$

Next I plugged $\displaystyle y_{p},y'_{p},y''_{p}$ into the Origioal DE for $\displaystyle y,y'',y''$ respectively.

My result is:
$\displaystyle -u_{1}'sin(x)+u'_{2}cos(x)=cos(x)$
Second equation from before:
$\displaystyle u'_{1}cos(x)+u'_{2}sin(x)=0$

Solving these 2 equation for $\displaystyle u'_{1}$ and $\displaystyle u'_{2}$ I get:
$\displaystyle u'_{1}=-sin(x)cos(x)$
$\displaystyle u'_{2}=cos^{2}(x)$

Integrating:
$\displaystyle u_{1}=\dfrac{cos^{2}(x)}{2}$
$\displaystyle u_{2}=\dfrac{x}{2}+\dfrac{1}{2}sin(x)cos(x)$

Using the formula:
$\displaystyle y=y_{c}+y_{p}$
$\displaystyle y=c_{1}sin(x)+c_{2}cos(x)+\dfrac{cos^{2}(x)}{2}+\d frac{x}{2}+\dfrac{1}{2}sin(x)cos(x)$

The solution should be:$\displaystyle y=c_{1}sin(x)+c_{2}cos(x) +\dfrac{1}{2}x sin(x)$
This is according to wolfram alpha:http://www.wolframalpha.com/input/?i...y%3Dcos%28x%29

2. You almost made it. Your solution for $\displaystyle u_1\text{ and }u_2$ is correct, but you need to plug those into the equation for $\displaystyle y_p$:

$\displaystyle y_p=u_1\cos(x)+u_2\sin(x)$

$\displaystyle y_p=\frac{cos^{2}(x)}{2}cos(x)+\left(\frac{x}{2}+\ frac{1}{2}cos(x)sin(x)\right)sin(x)$

$\displaystyle y_p=\frac{cos^{2}(x)}{2}cos(x)+\frac{x}{2}sin(x)+\ frac{1}{2}cos(x)sin^{2}(x)$

and the first and third terms combine using $\displaystyle cos^2(x)+sin^2(x)=1$

$\displaystyle y_p=\frac{1}{2}cos(x)+\frac{1}{2}xsin(x)$

And the first term is absorbed into the homogeneous solution.

Post again if you are still having trouble.

3. ## thanks!

Now i know how to do this. Thanks.

There was one other part of the problem that I was a little unsure of:
First I found the solution to the homogeneous equation:

Okay, this should be simple but I am not quite sure.
$\displaystyle m=\sqrt{i}$ or $\displaystyle m=-\sqrt{i}$

That makes the solution to the homogeneous equation:
$\displaystyle y_{c}=c_{1}e^{ix}+c_{2}e^{-ix}$

Using euler's method:
$\displaystyle y_{c}=c_{1}(cos(x)+i sin(x))+c_{2}(cos(-x)+i sin(-x))$
$\displaystyle y_{c}=c_{1}cos(x)+c_{1}isin(x)+c_{2}cos(x)-c_{2}isin(x)$

How does this simplify to ?
Or mabye this process is wrong..

4. Originally Posted by snaes
Now i know how to do this. Thanks.

There was one other part of the problem that I was a little unsure of:
First I found the solution to the homogeneous equation:

Okay, this should be simple but I am not quite sure.
$\displaystyle m=\sqrt{i}$ or $\displaystyle m=-\sqrt{i}$

That makes the solution to the homogeneous equation:
$\displaystyle y_{c}=c_{1}e^{ix}+c_{2}e^{-ix}$

Using euler's method:
$\displaystyle y_{c}=c_{1}(cos(x)+i sin(x))+c_{2}(cos(-x)+i sin(-x))$
$\displaystyle y_{c}=c_{1}cos(x)+c_{1}isin(x)+c_{2}cos(x)-c_{2}isin(x)$

How does this simplify to ?
Or mabye this process is wrong..
you are almost there

$\displaystyle y_{c}=c_{1}cos(x)+c_{1}isin(x)+c_{2}cos(x)-c_{2}isin(x)$

$\displaystyle y = (c_{1} + c_{2})\cos{x} + (c_{1}i - c_{2}i)\sin{x}$

now you can just say

$\displaystyle c_{1} + c_{2} = c_{3}$

and

$\displaystyle c_{1}i - c_{2}i = c_{4}$

combine that all together and you get

$\displaystyle y= c_{3}\cos{x} + c_{4}\sin{x}$

5. ## Thanks!

Thanks for finishing that off for me.