# Solving a first order differential equation

#### LLand314

##### Member
cosx(dy/dx) + ysinx = sinx cosx

(dy/dx) + y/cosx = 1

e^integral (1/cosx) ?

I feel like this has to do with ln again but not sure

#### MarkFL

Staff member
In your attempt to write the equation in standard linear form, you have made a few errors when dividing through by $\cos(x)$. Try it again and see what you get.

#### LLand314

##### Member
In your attempt to write the equation in standard linear form, you have made a few errors when dividing through by $\cos(x)$. Try it again and see what you get.

dy/dx + ysinx/cosx = (sinx cosx)/cosx

dy/dx + ytanx = tanx ?

Or would I divide sinx first and move it over the other side before I divide cosx

#### MarkFL

Staff member
You have the left side correct as $$\displaystyle \frac{\sin(x)}{\cos(x)}=\tan(x)$$, but the right side would simply have $$\displaystyle \cos(x)$$ cancelling, leaving $$\displaystyle \sin(x)$$.

Your goal in arranging the equation in standard linear form is to get it in the form:

$$\displaystyle \frac{dy}{dx}+P(x)y=Q(x)$$

and since this equation was given in the form:

$$\displaystyle f(x)\frac{dy}{dx}+g(x)y=h(x)$$

you simply need to divide through by $f(x)$ to get in the the standard form.

#### LLand314

##### Member
You have the left side correct as $$\displaystyle \frac{\sin(x)}{\cos(x)}=\tan(x)$$, but the right side would simply have $$\displaystyle \cos(x)$$ cancelling, leaving $$\displaystyle \sin(x)$$.

Your goal in arranging the equation in standard linear form is to get it in the form:

$$\displaystyle \frac{dy}{dx}+P(x)y=Q(x)$$

and since this equation was given in the form:

$$\displaystyle f(x)\frac{dy}{dx}+g(x)y=h(x)$$

you simply need to divide through by $f(x)$ to get in the the standard form.
So is my integrating factor 1/cosx ?

So it becomes (dy/dx)(1/cosx) + (ytanx)(1/cosx) = tanx

Integral (ytanx)(1/cosx) = integral tanx

y(1/cosx) = ln|secx| + C
y= cosx ln|secx| + Ccosx ?

#### MarkFL

Staff member
Yes, I would write:

$$\displaystyle \mu(x)=e^{\int\tan(x)\,dx}=\sec(x)$$ and so we have:

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

$$\displaystyle \frac{d}{dx}\left(\sec(x)y \right)=\tan(x)$$

$$\displaystyle \int\,d\left(\sec(x)y \right)=\int\tan(x)\,dx$$

$$\displaystyle \sec(x)y=\ln|\sec(x)|+C$$

$$\displaystyle y(x)=\cos(x)\left(\ln|\sec(x)|+C \right)$$