# 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.

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

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

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

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

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

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

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

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

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

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

Using the formula:
$y=y_{c}+y_{p}$
$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: $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 $u_1\text{ and }u_2$ is correct, but you need to plug those into the equation for $y_p$:

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

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

$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 $cos^2(x)+sin^2(x)=1$

$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.
$m=\sqrt{i}$ or $m=-\sqrt{i}$

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

Using euler's method:
$y_{c}=c_{1}(cos(x)+i sin(x))+c_{2}(cos(-x)+i sin(-x))$
$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.
$m=\sqrt{i}$ or $m=-\sqrt{i}$

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

Using euler's method:
$y_{c}=c_{1}(cos(x)+i sin(x))+c_{2}(cos(-x)+i sin(-x))$
$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

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

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

now you can just say

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

and

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

combine that all together and you get

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

5. ## Thanks!

Thanks for finishing that off for me.