# Solving a 3 equation system using elimination

Solve the system using elimination:

X=? Y=? Z=?

I'm trying to solve this problem by putting the system into the form of an augmented matrix and using gaussian elimination but I can't find a way to do it without ending up with a bunch of fractions or hitting a dead end. Please help!

-
Nobody said Gaussian elimination sticks to nice round integers. – anon Feb 12 '12 at 2:46
Multiply row 1 by 5 and row 2 by 4. Add them... – David Mitra Feb 12 '12 at 2:48
@anon Well I tried eliminating the third row's 2x by adding 1/2*the first row to the third row. I ended up with the third row being {0 15/2 -7/2 | -16} then I multiplied it by itself to get {0 15 -7 | -32}. But now I am stuck. – Kyle V. Feb 12 '12 at 2:49
Multiply row 3 by 10 and row 1 by 3. Add. (or just deal with fractions :)) – David Mitra Feb 12 '12 at 3:33
@Stickfigs: Whichever you prefer: make one of them have $0$ in the first entry, then exchange rows if necessary so that the one with nonzero first entry is on top. – Arturo Magidin Feb 12 '12 at 4:12

Start with $$\tag{1} \left[\matrix{ \color{maroon}{-4}&5&5\cr \color{darkgreen}{5}&-2&-4\cr 2&5&-6\cr }\ \ \Biggl |\ \ \matrix{-20\cr -1\cr -6}\right]$$

The first phase is to eliminate (make 0) the first entries in rows two and three by adding multiples of row one to them.

But, to avoid fractions, you could also add a multiple of row one to a multiple of row two or three to effect this. Let's consider how to use this procedure to eliminate the $\color{darkgreen}{5}$ in row two: we need to multiply the $\color{maroon}{-4}$ in row 1 by something and the $\color{darkgreen}5$ in row two by something so that we we add these products, we obtain 0. What are the somethings?

A moment's reflection reveals that you may take the somethings to be $\color{darkgreen}5$ and $\color{maroon}4$. (There are other choices; but, multiplying each row by the coefficient of the leading entry of the other row and subtracting will always work, provided those coefficients are nonzero.)

So, to eliminate the 5 in row two, we may, and do, add five times row one to four times row two. To keep things simple, do not replace row one by five times itself.

In order to minimize the chance of making arithmetic errors, let's do the calculation on the side:

$5 \cdot\text{row}_1+4\cdot \text{row}_2$: \eqalign{ 5&({-}4\ \ \hphantom{ - }5 \ \ \hphantom{-}5\ \ {-}20)\cr +4&(\hphantom{-}5\ \ {-}2\ \ {-}4\ \ {-}1\hphantom{0})\cr & \ \ \cr &\ \ \phantom{(} }\qquad\Rightarrow \eqalign{ &({-}20\ \ \hphantom{ - }25 \ \ \hphantom{-}25\ \ {-}100)\cr + &(\hphantom{-}20\ \ {-}8\hphantom{3}\ \ {-}16\ \ {-}4\hphantom{0})\cr &\underline{\phantom{wwwwwwwwwwwwwww}}\cr &(\phantom{-} 0\phantom 5\ \ \hphantom{ - }17 \ \ \hphantom{-}9\ \ {-}104) }

So $(1)$ becomes:

$$\tag{2} \left[\matrix{ -4&5&5\cr 0&17&9\cr 2&5&-6\cr }\ \ \Biggl |\ \ \matrix{-20\cr -104\cr -6}\right]$$

Now we want to eliminate the 2 in row three. To do this we add row one to twice row three:

We have $\text{row}_1+2\cdot\text{row}_3$: \eqalign{ &({-}4\ \ \hphantom{ - }5 \ \ \hphantom{-}5\ \ {-}20)\cr +2&(\hphantom{-}2\ \ \phantom{-}5\ \ {-}6\ \ {-}6\hphantom{0})\cr & \ \ \cr &\ \ \phantom{(} }\qquad\Rightarrow \eqalign{ &({-}4\ \ \hphantom{ - }5\phantom{4} \ \ \hphantom{--}5\phantom{5}\ \ {-}20)\cr + &(\hphantom{-}4\ \ \phantom{-}10\hphantom{3}\ \ {-}12\ \ {-}12\hphantom{0})\cr &\underline{\phantom{wwwwwwwwwwwwwww}}\cr &(\phantom{-} 0\phantom 5\ \ 15 \ \ \ \ \ {-}7\ \ \ \ {-}32) }

So $(2)$ becomes:

$$\tag{3} \left[\matrix{ -4&5&5\cr 0&17&9\cr 0&15&-7\cr }\ \ \Biggl |\ \ \matrix{-20\cr -104\cr -32}\right]$$

Yuch; ugly, but let's deal with it. We want to eliminate the 15 in row three now. Here we also work with row two; do not use row one to eliminate the 15 in row three; if you do this the 0 in row three will become nonzero...

So, we take 15 times row two and subtract 17 times row three. We have:

$15\cdot\text{row}_2+17\cdot\text{row}_3$: \eqalign{ 15&(\phantom{-}0\ \ \hphantom{ - }17 \ \ \hphantom{-}9\ \ {-}104)\cr -17&(\hphantom{-}0\ \ \phantom{-}15\ \ {-}7\ \ {-}32\hphantom{0})\cr & \ \ \cr &\ \ \phantom{(} }\qquad\Rightarrow \eqalign{ &(\phantom{-}0\ \ \hphantom{ - }235\phantom{4} \ \ \ \hphantom{-}135\phantom{5}\ \ {-}1560)\cr + &(\hphantom{-}0\ \ {-}235\hphantom{3}\ \ \ \phantom{-}119\ \ \hphantom{-}544\hphantom{0})\cr &\underline{\phantom{wwwwwwwwwwwwwww}}\cr &(\phantom{-} 0\phantom 0\ \ 0\phantom{35}\ \ \ \ \ \ \ \ \ 254 \ \ \ \ \ -1016) }

So $(3)$ becomes: $$\tag{4} \left[\matrix{ -4&5&5\cr 0&17&9\cr 0&0&254\cr }\ \ \Biggl |\ \ \matrix{-20\cr -104\cr -1016}\right]$$

We may now solve by back substitution:

Solve for $z$ first.

From row three of $(4)$, $$z={-1016\over 254}=-4$$

Now solve for $y$.

From row two of $(4)$: \eqalign{ & 17y+9z =-104\cr\iff& 17y+9(-4)=-104\cr\iff& 17y=-104+36\cr\iff &17y=-68\cr\iff &y=-4}

Finally solve for $x$.

From row one of $(4)$: $$-4x+5y+5z=-20\iff-4x-20-20=-20\iff x=-5.$$

-

\begin{align} -4x + 5y + 5z &= -20 \\ 5x - 2y - 4z &= -1 \\ 2x + 5y - 6z &= -6 \end{align}

For this system we use the following matrix $$\left[\begin{array}{cccc} -4 & 5 & 5 & -20 \\ 5 & -2 & -4 & -1 \\ 2 & 5 & -6 & -6 \\ \end{array}\right]$$

First we want the first column to be $\left[\begin{array}{c} 1 \\ 0 \\ 0 \\ \end{array}\right]$. We can do this by multiply the first row by $-1/4$, then subtracting $5$ of the resulting row to the second row and subtracting 2 of the same row from the third row. This gives us

$$\left[\begin{array}{cccc} 1 & -5/4 & -5/4 & 5 \\ 0 & 17/4 & 9/4 & -26 \\ 0 & 30/4 & -14/4 & -16 \\ \end{array}\right]$$

We know want to do something similar with column 2. Except now we want $\left[\begin{array}{c} 0 \\ 1 \\ 0 \\ \end{array}\right]$. Notice that adding the second or third row to the first will not alter the first column. Now we want to divide the second row by $17/4$. Then add $5/4$ths of the resultant row to the first row and $-30/4$ of the same row to the third row.

$$\left[\begin{array}{cccc} 1 & 0 & -10/17 & -45/17 \\ 0 & 1 & 9/17 & -104/17 \\ 0 & 0 & -127/17 & 508/17 \\ \end{array}\right]$$

Now for the final row we want $\left[\begin{array}{c} 0 \\ 0 \\ 1 \\ \end{array}\right]$. We get this by dividing the row by $-127/17$, then subtracting $9/17$ of this row to the second row, and adding $10/17$ of the same row to the first row. $$\left[\begin{array}{cccc} 1 & 0 & 0 & -5 \\ 0 & 1 & 0 & -4 \\ 0 & 0 & 1 & -4 \\ \end{array}\right]$$

Now we have the system \begin{align} x &= -5 \\ y &= -4 \\ z &= -4 \end{align}

Obviously it is easy to get lost in these calculations. I would usually have scratch work all over the side. I think the main idea here is that we can view a system as a matrix and that row operations do not alter the solution space. It is also worth noting how this idea can pretty easily be implemented as a computer program.

-