With a bit of assistance,DSolve
can obtain a simpler general answer. Begin by changing dependent variables.
eq = 2*y[x]*y''[x] - y'[x]^2 - y[x]^2
eq2 = eq /. y'[x] -> p[y] /. y''[x] -> p[y]*p'[y] /. y[x] -> y
sol = DSolve[eq2 == 0, p[y], y]
(*{{p[y] -> -Sqrt[y] Sqrt[y + C[1]]}, {p[y] -> Sqrt[y] Sqrt[y + C[1]]}}*)
Boundary conditions are: y[0] == 1, y'[0] == -1
.
Now we find C[1]
constant:
sol1 = Solve[-1 == (p[y] /. sol[[1]]) /. y -> 1, C[1]]
(*{{C[1] -> 0}}*)
sol2 = Solve[-1 == (p[y] /. sol[[2]]) /. y -> 1, C[1]]
(*{no solutions}*)
General Solution of this equation is:
SolE = First@DSolve[y'[x] - ((p[y] /. sol[[1]]) /. y -> y[x]) == 0, y[x], x]
(*{y[x] -> 1/4 E^(-x - C[2]) (E^C[2] - E^x C[1])^2}*)
$$\left\{y(x)\to \frac{1}{4} e^{-c_2-x} \left(e^{c_2}-c_1 e^x\right){}^2\right\}$$
The above solution is correct, as can be verified easily:
Z = (y[x] /. SolE)
FullSimplify[2*Z*D[Z, x, x] - D[Z, x]^2 - Z^2 == 0]
(*True*)
Now we find C[2]
constant:
sol4 = First@Solve[1 == (y[x] /. SolE /. C[1] -> 0) /. x -> 0, C[2], Reals]
(*{C[2] -> 2 Log[2]}*)
Special solution of this equation is:
Y[x] == (y[x] /. SolE) /. C[1] -> 0 /. C[2] -> C[2] /. sol4
(*Y[x] == E^(-x)*)
$$y(x)=e^{-x}$$
Mathematica
to solve the differential equation in a right way to get the result? $\endgroup$