# Jamal's Q via email solving a system

#### Prove It

##### Well-known member
MHB Math Helper
We can write the system in an augmented matrix as \displaystyle \begin{align*} A = \left[ \begin{matrix} 2 & -2 & -1 & \phantom{-}0 & \phantom{-}6 \\ 2 & \phantom{-}3 & \phantom{-}2 & -5 &-14 \\ 0 & \phantom{-}5 & \phantom{-}2 & \phantom{-}2 &\phantom{-}1 \\ 0 & \phantom{-}0 & \phantom{-}2 & -3 & -9 \end{matrix} \right] \end{align*}. If we apply Gaussian Elimination with Partial Pivoting, when the system is upper-triangularised, the right hand column becomes the elements of matrix \displaystyle \begin{align*} \mathbf{g} \end{align*}.

First we will apply R2 - R1 to R1 (no pivoting needed as the elements in the first column have the same magnitude)

\displaystyle \begin{align*} \left[ \begin{matrix} 2 & -2 & -1 & \phantom{-}0 &\phantom{-}6 \\ 0 & \phantom{-}5 & \phantom{-}3 & -5 &-20 \\ 0 & \phantom{-}5 & \phantom{-}2 & \phantom{-}2 &\phantom{-}1 \\ 0 &\phantom{-}0 & \phantom{-}2 & -3 &-9 \end{matrix} \right] \end{align*}

Again pivoting is not needed as the elements on or below the main diagonal in column 2 are the same magnitude, so we will apply R3 - R2 to R2 giving

\displaystyle \begin{align*} \left[ \begin{matrix} 2 & -2 & -1 & \phantom{-}0 &\phantom{-}6 \\ 0 & \phantom{-}5 & \phantom{-}3 & -5 &-20 \\ 0 & \phantom{-}0 & -1 & \phantom{-}7 &\phantom{-}21 \\ 0 &\phantom{-}0 & \phantom{-}2 & -3 &-9 \end{matrix} \right] \end{align*}

If we look in column 3, we see that the element on or below the main diagonal with the highest magnitude is in Row 4, so we must switch rows 3 and 4, giving

\displaystyle \begin{align*} \left[ \begin{matrix} 2 & -2 & -1 & \phantom{-}0 &\phantom{-}6 \\ 0 & \phantom{-}5 & \phantom{-}3 & -5 &-20 \\ 0 &\phantom{-}0 & \phantom{-}2 & -3 &-9\\ 0 & \phantom{-}0 & -1 & \phantom{-}7 &\phantom{-}21 \end{matrix} \right] \end{align*}

and finally when we apply R4 + (1/2)R3 to R4 we get

\displaystyle \begin{align*} \left[ \begin{matrix} 2 & -2 & -1 & \phantom{-}0 &\phantom{-}6 \\ 0 & \phantom{-}5 & \phantom{-}3 & -5 &-20 \\ 0 &\phantom{-}0 & \phantom{-}2 & -3 &-9\\ 0 & \phantom{-}0 & \phantom{-}0 & \phantom{-}\frac{11}{2} & \phantom{-}\frac{33}{2} \end{matrix} \right] \end{align*}

So we can read off that \displaystyle \begin{align*} \mathbf{g} = \left[ \begin{matrix} \phantom{-}6 \\ -20 \\ -9 \\ \phantom{-}\frac{33}{2} \end{matrix} \right] \end{align*} and we can solve for \displaystyle \begin{align*} \mathbf{x} \end{align*} in the system through back substitution:

\displaystyle \begin{align*} \frac{11}{2} \, x_4 &= \frac{33}{2} \\ x_4 &= 3 \\ \\ 2\,x_3 - 3\,x_4 &= -9 \\ 2\,x_3 - 9 &= -9 \\ 2\,x_3 &= 0 \\ x_3 &= 0 \\ \\ 5\,x_2 + 3\,x_3 - 5\,x_4 &= -20 \\ 5\,x_2 + 0 - 15 &= -20 \\ 5\,x_2 &= -5 \\ x_2 &= -1 \\ \\ 2\,x_1 - 2\,x_2 - x_3 &= 6 \\ 2\,x_1 + 2 - 0 &= 6 \\ 2\,x_1 &= 4 \\ x_1 &= 2 \end{align*}

Thus the solution to the system is \displaystyle \begin{align*} \mathbf{x} = \left[ \begin{matrix} \phantom{-}2 \\ -1 \\ \phantom{-}0 \\ \phantom{-}3 \end{matrix} \right] \end{align*}.