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

Jun 14, 2016

Perform elementary row operations to obtain an upper triangular matrix , and use this result to solve the equation. $\left(x , y , z\right) = \left(1 , - 1 , 1\right)$

#### Explanation:

First, we place the equation into matrix form, Ax=b:

$x - 2 y - z = 2$
$2 x - y + z = 4$
$- x + y - 2 z = - 4$

Becomes:

$A = \left(\begin{matrix}1 & - 2 & - 1 \\ 2 & - 1 & 1 \\ - 1 & 1 & - 2\end{matrix}\right)$
$x = \left(\begin{matrix}{x}_{1} \\ {x}_{2} \\ {x}_{3}\end{matrix}\right) = \left(\begin{matrix}x \\ y \\ z\end{matrix}\right)$
$b = \left(\begin{matrix}2 \\ 4 \\ - 4\end{matrix}\right)$

Giving us:

$\left(\begin{matrix}1 & - 2 & - 1 \\ 2 & - 1 & 1 \\ - 1 & 1 & - 2\end{matrix}\right) \left(\begin{matrix}{x}_{1} \\ {x}_{2} \\ {x}_{3}\end{matrix}\right) = \left(\begin{matrix}2 \\ 4 \\ - 4\end{matrix}\right)$

From here, we will use elementary row operations to solve this. Our altered matrix, A', should be an upper triangular matrix; that is, one where the only non-zero entries are along the main diagonal (upper left corner to lower right) and above. Thus, there will be no non-zero entries below (or to the left) of the main diagonal.

Let us define ${R}_{1} = \left(1 , - 2 , - 1\right) , {R}_{2} = \left(2 , - 1 , 1\right) , {R}_{3} = \left(- 1 , 1 , - 2\right)$ and our b values of ${b}_{1} = 2 , {b}_{2} = 4 , {b}_{3} = - 4$

First, we will change entries ${a}_{21}$ and ${a}_{31}$ to 0 via these operations. Note that these operations will also transform the corresponding b values; essentially at this point, we are adding and subtracting equations to/from one another, which by necessity will include adding and subtracting the answers of the original equations. We will begin by subtracting twice row 1 from row 2 (to reduce the first entry in row 2 to 0), and then we will add row 1 to row 3 (reducing the first entry in row 3 to 0). These new rows will be labelled as $R {'}_{2}$ and $R {'}_{3}$

$R {'}_{2} = {R}_{2} - 2 {R}_{1} = \left(2 - 2 , - 1 + 4 , 1 + 2\right) = \left(0 , 3 , 3\right)$ and $b {'}_{2} = {b}_{2} - 2 {b}_{1} = 4 - 4 = 0$

And
$R {'}_{3} = {R}_{3} + {R}_{1} = \left(- 1 + 1 , 1 - 2 , - 2 - 1\right) = \left(0 , - 1 , - 3\right)$ and b'_3 = b_3 + b_1 = -4 + 2 = -2

At this point in our operations we should have:

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

Next, we wish to reduce entry $a {'}_{32}$ to 0. We will do this by adding one third of $R {'}_{2}$ to $R {'}_{3}$, making sure to also make the appropriate change to $b {'}_{3}$

$R ' {'}_{3} = R {'}_{3} + \frac{1}{3} R {'}_{2} = \left(0 + 0 , - 1 + 1 , - 3 + 1\right) = \left(0 , 0 , - 2\right)$ and b"_3 = b'_3+ 1/3 b'_2 = -2 + 0 = -2#

This yields our upper triangular matrix as:

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

From here, we note that row 3 multiplies out to $0 {x}_{1} + 0 {x}_{2} - 2 {x}_{3} = - 2 \implies - 2 {x}_{3} = - 2 \implies {x}_{3} = 1$

We may then multiply out row 2 (i.e. multiplying the row by our x column vector to get the appropriate result from our b vector) and recall that ${x}_{3} = 1$ to obtain:

$3 {x}_{2} + 3 {x}_{3} = 0 = 3 {x}_{2} + 3 \implies 3 {x}_{2} = - 3 \implies {x}_{2} = - 1$

Performing a similar trick with our first row we get:

${x}_{1} - 2 {x}_{2} - {x}_{3} = {x}_{1} + 2 - 1 = {x}_{1} + 1 = 2 \implies {x}_{1} = 1$

Since ${x}_{1} , {x}_{2} , {x}_{3}$ are x, y, z respectively, we get x = 1, y = -1, z = 1