Find the general solution of $$2x\cos^2(y)+(x^2+1)\sin(y)y'=0.$$
First, I divided by $\sin(y)$: $$2x\frac{\cos^2(y)}{\sin(y)}+(x^2+1)y'=0\implies(x^2+1)y'=-2x\frac{\cos^2(y)}{\sin(y)},$$ so $$\frac{\sin(y)}{\cos^2(y)}y'=-\frac{2x}{x^2+1}\implies\int\frac{\sin(y)}{\cos^2(y)}\,\mathrm{d}y=\int-\frac{2x}{x^2+1}\,\mathrm{d}x.$$ For LHS: pick $u=\cos(y)$, so $\mathrm{d}u=-\sin(y)\,\mathrm{d}y$, then the integral becomes $$-\int\frac{1}{u^2}\,\mathrm{d}u=\frac{1}{u}+C_1=\frac{1}{\cos(y)}+C_1=\sec(y)+C_1.$$ For RHS: pick $u=x^2+1$, then $\mathrm{d}u=2x\,\mathrm{d}x$, so the integral becomes $$-\int\frac{1}{u}\,\mathrm{d}u=-\ln\lvert u\rvert+C_2=-\ln\lvert x^2+1\rvert+C_2\underbrace{=}_{x^2+1>0}-\ln(x^2+1)+C_2.$$ Finally, $$\sec(y)+C_1=-\ln(x^2+1)+C_2\implies\boxed{y=\sec^{-1}(-\ln(x^2+1)+C)}.$$ However, WA gives two solutions:
https://www.wolframalpha.com/input/?i=2x(cos(y))%5E2%2B(x%5E2%2B1)sin(y)y%27%3D0
One of them is my solution, and the other is $y=-\sec^{-1}(-\ln(x^2+1)+C)$, which is also true because if we plug it into the differential equation we end up with $0$, and $0=0$ is true.
What did I miss?
The secant function is even (and not injective). This means that $$\sec(y)=f(x)$$ has multiple solutions $y$ for any particular value of $x$. Two of these solutions are $$y=\pm \sec^{-1}(f(x))$$
But there are even more solutions than that. Since $\sec(x)$ is periodic with period $2\pi$, we also have solutions like $$y=2\pi k\pm\sec^{-1}(f(x))$$ where $k\in\mathbb Z$.