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

Apr 16, 2017

$\left(x , y , z\right) = \left(2 , \frac{1}{2} , - 2\right)$

Try setting up a matrix:

$\left[\begin{matrix}3 & - 2 & - 1 & | & 7 \\ 1 & 2 & - 1 & | & 5 \\ - 1 & 4 & 2 & | & - 4\end{matrix}\right]$

Do note that your second equation has $z$ on the wrong side compared to the other equations in the system, so you must add $\left(5 - z\right)$ to both sides of the second equation before you form this matrix.

To row-reduce this using gaussian elimination, simply row-reduce this using elementary row operations, i.e. any of the following in any combination:

• Scale a row, i.e. $c {R}_{i}$, where $c$ is a constant.
• Add row $i$ onto row $j$ and store in row $j$, i.e. ${R}_{i} + {R}_{j}$

Hence, if I write $c {R}_{i} + {R}_{j}$, it means $c {R}_{i}$ is added to each entry in row ${R}_{j}$ and the result is stored into row $j$.

Our process in general will be to get the matrix down to a solvable form. Gauss-Jordan elimination would have gotten it down to reduced-row-echelon form, though that is not necessary to solve this system.

$\stackrel{{R}_{2} + {R}_{3} \text{ }}{\to} \left[\begin{matrix}3 & - 2 & - 1 & | & 7 \\ 1 & 2 & - 1 & | & 5 \\ 0 & 6 & 1 & | & 1\end{matrix}\right]$

$\stackrel{- \frac{1}{3} {R}_{1} + {R}_{2} \text{ }}{\to} \left[\begin{matrix}3 & - 2 & - 1 & | & 7 \\ 0 & \frac{8}{3} & - \frac{2}{3} & | & \frac{8}{3} \\ 0 & 6 & 1 & | & 1\end{matrix}\right]$

$\stackrel{\frac{3}{2} {R}_{2} \text{ }}{\to} \left[\begin{matrix}3 & - 2 & - 1 & | & 7 \\ 0 & 4 & - 1 & | & 4 \\ 0 & 6 & 1 & | & 1\end{matrix}\right]$

stackrel(R_3 + R_2; 1/5R_2" ")(->)[(3,-2,-1,|,7),(0,2,0,|,1),(0,6,1,|,1)]

Good enough; we can solve backwards now. The current system of equations looks like:

$3 x - 2 y - z = 7$
$0 x + 2 y + 0 = 1$
$0 x + 6 y + 1 = 1$

Thus, from the second equation we have:

$2 y = 1 \implies \textcolor{g r e e n}{y = \frac{1}{2}}$

$6 y + z = 1$

$\implies 6 \left(\frac{1}{2}\right) + z = 1 \implies \textcolor{g r e e n}{z = - 2}$

$3 x - 2 y - z = 7$

$\implies 3 x - 2 \left(\frac{1}{2}\right) - \left(- 2\right) = 7$

$\implies 3 x = 6 \implies \textcolor{g r e e n}{x = 2}$

Hence, we got $\textcolor{b l u e}{\left(x , y , z\right) = \left(2 , \frac{1}{2} , - 2\right)}$.

Let's check...

$3 x - 2 y - z$

= 3(2) - 2(1/2) - (-2) = 6 - 1 + 2 = 7 color(blue)(sqrt"")

$x + 2 y - 5$

= 2 + 2(1/2) - 5 = 2 + 1 - 5 = -2 color(blue)(sqrt"")

$- x + 4 y + 2 z$

= -(2) + 4(1/2) + 2(-2) = -2 + 2 - 4 = -4 color(blue)(sqrt"")