How to solve this equation with three variables with an unknown parameter using Gaussian elimination? If I've got three equations:
$$\begin{array}{ccccccc} x & + & y & + & z & = 3 \\  2x & + & ay & - & 2z & = 4 \\ x & + & 2y & - & az & = 1 \end{array}$$
How do I solve them using Gaussian elimination. I get to this point:
$$\begin{array}{ccccccc} x & + & y & + & z & = 3 \\   & & y & - & (a+1)z & = -2 \\  &  & (a-2)y & - & 4z & = -2 \end{array}$$
but I don't know where to go from here. I'd try to multiply the second  by $-(a-2)$ and add it to the third but it doesn't seem to work out well. My textbook says that the next step should look like:
$$\begin{array}{ccccccc} x & + & y & + & z & = 3 \\   & & y & - & (a+1)z & = -2 \\  &  &  &  & (a+2)(a-3)z & = 2(a-3) \end{array}$$
How do I get to that?

This will get you to the step you asked about:
$\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
2 & a & -2 & 4\\
1 & 2 & -a & 1\end{array}\right]\Longrightarrow 
\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
0 & a-2 & -4 & -2\\
0 & 1 & -a-1 & -2\end{array}\right]\Longrightarrow 
\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
0 & 0 & -4+(a+1)(a-2) & -2+2(a-2)\\
0 & 1 & -a-1 & -2\end{array}\right]\Longrightarrow 
\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
0 & 0 & a^2-a-6 & 2a-6\\
0 & 1 & -a-1 & -2\end{array}\right]\Longrightarrow 
\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
0 & 1 & -a-1 & -2\\
0 & 0 & a^2-a-6 & 2a-6\end{array}\right]\Longrightarrow 
\left[\begin{array}{ccc|c}
1 & 1 & 1 & 3\\
0 & 1 & -(a+1) & -2\\
0 & 0 & (a-3)(a+2) & 2(a-3)\end{array}\right]$
Then to finish the problem:
$\left[\begin{array}{ccc|c}
1 & 0 & a+2 & 5\\
0 & 1 & -(a+1) & -2\\
0 & 0 & (a+2) & 2\end{array}\right]\Longrightarrow \left[\begin{array}{ccc|c}
1 & 0 & 0 & 3\\
0 & 1 & 1 & 0\\
0 & 0 & (a+2) & 2\end{array}\right] \Longrightarrow \left[\begin{array}{ccc|c}
1 & 0 & 0 & 3\\
0 & 1 & 1 & 0\\
0 & 0 & 1 & \frac{2}{a+2}\end{array}\right] $
$\Longrightarrow \left[\begin{array}{ccc|c}
1 & 0 & 0 & 3\\
0 & 1 & 0 & \frac{-2}{a+2}\\
0 & 0 & 1 & \frac{2}{a+2}\end{array}\right] \Longrightarrow x=3 ~\&~ y=-z$
and if $a=-2$ there is no solution
