Solution of a homogenous differential equation with constant coefficients. I was reading this Wikipedia article. I tried to adopt the same method that they used to solve the following diffrential equation:
$$y\frac {d^2(y)}{dx^2}+{(\frac {dy}{dx})}^2+y^2=0$$
Putting $y=e^{rx}$ and then taking out $e^{2rx}$ outside with $2r^2+1$ inside. Solving for $r$ we get $y=e^{\frac{ix}{\sqrt 2}}$ or $y=e^{-\frac{ix}{\sqrt 2}}$ and when we combine both results as one and apply euler form of complex number we get $$y=a\cos {\frac{x}{\sqrt 2}} + b\sin {\frac{x}{\sqrt 2}}$$ but when I used Wolfram Alpha (computational software)  to verify my solution by plugging in the solution into the diffrential equation I don't get $0$ but $1$. 
I am not able to identify what I did wrong. It would be very nice if you could help me with identifying my mistake. Thanks a lot.
 A: Your equation is not linear...
$$y\frac {d^2(y)}{dx^2}+{(\frac {dy}{dx})}^2+y^2=0$$
$$\color {red} {y''y+(y')^2}+y^2=0$$
$$ \color {red}{(y'y)'}+y^2=0$$
$$ (2y'y)'+2y^2=0$$
$$((y^2))''+2y^2=0$$
Substitute $u=y^2$
$$u''+2u=0$$
This is linear....
$$r^2+2=0 \implies r=\pm i\sqrt 2$$
$$\implies u=c_1\cos(\sqrt 2 x)+c_2 \sin ( \sqrt 2 x)$$
$$\boxed {y^2(x)=c_1\cos(\sqrt 2 x)+c_2 \sin ( \sqrt 2 x)}$$

Another method is
$$y'=\frac {dy}{dx}=p $$
And
$$y''=\frac {dp}{dx}=\frac {dp}{dy}\frac {dy}{dx}=pp'_y$$
The equation becomes
$$pp'y+p^2+y^2=0$$
Note that $(p^2)'=2pp'$
$$\frac 12 (p^2)'y+(p^2)+y^2=0$$
Substitute $u=p^2$
$$  u'+2\frac uy=-2y$$
Its linear of first order...
A: Let $$v(y)=\frac{dy(x)}{dx}$$
then $$2\frac{dv(y)}{dy}v(y)+\frac{2v(y)^2}{y}=-2y$$
Now let
$$u(y)=v(y)^2$$
then
$$\frac{du(y)}{dy}+\frac{u(y)}{y}=-2y$$
Can you proceed?
A: If you look sharp enough, the first two terms have the form of a product derivative. Indeed $(yy')'=yy''+(y')^2$. This in turn is the derivative of the square, so that in the end the ODE is equivalent to
$$
(y^2)''+2(y^2)=0
$$
which is an oscillation equation for $u=y^2$ with solutions $$y^2=u=A\sin(\sqrt2 x+\phi).$$ As these sinoids also take negative values, the solution for $y$ has some sudden stops.
Or in initial conditions:
$$
y(x)^2=y(0)^2\cos(\sqrt2 x)+\sqrt2y(0)y'(0)\sin(\sqrt2 x)
$$
so that the square root with the correct sign is
$$
y(x)=y(0)\sqrt{\cos(\sqrt2 x)+\sqrt2\frac{y'(0)}{y(0)}\sin(\sqrt2 x)}.
$$
