Solution (source code)

= Solution

Use the substitution $v=y/x$ for a <homogeneous first-order differential equation>. Since $y'=v+xv'$, it gives
$$
xv'=\tan v.
$$
Where $\sin v\ne0$, this <separable differential equation> integrates to $\ln|\sin v|=\ln|x|+C$, hence $\sin v=C_1x$. One can obtain the same relation without division by $\sin v$: the equation gives $(\sin v)'=(\sin v)/x$, so $\sin v=C_1x$, including $\sin v\equiv0$.

All real branches of the <inverse sine> are captured by
$$
\boxed{y(x)=x\left[k\pi+(-1)^k\arcsin(Cx)\right],\qquad C\in\mathbb R,\quad k\in\mathbb Z.}
$$
Each branch is used on an <interval> with $x\ne0$ and $|Cx|<1$, with fixed $k$. The strict inequality excludes zeros of $\cos(y/x)$, where the original <tangent> is undefined. When $C=0$, the formula includes all straight-line solutions $y=k\pi x$. Keeping both families of <inverse sine> branches is essential for the two different <initial conditions> below.