# 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?

-
I think they substituted $y$ from the second equation into the third equation. –  Rene Schipperus May 27 '14 at 0:32

I will use the convention $pR_i+R_j$ to mean that you multiply row $i$ by $p$ and then add it to the row $j$.

Assuming that your coefficient matrix is $A$ and the right side vector is $b$. You do the following row operations

$$[A|b] \rightarrow(-2R_1+R_2) \rightarrow(-1R_1+R_3) \rightarrow(\text{swap} R_2 \text{with} R_3) \rightarrow(-(a-2)R_2+R_3).$$

This should lead you to the correct matrix.

-
I'm afraid I'm not familiar with the matrix notation, I'm still a freshman in HS and matrices is not something we learn this year. –  John Smith May 27 '14 at 0:47
In that case consider each row as an equation and then do the procedure as outlined above. For example $-2R_1+R_2$ should mean multiply equation 1 by -2 and add it to equation 2 and so on.... –  Anurag A May 27 '14 at 0:50

$\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]$
$\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