Solution (source code)

= Solution

Use <separation of variables> on intervals avoiding zeros of $\cos x$:
$$
\int\frac{dy}{1+y^2}=\int\sec^2x\,dx,\qquad\arctan y=\tan x+C.
$$
Taking the <tangent> gives the real general solution
$$
\boxed{y(x)=\tan(\tan x+C).}
$$
Each solution is restricted to an interval where both the original equation and this expression are finite. There is no real constant solution because $1+y^2$ never vanishes for real $y$.