# Initial value problem

• February 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:

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

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

Any help is greatly appreciated!
• February 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:

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

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

Any help is greatly appreciated!

Assuming that the IC is $y(0)=-3$, it's the second answer.
• February 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:

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

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

Any help is greatly appreciated!

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

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

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

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

Multiplying through by the integrating factor gives:

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

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

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

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

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

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

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

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

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

Multiplying through by the integrating factor gives:

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

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

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

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

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

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

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

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

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

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

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

Thanks.

So to fix up my mistake...

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

So multiplying through we find

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

The LHS is a product rule expansion, so

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

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

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

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

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

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