# ODE using variation of parameters

• Jan 27th 2009, 06:16 PM
stevedave
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.

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

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

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

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

and
$\displaystyle v=\int{e^{-2x}cos(e^{-x})dx}$
$\displaystyle v=e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-2e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}dx}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2\int{e^{-x}sin(e^{-x})dx}$
$\displaystyle 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}]$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2\int{cos(e^{-x})dx}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2sin(e^{-x})\frac{1}{-e^{-x}}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})-2e^{x}sin(e^{-x})$

and so
$\displaystyle 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})$
$\displaystyle y_p=-2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

and finally the general solution
$\displaystyle 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
$\displaystyle 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.(Headbang)

Any pointers will be very appreciated.
• Jan 28th 2009, 10:26 AM
Jester
Quote:

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.

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

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

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

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

and
$\displaystyle v=\int{e^{-2x}cos(e^{-x})dx}$
$\displaystyle v=e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}-\int{-2e^{-2x}sin(e^{-x})\frac{1}{-e^{-x}}dx}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2\int{e^{-x}sin(e^{-x})dx}$
$\displaystyle 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}]$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2\int{cos(e^{-x})dx}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})+2sin(e^{-x})\frac{1}{-e^{-x}}$
$\displaystyle v=-e^{-x}sin(e^{-x})-2cos(e^{-x})-2e^{x}sin(e^{-x})$

and so
$\displaystyle 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})$
$\displaystyle y_p=-2e^{3x}sin(e^{-x})-e^{2x}cos(e^{-x})$

and finally the general solution
$\displaystyle 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
$\displaystyle 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.(Headbang)

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

$\displaystyle w = e^{-x}$

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

which integrate easily giving

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

and thus

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

Things should work OK from here.
• Jan 29th 2009, 03:57 AM
stevedave
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.