Solving $y''=(y')^2$ by reduction to first-order. Let $z=\dfrac{dy}{dx}$, then $y''=\dfrac{dz}{dy}\dfrac{dy}{dx}=z'z.$ Thus, 
\begin{align} y''=(y')^2&\iff z'z=z^2\\&\iff z'=z
                        \\&\iff\dfrac{dz}{dx}=z
\\&\iff\dfrac{1}{z}dz=dx \\&\implies\int \dfrac{1}{z}dz=\int dx \\&\implies \ln z=x+c \\&\implies z=A\,e^{x}\\&\iff \dfrac{dy}{dx}=A\,e^{x}\\&\iff \int dy=\int A\,e^{x} dx \\&\iff y=A\,e^{x}+B\end{align}
However, my solution is not satisfying the original equation. Where have I gone wrong? Can anyone fix my wrong? Thanks for your time!
 A: Your problem is that you do not identify the correct independent variables in the functions you use. 
At the basis of this method is a switch from using $x$ to using $y$ as independent variable (provided that the solution under consideration is not constant, at least locally). If you write the long form, you would directly see this, the substitution you use is $y'=z(y)$, or even more explicit, 
$$y'(x)=z(y(x)).$$ 
Then the application of the chain rule for the next derivative $$y''(x)=z'(y(x))y'(x)=z'(y(x))z(y(x))$$ or short $y''=z'z$ is correct, note that here $z'=z'(y)=\frac{dz}{dy}$. The following steps are correct with the changed independent variable up to
$$z(y)=Ae^{y}.$$
So now you have to solve
$$
y'=\frac{dy}{dx}=Ae^y\implies -e^{-y}=Ax+B.
$$
A: You should rather use $z =y'$ then solve $z'=z^2$ and then use $z$ to solve $y'=z$.
From $z'=z^2$ we obtain $dz/z^2=dx\implies \dfrac{1}{z_0}-\dfrac{1}{z}=x-x_0\implies z = \dfrac{1}{z_0^{-1}-x+x_0}$.
Now solve 
$$y' = \dfrac{1}{z_0^{-1}-x+x_0}\implies y(x) = y_0 +\int_{x_0}^{x}\dfrac{1}{z_0^{-1}-\bar{x}+x_0}d\bar{x},$$
in which $y_0=y(x_0)$ and $z_0=y'(x_0)$.
A: If $z=y'$ then the equation becomes $z'=z^{2}$ or $(-1/z)'=1$. So is $z =-\frac 1 {x+c}$ and $y=c'-\ln|x+c|$. 
