How do I do Gaussian elimination on this system of equations?
$$ \begin{cases} x_1+x_2+x_3=0\\ x_1+2x_2+ax_3=1\\ x_1+ax_2+2x_3=-1 \end{cases} $$
When I try to do this I end up with a coefficient with an $a^2$ term which I'm assuming is not supposed to be there.
Write down the augmented coefficients matrix...and reduce:
$$\begin{pmatrix}1&1&1&0\\ 1&2&a&1\\ 1&a&2&\!-1\end{pmatrix}\longrightarrow\begin{pmatrix}1&1&1&0\\ 0&1&a-1&1\\ 0&a-1&1&\!-1\end{pmatrix}\longrightarrow$$$${}$$
$$\longrightarrow\begin{pmatrix}1&1&1&0\\ 0&1&a-1&1\\ 0&0&1-(a-1)^2&\!-1-(a-1)\end{pmatrix}$$
Now, observe that
$$1-(a-1)^2=0\iff a-1=\pm1\iff a=0,\,2$$
but
$$-1-(a-1)=0\iff (a-1)=-1\iff a=0\ldots$$
Thus, if $\;a=0\;$ the whole third rows gets cancelled and we get in fact a $\;2\times3\;$ system, whereas if $\;a=2\;$ we get a contradiction row and the system has no solution. Thus, for $\;a\neq0,\,2\;$ say, row 3 tells us
$$\left(1-(a-1)^2\right)x_3=-1-(a-1)\stackrel{a\neq0,2}\implies x_3=\frac{a^2-2a}{a}=a-2 \quad \ldots \, \text{and etc.}$$