Answer
$y=\sin x \cos x+c\cos x$
Work Step by Step
Here, we have $y'+(\tan x)y=\cos^2(x)$ ....(1)
The integrating factor is: $v(x)=e^{\tan x dx}=\dfrac{1}{\cos x}$
In order to determine the general solution, multiply equation (1) with the integrating factor and integrate both sides.
$\int (\dfrac{1}{\cos x})y'+(\dfrac{\sin x}{\cos^2 x})y=\int \cos x dx$ ...(2)
Equation (2) gives:
$\int (\dfrac{1}{\cos x} y)'=\int \cos x$
or, $\dfrac{1}{\cos x}y=\sin x+c$
Thus, the general solution is as follows:
$y=\sin x \cos x+c\cos x$