# Math Help - ODE using variation of parameters

1. ## ODE using variation of parameters

I've worked this problem several times. I know I am making some sign errors along the way but I don't think that can account for the difference between my solution and the one in my text book.

$y''-3y'+2y=cos(e^{-x})$

I obtained solutions to homogeneous equation $y_1 = e^x$; $y_2=e^{2x}$ and so the Wronskian is $W(x) = e^{3x}$

the particular solution takes the form $y_p=uy_1+vy_2$ where $u'=-\frac{y_2f}{W}$ and $v'=\frac{y_1f}{W}$ where the driving force $f=cos(e^{-x})$

so,
$u=-\int{e^{-x}cos(e^{-x})dx}$
$u=-[e^{-x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-e^{-x}sin(e^{-x})\frac{1}{-e^{-x}}dx}]$
$u=sin(e^{-x})+\int{sin(e^{-x})dx}$
$u=sin(e^{-x})+(-cos(e^{-x}))\frac{1}{-e^{-x}}$
$u=sin(e^{-x})+e^xcos(e^{-x})$

and
$v=\int{e^{-2x}cos(e^{-x})dx}$
$v=e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-2e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}dx}$
$v=-e^{-x}sin(e^{-x})-2\int{e^{-x}sin(e^{-x})dx}$
$v=-e^{-x}sin(e^{-x})-2[e^{-x}(-cos(e^{-x}))\frac{1}{-e^{-x}}-\int{-e^{-x}(-cos(e^{-x}))\frac{1}{-e^{-x}}dx}]$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2\int{cos(e^{-x})dx}$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2sin(e^{-x})\frac{1}{-e^{-x}}$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})-2e^{x}sin(e^{-x})$

and so
$y_p = e^{x}sin(e^{-x})+e^{2x}cos(e^{-x})-e^xsin(e^{-x})-2e^{2x}cos(e^{-x})-2e^{3x}sin(e^{-x})$
$y_p=-2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

and finally the general solution
$y=c_1e^x+c_2e^{2x} -2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

but the solution in my text book is
$y=c_1e^x+c_2e^{2x}-e^{2x}cos(e^{-x})$

and I can't figure out where the sin term was supposed to disappear.

Any pointers will be very appreciated.

2. Originally Posted by stevedave
I've worked this problem several times. I know I am making some sign errors along the way but I don't think that can account for the difference between my solution and the one in my text book.

$y''-3y'+2y=cos(e^{-x})$

I obtained solutions to homogeneous equation $y_1 = e^x$; $y_2=e^{2x}$ and so the Wronskian is $W(x) = e^{3x}$

the particular solution takes the form $y_p=uy_1+vy_2$ where $u'=-\frac{y_2f}{W}$ and $v'=\frac{y_1f}{W}$ where the driving force $f=cos(e^{-x})$

so,
$u=-\int{e^{-x}cos(e^{-x})dx}$
$u=-[e^{-x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-e^{-x}sin(e^{-x})\frac{1}{-e^{-x}}dx}]$
$u=sin(e^{-x})+\int{sin(e^{-x})dx}$
$u=sin(e^{-x})+(-cos(e^{-x}))\frac{1}{-e^{-x}}$
$u=sin(e^{-x})+e^xcos(e^{-x})$

and
$v=\int{e^{-2x}cos(e^{-x})dx}$
$v=e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-2e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}dx}$
$v=-e^{-x}sin(e^{-x})-2\int{e^{-x}sin(e^{-x})dx}$
$v=-e^{-x}sin(e^{-x})-2[e^{-x}(-cos(e^{-x}))\frac{1}{-e^{-x}}-\int{-e^{-x}(-cos(e^{-x}))\frac{1}{-e^{-x}}dx}]$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2\int{cos(e^{-x})dx}$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2sin(e^{-x})\frac{1}{-e^{-x}}$
$v=-e^{-x}sin(e^{-x})-2cos(e^{-x})-2e^{x}sin(e^{-x})$

and so
$y_p = e^{x}sin(e^{-x})+e^{2x}cos(e^{-x})-e^xsin(e^{-x})-2e^{2x}cos(e^{-x})-2e^{3x}sin(e^{-x})$
$y_p=-2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

and finally the general solution
$y=c_1e^x+c_2e^{2x} -2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

but the solution in my text book is
$y=c_1e^x+c_2e^{2x}-e^{2x}cos(e^{-x})$

and I can't figure out where the sin term was supposed to disappear.

Any pointers will be very appreciated.
I think there's a problem with your integration to get u and v. Note, if you make the substitution

$w = e^{-x}$

$u = \int \cos w\, dw,\;\;\; \int w \cos w\, dw$

which integrate easily giving

$u = \sin w,\;\;\; v = \cos w + w \sin w$

and thus

$u = \sin e^{-x},\;\;\; v = \cos e^{-x} + e^{-x} \sin e^{-x}$

Things should work OK from here.

3. That worked out so much easier than what I was trying to do. Thank you very much. The terms of v are actually both negative but I noticed that when I worked through it again using the substitution.

*sigh* I stink at integration, I need to be able to see alternative options better when my first attempts don't work so great.