# Initial value problem

• Feb 4th 2010, 02:04 PM
KennyP33
Initial value problem
I'm so close to the answer, I've narrowed it down to two possibilites, here is the question:

Find the initial value problem:

$\displaystyle cos(x)dy/dx-ysin(x)=xcos(x)$

$\displaystyle y= -(x)tan(x)+1-4sec(x)$ or $\displaystyle y= (x)tan(x)+1-4sec(x)$

Any help is greatly appreciated!
• Feb 4th 2010, 02:36 PM
Jester
Quote:

Originally Posted by KennyP33
I'm so close to the answer, I've narrowed it down to two possibilites, here is the question:

Find the initial value problem:

$\displaystyle cos(x)dy/dx-ysin(x)=xcos(x)$

$\displaystyle y= -(x)tan(x)+1-4sec(x)$ or $\displaystyle y= (x)tan(x)+1-4sec(x)$

Any help is greatly appreciated!

Assuming that the IC is $\displaystyle y(0)=-3$, it's the second answer.
• Feb 4th 2010, 02:41 PM
Prove It
Quote:

Originally Posted by KennyP33
I'm so close to the answer, I've narrowed it down to two possibilites, here is the question:

Find the initial value problem:

$\displaystyle cos(x)dy/dx-ysin(x)=xcos(x)$

$\displaystyle y= -(x)tan(x)+1-4sec(x)$ or $\displaystyle y= (x)tan(x)+1-4sec(x)$

Any help is greatly appreciated!

$\displaystyle \cos{x}\frac{dy}{dx} - (\sin{x})y = x\cos{x}$

$\displaystyle \frac{dy}{dx} - (\tan{x})y = x$.

This is first order linear, so use the integrating factor:

$\displaystyle e^{\int{\tan{x}\,dx}} = e^{-\ln{(\cos{x})}} = e^{\ln{\sec{x}}} = \sec{x}$.

Multiplying through by the integrating factor gives:

$\displaystyle \sec{x}\frac{dy}{dx} - (\sec{x}\tan{x})y = x\sec{x}$

The left hand side is a product rule expansion of $\displaystyle (\sec{x})y$, so

$\displaystyle \frac{d}{dx}[(\sec{x})y] = x\sec{x}$

$\displaystyle (\sec{x})y = \int{x\sec{x}\,dx}$.

So $\displaystyle y = \cos{x}\int{x\sec{x}\,dx}$.
• Feb 4th 2010, 02:49 PM
KennyP33
oh, wow, i forgot to add $\displaystyle y(pi)=5$
• Feb 4th 2010, 03:06 PM
Jester
Quote:

Originally Posted by Prove It
$\displaystyle \cos{x}\frac{dy}{dx} - (\sin{x})y = x\cos{x}$

$\displaystyle \frac{dy}{dx} - (\tan{x})y = x$.

This is first order linear, so use the integrating factor:

$\displaystyle e^{\int{\tan{x}\,dx}} = e^{-\ln{(\cos{x})}} = e^{\ln{\sec{x}}} = \sec{x}$.

Multiplying through by the integrating factor gives:

$\displaystyle \sec{x}\frac{dy}{dx} - (\sec{x}\tan{x})y = x\sec{x}$

The left hand side is a product rule expansion of $\displaystyle (\sec{x})y$, so

$\displaystyle \frac{d}{dx}[(\sec{x})y] = x\sec{x}$

$\displaystyle (\sec{x})y = \int{x\sec{x}\,dx}$.

So $\displaystyle y = \cos{x}\int{x\sec{x}\,dx}$.

I believe that $\displaystyle P(x) = - \tan x$ and not what you have $\displaystyle P(x) = \tan x$.
• Feb 4th 2010, 03:14 PM
Jester
Quote:

Originally Posted by KennyP33
oh, wow, i forgot to add $\displaystyle y(pi)=5$

Still - it's the second one.
• Feb 4th 2010, 03:24 PM
KennyP33
so the one without the negative sign?
• Feb 4th 2010, 03:28 PM
Jester
Quote:

Originally Posted by KennyP33
so the one without the negative sign?

Yep!
• Feb 4th 2010, 04:44 PM
Prove It
Quote:

Originally Posted by Danny
I believe that $\displaystyle P(x) = - \tan x$ and not what you have $\displaystyle P(x) = \tan x$.

Thanks.

So to fix up my mistake...

The integrating factor is $\displaystyle e^{\int{-\tan{x}\,dx}} = e^{\ln{(\cos{x})}} = \cos{x}$.

So multiplying through we find

$\displaystyle \cos{x}\,\frac{dy}{dx} - (\sin{x})y = x\cos{x}$.

The LHS is a product rule expansion, so

$\displaystyle \frac{d}{dx}[(\cos{x})y] = x\cos{x}$

So $\displaystyle (\cos{x})y = \int{x\cos{x}\,dx}$.

Now integrating by parts with $\displaystyle u = x$ so that $\displaystyle du = 1$ and $\displaystyle dv = \cos{x}$ so that $\displaystyle v = \sin{x}$, we have

$\displaystyle (\cos{x})y = x\sin{x} - \int{\sin{x}\,dx}$

$\displaystyle (\cos{x})y = x\sin{x} + \cos{x} + C$

$\displaystyle y = x\tan{x} + 1 + C\sec{x}$.