# How to do Gauss elimination? Case of system with unique solution

In this section we offer one more example of how to solve system of linear algebraic equations using Gaussian elimination method. This example clearly shows that while doing Gaussian elimination you ought to notice when it’s convenient to swap rows in order to save time and reduce calculations.

We have the following system of linear algebraic equations to solve:

\left\{ \begin{aligned}-2x+y+2z=2\\x+3y-z=0\\3x+2y+4z=3 \end{aligned}\right.

First of all, note that we can swap any two equations in the system as we like, solution obviously won’t change. We see that $x$ has coefficient $1$ in the second equation, so we can transform our system as following

\left\{ \begin{aligned}x+3y-z=0\\-2x+y+2z=2\\3x+2y+4z=3 \end{aligned}\right.

Here’s video version of this example:

Now we can eliminate $x$ from the second equation. For that let’s add the first equation multiplied by $2$ to the second one:

\left\{ \begin{aligned}x+3y-z=0\\7y=2\\3x+2y+4z=3 \end{aligned}\right.

Also we eliminate $x$ from the third equation: subtract the first equation  multiplied by $3$ from the third one:

\left\{ \begin{aligned}x+3y-z=0\\7y=2\\-7y+7z=3 \end{aligned}\right.

After that, we could proceed according to our algorithm. But there’s no need to do that, as we see that we have the second equation containing only one unknown $y$, and also the third equation containing two unknowns. So we can rearrange our system as following:

\left\{ \begin{aligned}x+3y-z=0\\-7y+7z=3 \\7y=2\end{aligned}\right.

This is triangular form; we can get $y$ from the third equation immediately:

\left\{ \begin{aligned}x+3y-z=0\\-7y+7z=3 \\y=\frac{2}{7}\end{aligned}\right.

Next we substitute it into the second equation and obtain value of $z$:

\left\{ \begin{aligned}x+3y-z=0\\z=\frac{5}{7} \\y=\frac{2}{7}\end{aligned}\right.

Then substitute values of $y, z$ into the first equation to obtain $x$:

\left\{ \begin{aligned}x=-\frac{1}{7} \\z=\frac{5}{7} \\y=\frac{2}{7}\end{aligned}\right.