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

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

3. 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}$.

4. oh, wow, i forgot to add $\displaystyle y(pi)=5$

5. 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$.

6. Originally Posted by KennyP33
oh, wow, i forgot to add $\displaystyle y(pi)=5$
Still - it's the second one.

7. so the one without the negative sign?

8. Originally Posted by KennyP33
so the one without the negative sign?
Yep!

9. 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}$.