Given equation is cos2xdydx+y=tanx
⇒dydx+sec2xy=tanx.sec2x
The genral solution of the equation,
dydx+f(x).y=g(x)
is y=(e−∫f(x).dx)(∫g(x)e∫f(x).dx.dx+C)
In the equation, f(x)=sec2x,g(x)=tanx−sec2x
The general equation is,
y=(e−∫sec2xdx)(∫tanx.sec2xetanxdx+C)
∫tanx.sec2xetanxdx=tanx.etanx−∫∫sec2x.etanx
=(tanx−1)etanx
∴ The solution is y=e−tanx(etanx(tanx−1)+C)
y=tanx−1+Ce−tanx