# Solve the following equation system using Gaussian Elimination.

Solve the following equation system using Gaussian Elimination.

$x_1+2x_2-x_3-x_4+x_5=0$

$x_1+2x_2-2x_4+4x_5=0$

$2x_1+4x_2-2x_3-2x_4+2x_5=0$

$-2x_1-4x_2+4x_3+4x_5=0$

My working so far

Putting the equation system into a coefficient matrix:

$$\left[ \begin{array}{ccccc|c} 1&2&-1&-1&1&0\\ 1&2&0&-2&4&0\\ 2&4&-2&-2&2&0\\ -2&-4&4&0&4&0 \end{array} \right]$$

Using Gaussian Elimination, the matrix reduces to:

$$\left[ \begin{array}{ccccc|c} 1&2&-1&-1&1&0\\ 0&0&1&-1&3&0\\ 0&0&0&0&0&0\\ 0&0&0&0&0&0 \end{array} \right]$$

So the equation system is:

$x_1+2x_2-x_3-x_4+x_5=0$

$x_3-x_4+3x_5=0$

This is the point I am up to. I have $2$ equations in $5$ variables, so I will need free variables/parameters. But what do I need to do to get these and have a general solution?

Note in all combinations the last column will stay zero so we will just drop it. $$\begin{pmatrix} 1 & 2 & -1 & -1 & 1 \\ 1 & 2 & 0 & -2 & 4 \\ 2 & 4 & -2 & -2 & 2 \\ -2 & -4 & 4 & 0 & 4 \\ \end{pmatrix} \to \begin{pmatrix} 1 & 2 & -1 & -1 & 1 \\ 0 & 0 & 1 & -1 & 3 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & -1 & 3 \\ \end{pmatrix} \to \begin{pmatrix} 1 & 2 & 0 & -2 & 4 \\ 0 & 0 & 1 & -1 & 3 \\ 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix}$$ Which indeed leaves $x_1+2x_2-2x_4+4x_5=0$ and $x_3 - x_4 + 3x_5=0$. Write $x_1,x_3$ in terms of others, to get $x_1 = -2x_2+2x_4-4x_5$ and $x_3 = x_4 - 3x_5$. Now the general solution is $$\begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \end{pmatrix} = \begin{pmatrix} -2x_2+2x_4-4x_5 \\ x_2 \\ x_4 - 3x_5 \\ x_4 \\ x_5 \end{pmatrix} = \begin{pmatrix} -2 & 2 & -4\\ 1 & 0 & 0\\ 0 & 1 & -3\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{pmatrix} \begin{pmatrix}x_2 \\ x_4 \\ x_5 \end{pmatrix}$$ where $x_2, x_4, x_5$ can take on any real values. In other words any linear combination of the columns of this matrix will be a solution, and no other vector: $$\begin{pmatrix} -2 & 2 & -4\\ 1 & 0 & 0\\ 0 & 1 & -3\\ 0 & 1 & 0\\ 0 & 0 & 1 \end{pmatrix}$$