Solve following ODE: $$ (1-x)x''+2(x')^2=0; x(0)=2, x'(0)=-1 $$
$$ x''=\frac{-2(x')^2}{1-x} $$ substitute $x'=u(x)$ and assume $u \neq 0$ $$ uu'=\frac{-2(u)^2}{1-x} \\ \frac{dx}{1-x}=-\frac{du}{2u} \\ -\ln{|1-x|}=-\frac{1}{2}\ln{|u|}+c \\ |1-x|=\sqrt(|u|)e^c $$ undo substitution $x'=u(x)$ and use $x(0)=2, x'(0)=-1$: $$ |1-2|=\sqrt(|-1|)e^c \\ 1 = e^c \\ c = 0 $$ so $$ |1-x|=\sqrt{|x'|}\\ x' = (1-x)^2 \\ \frac{dx}{dt}=(1-x)^2 \\ dt = \frac{dx}{(1-x)^2} \\ t + c = \frac{1}{1-x} $$ use $x(0)=2$ $$ 0 + c = \frac{1}{1-2} \\ c = -1 $$ finally: $$ t - 1 = \frac{1}{1-x} \\ \frac{1}{t-1} = 1 - x \\ x = 1 - \frac{1}{t-1} \\ x(t) = \frac{t-2}{t-1} $$
Wolfram Alpha however, says the ODE is $x(t)=\frac{t+2}{t+1}$. Where is my mistake?
The first stage of the solution should be kept with an undetermined constant up to the point $$ u(x)=C(x-1)^2. $$ Then using $u(2)=-1$ gives $C=-1$ and thus $$ x'(t)=-(x-1)^2, $$ which has a different sign than the equation you got. The sign difference in the solution follows from here.