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

Feb 16, 2018

$x = 1 , y = - 1 , z = 1$

#### Explanation:

To solve the matrix equation $A x = b$ we start by writing the augmented matrix $\left(A | b\right)$ :
$\left(\begin{matrix}1 & - 2 & - 1 & 2 \\ 2 & - 1 & 1 & 4 \\ - 1 & 1 & - 2 & - 4\end{matrix}\right)$
usually we would put a vertical line to separate the fourth column (the column vector $b$) from the first three (which represent $A$, but couldn't figure out how to do it!

The aim in Gauss elimination is to carry out row operations on the augmented matrix until $A$ is converted to reduced row-echelon form. To do this we first subtract twice the first row from the second (denote this by ${R}_{2} - 2 {R}_{1}$ ) and ${R}_{3} + {R}_{1}$

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

Divide the second row by 3 $\left({R}_{2} / 3\right)$ :

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

${R}_{3} + {R}_{2}$

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

$\left({R}_{3} / \left\{- 2\right\}\right)$

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

This completes the Gauss-elimination process. We can now carry out back-substitution to determine the required solution:

$z = 1$

$y + z = 0 \implies y = - 1$

$x - 2 y - z = 2 \implies x = 2 y + z + 2 = 2 \times \left(- 1\right) + 1 + 2 = 1$

So, the solution is $x = 1 , y = - 1 , z = 1$

To carry out Gauss Jordan elimination, the steps are the same until we reach

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

${R}_{1} + 2 {R}_{2} , {R}_{3} + {R}_{2}$

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

$\left({R}_{3} / \left\{- 2\right\}\right)$

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

${R}_{1} - {R}_{3} , {R}_{2} - {R}_{3}$

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

from this we can immediately read off $x = 1 , y = - 1 , z = 1$