# Differential equation with homoegeneous coefficient, solution other than in book

I have a differential equation:

$$x \frac{dy}{dx} - y - x\sin\left(\frac{y}{x}\right) = 0.$$

I'm multiplying both sides by $dx$ and I'm obtaining:

$$x\,dy - y\,dx - x \sin\left(\frac{y}{x}\right)\, dx = 0.$$

Next, after simplification I have:

$$x\,dy - \left(y+\sin\left(\frac{y}{x}\right)\right)\,dx = 0.$$

This is a homogeneous differential equation with homogeneous functions of order $1$ right?

So I use substitution:

$$y = ux, dy = u\,dx + x\,du$$

and I'm obtaining the equation:

$$x(u\,dx + x\,du ) -\left(ux + \sin\left(\frac{y}{x}\right)\right)\,dx = 0.$$

After simplification I'm obtaining:

$$x^{2}\, du - \sin(u)\, dx = 0.$$

So, next I'm dividing equation boths sides by: $\sin(u)x^{2}$:

$$\frac{du}{\sin(u)} - \frac{dx}{x^{2}} = 0.$$

Because :

$$\int \frac{dx}{x^{2}} = \frac{-1}{x} + C$$

and

$$\int\frac{du} {\sin(u)} = \ln \left| \tan\left(\frac{u}{2}\right)\right| + C.$$

So:

$$\ln \left|\tan\left(\frac{u}{2}\right)\right| + \frac{1}{x} = C.$$

Next:

$$\ln \left| \tan\left(\frac{y}{2x}\right)\right| = C - \frac{1}{x}$$

$$e^{C-\frac{1}{x}} = \left|\tan\left(\frac{y}{2x}\right)\right|$$

$$\pm e^{c} e^{\frac{-1}{x}} = \tan\left(\frac{y}{2x}\right).$$ Now I'm substituting $d = \pm e^{e^{c}}$

and in consequence I have:

$$de^{\frac{-1}{x}} = \tan\left(\frac{y}{2x}\right)$$

$$\arctan\left(d e^{\frac{-1}{x}} \right) = \frac{y}{2x}$$

$$y = 2x \cdot \arctan\left(de^{\frac{-1}{x}}\right).$$

When I look on the answer from the book there is:

$$y = 2x \cdot \arctan(cx).$$

Why here is $x$ instead $e^{\frac{-1}{x}}$ ? I don't know. Is my answer wrong? I will be greatfull for help. Best regards.

You forgot $x$ in the third step it should be $$x\,dy - \left(y+\ x\sin\left(\frac{y}{x}\right)\right)\,dx = 0.$$
\eqalign{\sin(2 \arctan(cx)) &= 2 \sin(\arctan(cx)) \cos(\arctan(cx))\cr &= 2 \tan(\arctan(cx)) \cos^2(\arctan(cx))\cr & = \frac{2 \tan(\arctan(cx)}{1+\tan^2(\arctan(cx))}\cr &= \frac{2 c x}{1 + c^2 x^2}}