# 1  Gauss Elimination Method for Systems of Linear Equations

Definition 1.1. Two systems of linear equations are said to be equivalent if they have the same set of solutions.

Given a system of linear equations

 $\begin{array}{ccccccccc}{a}_{1,1}{x}_{1}& +& {a}_{1,2}{x}_{2}& +& \dots & +& {a}_{1,n}{x}_{n}& =& {b}_{1}\\ {a}_{2,1}{x}_{1}& +& {a}_{2,2}{x}_{2}& +& \dots & +& {a}_{2,n}{x}_{n}& =& {b}_{2}\\ ⋮& & & & & & & & ⋮\\ {a}_{m,1}{x}_{1}& +& {a}_{m,2}{x}_{2}& +& \dots & +& {a}_{m,n}{x}_{n}& =& {b}_{m}\end{array}$ (1.1)

We show how to obtain an equivalent system of linear equations to (1.1) which is easier to solve. One of the simpliest procedures is an elimination technique known as Gauss Elimination Method. Here we give the version for systems of linear equations (a similar method exists for matrices).

Algorithm 1.2.  Gauss Elimination Method for systems of linear equations.

Step 1. If necessary interchange the equations so that the first equation has the variable ${x}_{1}.$ (The best situation is if every coefficient ${a}_{i,1}$ is a multiple of ${a}_{1,1}\phantom{\rule{mediummathspace}{0.2em}}$for all $i\ne 1$.)

Step 2. By adding appropriate multiples of the first equation to the every other equation eliminate the variable ${x}_{1}\phantom{\rule{mediummathspace}{0.2em}}$from all equations except the first one.

Step 3. Multiply, if suitable, an equation by a nonzero number.

Step 4. Ignoring the first equation, view the remaining equations as a system of $m-1\phantom{\rule{mediummathspace}{0.2em}}$equations in variables ${x}_{2},...,{x}_{n}.$ Repeat the procedure on this system.

Note that the application of steps 1 and 2 above will after one execution of step 2 yield a system of the form:

 $\begin{array}{ccccccccc}{a}_{1,1}\text{'}{x}_{1}& +& {a}_{1,2}\text{'}{x}_{2}& +& \dots & +& {a}_{1,n}\text{'}{x}_{n}& =& {b}_{1}\text{'}\\ & & {a}_{2,2}\text{'}{x}_{2}& +& \dots & +& {a}_{2,n}\text{'}{x}_{n}& =& {b}_{2}\text{'}\\ & & ⋮& & & & & & ⋮\\ & & {a}_{m,2}\text{'}{x}_{2}& +& \dots & +& {a}_{m,n}\text{'}{x}_{n}& =& {b}_{m}\text{'}\end{array}$ (1.2)

We now view the last $m-1$ equations of (1.2) as a linear system. Applying the steps 1 and 2 we get:

 $\begin{array}{ccccccccccc}{a}_{1,1}\text{'}{x}_{1}& +& {a}_{1,2}\text{'}{x}_{2}& +& {a}_{1,3}\text{'}{x}_{3}& +& \dots & +& {a}_{1,n}\text{'}{x}_{n}& =& {b}_{1}\text{'}\\ & & {a}_{2,2}\text{'}\text{'}{x}_{2}& +& {a}_{2,3}\text{'}\text{'}{x}_{3}& +& \dots & +& {a}_{2,n}\text{'}\text{'}{x}_{n}& =& {b}_{2}\text{'}\text{'}\\ & & & & {a}_{3,3}\text{'}\text{'}{x}_{3}& +& \dots & +& {a}_{3,n}\text{'}\text{'}{x}_{n}& =& {b}_{3}\text{'}\text{'}\\ & & & & ⋮& & & & & & ⋮\\ & & & & {a}_{m,3}\text{'}\text{'}{x}_{3}& +& \dots & +& {a}_{m,n}\text{'}\text{'}{x}_{n}& =& {b}_{m}\text{'}\text{'}\end{array}$ (1.3)

The aim of the algorithm (although there might be cases when in the resulting system some variable is missing) is to obtain a system of the form (where $k\le n$)

 $\begin{array}{ccccccccccccc}{c}_{1,1}{x}_{1}& +& {c}_{1,2}{x}_{2}& +& \dots & +& {c}_{1,k}{x}_{k}& +& \dots & +& {c}_{1,n}{x}_{n}& =& {d}_{1}\\ & & {c}_{2,2}{x}_{2}& +& \dots & +& {c}_{2,k}{x}_{k}& +& \dots & +& {c}_{2,n}{x}_{n}& =& {d}_{2}\\ & & & ⋮& & & & & & & & & ⋮\\ & & & & & & {c}_{k,k}{x}_{k}& +& \dots & +& {c}_{k,n}{x}_{n}& =& {d}_{k}\end{array}$ (1.4)

For simplicity, assume that all ${c}_{i,i}\ne 0$ for all $i=1,\dots k-1$.

There can happen two possibilities:

1. The last equation obtained by the Gauss Elimination Method has the following form

 $0.{x}_{k}\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}0.{x}_{k+1}\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}\dots \phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}0.{x}_{n}\phantom{\rule{mediummathspace}{0.2em}}=\phantom{\rule{mediummathspace}{0.2em}}{d}_{k}$

for some ${d}_{k}\ne 0$. In this case, the system (1.4), and also (1.1), is inconsistent and does not have a solution.

2. The coefficient ${c}_{k,k}\ne 0$. In this case, for every choice of variables ${x}_{j}\phantom{\rule{mediummathspace}{0.2em}}$for $j\ne 1,\dots ,k\phantom{\rule{mediummathspace}{0.2em}}$ there exists a solution of the system (1.4) and therefore also of the system (1.1). Let ${x}_{k+1}={t}_{1},$ ${x}_{k+2}={t}_{2},\phantom{\rule{mediummathspace}{0.2em}}\dots ,\phantom{\rule{mediummathspace}{0.2em}}{x}_{n}={t}_{n-k}$ for ${t}_{1},{t}_{2},\dots ,{t}_{n-k}\in ℝ$, then we can calculate the remaining variables ${x}_{1},\dots ,{x}_{k}$ from the following system

 $\begin{array}{ccccccccccccc}{c}_{1,1}{x}_{1}& +& \dots & +& {c}_{1,k}{x}_{k}& =& {d}_{1}& -& {c}_{1,k+1}{x}_{k+1}& -& \dots & -& {c}_{1,n}{x}_{n}\\ & & & & ⋮& & ⋮& & & & & & \\ & & & & {c}_{k,k}{x}_{k}& =& {d}_{k}& -& {c}_{k,k+1}{x}_{k+1}& -& \dots & -& {c}_{k,n}{x}_{n}\end{array}$ (1.5)

as follows: From the last equation of the system (1.6) we calculate ${x}_{k}\phantom{\rule{mediummathspace}{0.2em}}$(we divide the equation by ${c}_{k,k}$). This value of ${x}_{k}\phantom{\rule{mediummathspace}{0.2em}}$is substituted in the one but last equation tocalculate ${x}_{k-1}$; and so on till we calculate ${x}_{1}$ from the first equation. (Note that when we calculate ${x}_{1}$ then we already know all ${x}_{2},{x}_{3},\dots {x}_{k}$.) This procedure is often called back substitution.

The Gauss Elimination Method for solving systems of linear equations is based on the fact that all the operations, which the method does, lead to an equivalent systems of linear equations.

Let us formulate the result we obtained above as a proposition characterising consistent systems of linear equations.

Proposition 1.3. A system of linear equations is consistent if and only if the Gauss Elimination Method does not lead to any equation of the form

 $0.{x}_{1}+0.{x}_{2}+\dots +0.{x}_{n}=d$

with $d\ne 0$.

Example 1.4. Using Gauss Elimination Method solve the following system of linear equations

 $\begin{array}{ccccccccccc}& & 3{x}_{2}& -& 6{x}_{3}& +& 6{x}_{4}& +& 4{x}_{5}& =& -5\\ 3{x}_{1}& -& 7{x}_{2}& +& 8{x}_{3}& -& 5{x}_{4}& +& 8{x}_{5}& =& 9\\ 3{x}_{1}& -& 9{x}_{2}& +& 12{x}_{3}& -& 9{x}_{4}& +& 6{x}_{5}& =& 15\end{array}$ (1.6)

Solution 1.5. First, we interchange the first and the third equations

 $\begin{array}{ccccccccccc}3{x}_{1}& -& 9{x}_{2}& +& 12{x}_{3}& -& 9{x}_{4}& +& 6{x}_{5}& =& 15\\ 3{x}_{1}& -& 7{x}_{2}& +& 8{x}_{3}& -& 5{x}_{4}& +& 8{x}_{5}& =& 9\\ & & 3{x}_{2}& -& 6{x}_{3}& +& 6{x}_{4}& +& 4{x}_{5}& =& -5\end{array}$ (1.7)

We subtract the first row from the second one. By this we eliminate the variable ${x}_{1}\phantom{\rule{mediummathspace}{0.2em}}$from the second equation (the third one does not have variable ${x}_{1}$).

 $\begin{array}{ccccccccccc}3{x}_{1}& -& 9{x}_{2}& +& 12{x}_{3}& -& 9{x}_{4}& +& 6{x}_{5}& =& 15\\ & & 2{x}_{2}& -& 4{x}_{3}& +& 4{x}_{4}& +& 2{x}_{5}& =& -6\\ & & 3{x}_{2}& -& 6{x}_{3}& +& 6{x}_{4}& +& 4{x}_{5}& =& -5\end{array}$ (1.8)

We divide the second equation by $2$

 $\begin{array}{ccccccccccc}3{x}_{1}& -& 9{x}_{2}& +& 12{x}_{3}& -& 9{x}_{4}& +& 6{x}_{5}& =& 15\\ & & {x}_{2}& -& 2{x}_{3}& +& 2{x}_{4}& +& {x}_{5}& =& -3\\ & & 3{x}_{2}& -& 6{x}_{3}& +& 6{x}_{4}& +& 4{x}_{5}& =& -5\end{array}$ (1.9)

In the next step we eliminate the variable ${x}_{2}$ from the third equation; for this we add $\left(-3\right)$ multiple of the second equation to the third one

 $\begin{array}{ccccccccccc}3{x}_{1}& -& 9{x}_{2}& +& 12{x}_{3}& -& 9{x}_{4}& +& 6{x}_{5}& =& 15\\ & & {x}_{2}& -& 2{x}_{3}& +& 2{x}_{4}& +& {x}_{5}& =& -3\\ & & & & & & & & {x}_{5}& =& 4\end{array}$ (1.10)

To make the hand calculations easier we divide the first equatin by $3$

 $\begin{array}{ccccccccccc}{x}_{1}& -& 3{x}_{2}& +& 4{x}_{3}& -& 3{x}_{4}& +& 2{x}_{5}& =& 5\\ & & {x}_{2}& -& 2{x}_{3}& +& 2{x}_{4}& +& {x}_{5}& =& -3\\ & & & & & & & & {x}_{5}& =& 4\end{array}$ (1.11)

Let us rewrite the system (1.11) as follows

 $\begin{array}{ccccccccccc}{x}_{1}& -& 3{x}_{2}& +& {2x}_{5}& =& 5& -& 4{x}_{3}& +& 3{x}_{4}\\ & & {x}_{2}& +& {x}_{5}& =& -3& +& 2{x}_{3}& -& 2{x}_{4}\\ & & & & {x}_{5}& =& 4& & & & \end{array}$ (1.12)

Substituting $t$ for ${x}_{3}\phantom{\rule{mediummathspace}{0.2em}}$and $s$ for ${x}_{4}\phantom{\rule{mediummathspace}{0.2em}}$we get

 $\begin{array}{ccccccccccc}{x}_{1}& -& 3{x}_{2}& +& 2{x}_{5}& =& 5& -& 4t& +& 3s\\ & & {x}_{2}& +& {x}_{5}& =& -3& +& 2t& -& 2s\\ & & & & {x}_{5}& =& 4& & & & \end{array}$ (1.13)

Therefore, ${x}_{5}=4$, and from the second equation we have

 ${x}_{2}=-3\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}2t\phantom{\rule{mediummathspace}{0.2em}}-2s\phantom{\rule{mediummathspace}{0.2em}}-{x}_{5}\phantom{\rule{mediummathspace}{0.2em}}=-7\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}2t\phantom{\rule{mediummathspace}{0.2em}}-\phantom{\rule{mediummathspace}{0.2em}}2s.$

Finally, from the first equation we have

 ${x}_{1}=5\phantom{\rule{mediummathspace}{0.2em}}-\phantom{\rule{mediummathspace}{0.2em}}4t\phantom{\rule{mediummathspace}{0.2em}}+3s\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}3{x}_{2\phantom{\rule{mediummathspace}{0.2em}}}-2{x}_{5}\phantom{\rule{mediummathspace}{0.2em}}=\phantom{\rule{mediummathspace}{0.2em}}$
 $=\phantom{\rule{mediummathspace}{0.2em}}5\phantom{\rule{mediummathspace}{0.2em}}-\phantom{\rule{mediummathspace}{0.2em}}4t\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}3s\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}3\left(-7\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}2t\phantom{\rule{mediummathspace}{0.2em}}-\phantom{\rule{mediummathspace}{0.2em}}2s\right)\phantom{\rule{mediummathspace}{0.2em}}-\phantom{\rule{mediummathspace}{0.2em}}2.4\phantom{\rule{mediummathspace}{0.2em}}=\phantom{\rule{mediummathspace}{0.2em}}-24\phantom{\rule{mediummathspace}{0.2em}}+\phantom{\rule{mediummathspace}{0.2em}}2t\phantom{\rule{mediummathspace}{0.2em}}-3s.$

Answer: The system (1.6) has the following solutions

 ${x}_{1}=-20+2t-3s,{x}_{2}=-7+2t-2s,{x}_{3}=t,{x}_{4}=s,{x}_{5}=4$

for any choice of parameters $t,s\in ℝ\phantom{\rule{mediummathspace}{0.2em}}$.