# Solving the following (fairly simple) differential equation…

I need to solve the following differential equation:

$$y'\cos^2x+y=\tan(x)$$

I have tried to solve it using the integrating factor $e^{\int (1/\cos^2x) \mathrm{d}x}$, but things got messed up. How am I to solve it? Should I try a different path?

Thank you!

• Is your problem $\int \frac {dx}{\cos^2(x)}=$ "something" ? – Claude Leibovici Aug 12 '14 at 9:37
• I think you have already solved your question. – Enthusiastic Engineer Aug 12 '14 at 9:50

First, solve the homogeneous equation $Y'\cos^2(x)+Y=0$

This leads to $Y=c*e^{\tan(x)}$

Then use the method of variation of the constant : let $y=f(x)*e^{\tan(x)}$

Plug this function into $y'\cos^2(x)+y=\tan(x)$

After simplification, determine $f(x)$ by a simple integration.

$y'cos^2x+y=tan(x)=y' + y\sec^2x=\tan x \sec^2x$.  $I.F. =e^{\int\sec^2xdx}=e^{\tan x}$ So the solution becomes :  $y* e^{\tan x}=\int\tan x\sec^2 x e^{\tan x} dx$. Now let $tan x=u$. So you get in the RHS  $\int ue^udu=e^u(u+1)$. Now resubstitute to get in the RHS $e^{\tan x}(\tan x +1)$. So that the final solution is  $y* e^{\tan x}=e^{\tan x}(\tan x +1) + c$ or in a better way  $y=ce^{-\tan x} + \tan x +1$

• Is not the general solution of this D.E, there is problem to dividing by $\cos ^2$ it vanish. – Hamou Aug 12 '14 at 10:36