$\frac{dy}{dx} + \frac{\sin 2y}{x} =x^3 \cos^2 y$ . Can we multiply $\sec^2 y $ with the equation? Consider the differential equation $$\frac{dy}{dx} + \frac{\sin 2y}{x} =x^3 \cos^2 y.$$
$$\Rightarrow (\sec^2 y )\frac{dy}{dx}  + \frac{2\tan y}{x}   = x^3$$ 
I can not understand how we are multiplying the equation by $\sec^2 y$. We are supposing that $\sec^2 y$ exists. That means we supposing that $y$ can  not be $ \frac{\pi}{2}$. How can we suppose that?
$$\Rightarrow \frac{d(x^2 \tan y)}{dx}  = x^5$$
Then integrating both sides we get $x^2 \tan y = \frac{x^6}{6} +c$ ($c$ is an arbitrary constant).
Can anyone please help me to understand how the second line comes from the first line.
Have I gone wrong anywhere else? can anyone please check it? 
 A: Here is how I would write the solution.  Let $y:\mathbb{R}_{\neq 0}\to\mathbb{R}$ be a differentiable function such that
$$\frac{\text{d}}{\text{d}x}\,y(x)+\frac{\sin\big(2\,y(x)\big)}{x}=x^3\,\cos^2\big(y(x)\big)$$
for all $x\in\mathbb{R}_{\neq 0}$.  If $\cos^2\big(y(x)\big)=0$ for all $x\in\mathbb{R}$, then there exists an integer $k$ such that 
$$y(x)=\frac{(2k+1)\pi}{2}$$
for all $x\in\mathbb{R}_{\neq 0}$.  From now on, we assume that $y(a)\neq 0$ for some $a\in\mathbb{R}_{\neq 0}$.
Let $U$ be the subset of $\mathbb{R}_{\neq 0}$ containing elements $x$ such that $\cos\big(y(x)\big)\neq 0$.  We can write
$$\frac{\text{d}}{\text{d}x}\,\Big(x^2\,\tan\big(y(x)\big)\Big)=x^2\,\sec^2\big(y(x)\big)\,\left(\frac{\text{d}}{\text{d}x}\,y(x)+\frac{\sin\big(2\,y(x)\big)}{x}\right)=x^5$$
for all $x\in U$.  Thus, there is a constant $c\in\mathbb{R}$ such that
$$x^2\,\tan\big(y(x)\big)=\frac{x^6}{6}+c$$
for all $x\in U$.  This shows that, for some integer $k$,
$$y(x)=k\pi+\arctan\left(\frac{x^4}{6}+\frac{c}{x^2}\right)$$
for all $x\in U$.  Now, as you see,
$$-\frac{\pi}{2}<\arctan\left(\frac{x^4}{6}+\frac{c}{x^2}\right)<+\frac{\pi}{2}$$
for all $x\in\mathbb{R}_{\neq 0}$.  Ergo,
$$\cos\Biggl(k\pi+\arctan\left(\frac{x^4}{6}+\frac{c}{x^2}\right)\Biggr)  =(-1)^k\,\cos\Biggl(\arctan\left(\frac{x^4}{6}+\frac{c}{x^2}\right)\Biggr) \neq 0$$
for all $x\in\mathbb{R}_{\neq 0}$.  Therefore, $U$ must be $\mathbb{R}_{\neq 0}$ itself.
Remark.  The constant $c$ is not really a constant.  It should be regarded as a local constant.  That is, $c=c_+$ for $x>0$ and $c=c_-$ for $x<0$, with $c_+$ and $c_-$ not needing to be the same.  The same goes with $k$.  For $x>0$, you may have $k=k_+$; for $x<0$, you may have $k=k_-$.  Therefore, the solutions $y$ are of the following form:
$$y(x)=\left\{\begin{array}{ll}
k_+\pi+\arctan\left(\frac{x^4}{6}+\frac{c_+}{x^2}\right)&\text{if }x>0\,,\\
k_-\pi+\arctan\left(\frac{x^4}{6}+\frac{c_-}{x^2}\right)&\text{if }x<0\,,
\end{array}\right.$$
where $k_+,k_-\in\mathbb{Z}$ and $c_+,c_-\in\mathbb{R}\cup\{\infty\}$.  (Treat $\tan(\infty)$ as $\frac{\pi}{2}$.)
A: You can suppose that $$y\ne (2k+1)\fracπ2,$$ where $k\in\mathrm Z,$ since in that case the equation is satisfied. So that is one set of solutions. You find the interesting ones by performing the division.
