# How do you solve using gaussian elimination or gauss-jordan elimination, 2x-y+z=6, x+2y-z=1, 2x-y-z=0?

Dec 13, 2015

Set up an augmented matrix and row-reduce to find
$\left\{\begin{matrix}x = 2 \\ y = 1 \\ z = 3\end{matrix}\right.$

#### Explanation:

Using Gaussian Elimination on the given system, we start from

$\left\{\begin{matrix}2 x - y + z = 6 \\ x + 2 y - z = 1 \\ 2 x - y - z = 0\end{matrix}\right.$

and use the system to set up the augmented matrix

$\left(\begin{matrix}2 & - 1 & 1 & | & 6 \\ 1 & 2 & - 1 & | & 1 \\ 2 & - 1 & - 1 & | & 0\end{matrix}\right)$

Our goal is a matrix of the form

$\left(\begin{matrix}1 & 0 & 0 & | & x \\ 0 & 1 & 0 & | & y \\ 0 & 0 & 1 & | & z\end{matrix}\right)$

Note that from here, we may use only the following operations:

• multiply a row by a constant

• add a the product of a row and a constant to another row

• switch the positions of two rows

To obtain a $1$ in the first row, first column, we multiply the first row by $\frac{1}{2}$ and obtain

$\left(\begin{matrix}1 & - \frac{1}{2} & \frac{1}{2} & | & 3 \\ 1 & 2 & - 1 & | & 1 \\ 2 & - 1 & - 1 & | & 0\end{matrix}\right)$

To obtain $0$s for the remainder of the first column, we add $- 1$ times the first row to the second row, and $- 2$ times the first row to the third row.

$\left(\begin{matrix}1 & - \frac{1}{2} & \frac{1}{2} & | & 3 \\ 0 & \frac{5}{2} & - \frac{3}{2} & | & - 2 \\ 0 & 0 & - 2 & | & - 6\end{matrix}\right)$

We could solve for $z$ and use back-substitution at this point, but let's proceed with Gauss-Jordan elimination. The next step is to get a $1$ in the second row, second column. To do so, we multiply the second row by $\frac{2}{5}$.

$\left(\begin{matrix}1 & - \frac{1}{2} & \frac{1}{2} & | & 3 \\ 0 & 1 & - \frac{3}{5} & | & - \frac{4}{5} \\ 0 & 0 & - 2 & | & - 6\end{matrix}\right)$

Again, we want $0$s for every other member of the column. To get this, we add $\frac{1}{2}$ times the second row to the first row.

$\left(\begin{matrix}1 & 0 & \frac{1}{5} & | & \frac{13}{5} \\ 0 & 1 & - \frac{3}{5} & | & - \frac{4}{5} \\ 0 & 0 & - 2 & | & - 6\end{matrix}\right)$

As our next to last step, we want a $1$ in the third column, third row. To obtain this, we multiply the third row by $- \frac{1}{2}$.

$\left(\begin{matrix}1 & 0 & \frac{1}{5} & | & \frac{13}{5} \\ 0 & 1 & - \frac{3}{5} & | & - \frac{4}{5} \\ 0 & 0 & 1 & | & 3\end{matrix}\right)$

Finally, we eliminate the remaining nonzero elements of the third column by adding $- \frac{1}{5}$ times the third row to the first row, and $\frac{3}{5}$ times the third row to the second row.

$\left(\begin{matrix}1 & 0 & 0 & | & 2 \\ 0 & 1 & 0 & | & 1 \\ 0 & 0 & 1 & | & 3\end{matrix}\right)$

And so we have

$\left\{\begin{matrix}x = 2 \\ y = 1 \\ z = 3\end{matrix}\right.$