the squre is not in the right place, and it should be like this:
wrong:
$$
\begin{align}-\frac{(z-x)^2}{2\sigma^2_{GPS}}-\frac{(x-x_{init})^2}{18\sigma^2_{GPS}}
&= -\frac{9(z-x)^2+(x-x_{init})^2}{18\sigma^2_{GPS}} \\
&= -\frac{9(z^2-2zx+x^2)+(x^2-2xx_{init}+x_{init}^2)}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}+10x^2-2xx_{init}-18zx}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}+10x^2-2(x_{init}+9z)x}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}+10(x^2-2x\frac{x_{init}+9z}{10}+(\frac{x_{init}+9z}{10})^2)}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}}{18\sigma^2_{GPS}}
-\frac{(x^2-2x\frac{x_{init}+9z}{10}+(\frac{x_{init}+9z}{10})^2)}{18/10\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}}{18\sigma^2_{GPS}}
-\frac{x-\frac{(x_{init}+9z)^2}{10}}{9/5\sigma^2_{GPS}} \\
\end{align}
$$
right:
$$
\begin{align}-\frac{(z-x)^2}{2\sigma^2_{GPS}}-\frac{(x-x_{init})^2}{18\sigma^2_{GPS}}
&= -\frac{9(z-x)^2+(x-x_{init})^2}{18\sigma^2_{GPS}} \\
&= -\frac{9(z^2-2zx+x^2)+(x^2-2xx_{init}+x_{init}^2)}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}+10x^2-2xx_{init}-18zx}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}+10x^2-2(x_{init}+9z)x}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}+10(x^2-2x\frac{x_{init}+9z}{10}+(\frac{x_{init}+9z}{10})^2)}{18\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}}{18\sigma^2_{GPS}}
-\frac{(x^2-2x\frac{x_{init}+9z}{10}+(\frac{x_{init}+9z}{10})^2)}{18/10\sigma^2_{GPS}} \\
&= -\frac{{9z^2+x_{init}^2}-\frac{(x_{init}+9z)^2}{10}}{18\sigma^2_{GPS}}
-\frac{(x-\frac{x_{init}+9z}{10})^2}{9/5\sigma^2_{GPS}} \\
\end{align}
$$