\[\cos^2 x\frac{dy}{dx} + y = \tan x\]

#### Solution

We have,

\[ \cos^2 x\frac{dy}{dx} + y = \tan x\]

\[ \Rightarrow \frac{dy}{dx} + \left( \sec^2 x \right)y = \left( \tan x \right) \sec^2 x\]

\[\text{Comparing with }\frac{dy}{dx} + Px = Q,\text{ we get}\]

\[P = \sec^2 x \]

\[Q = \left( \tan x \right)\left( \sec^2 x \right)\]

Now,

\[I . F . = e^{\int \sec^2 x dx} = e^{\tan x} \]

So, the solution is given by

\[y \times e^{\tan x} = \int\left( \tan x \right)\left( \sec^2 x \right) \times e^{\tan x} dx + C\]

\[ \Rightarrow y e^{\tan x} = I + C . . . . . . . . . . \left( 1 \right)\]

Now,

\[I = \int\left( \tan x \right)\left( \sec^2 x \right) \times e^{\tan x} dx\]

Putting `t = tan x,` we get

\[dt = \sec^2 x dx\]

\[ = t \times \int e^t dt - \int\left( \frac{d t}{d t} \times \int e^t dt \right)dt\]

\[ = t e^t - \int e^t dt\]

\[ = t e^t - e^t \]

\[ \Rightarrow I = \tan x e^{\tan x} - e^{\tan x} = e^{\tan x} \left( \tan x - 1 \right)\]

Putting the value of `I` in (1), we get

\[y e^{\tan x} = e^{\tan x} \left( \tan x - 1 \right) + C\]