If you need to solve a system of linear equations, Gaussian elimination is often the best choice. We’ve considered this topic in one of the previous sections. For better understanding we prepared several examples covering this topic similar to those in linear algebra homework. Now let’s solve the system of 3 linear equations with 3 unknowns x,y,z:
\left\{ \begin{aligned}2x-4y+6z =3\\x-2z=4\\3x+6y=2\end{aligned}\right.
Lets’ follow the algorithm of the Gauss elimination method.
On the first step we eliminate the unknown x from all equations of our system, except the first (provided that x is present in the first equation, as in our case. If it’s not so we can switch equations, as we discussed before). So we divide the first equation of the system by 2:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\x-2z=4\\3x+6y=2\end{aligned}\right.
Now, having x with coefficient 1 in front of it in the first equation, we easily eliminate x from the second and the third equations. To do this, we subtract the first equation multiplied by the corresponding coefficient (that is 1 for the second equation and 3 for the third) from them. So we subtract the first equation multiplied by 1 from the second; and subtract the first equation multiplied by 3 from the third.
We get:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\2y-5z=\frac{5}{2}\\12y-9z=-\frac{5}{2}\end{aligned}\right.
Now we see that there’s no terms with x in the second and the third equations as we intended. Next step is to eliminate y from from the third equation. First of all, we divide the second equation by 2:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\y-\frac{5}{2}z=\frac{5}{4}\\12y-9z=-\frac{5}{2}\end{aligned}\right.
Next we subtract the second equation multiplied by 12 from the third:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\y-\frac{5}{2}z=\frac{5}{4}\\21z=-\frac{5}{2}-15=-\frac{35}{2}\end{aligned}\right.
As we can see, we already have our system in required form which is called triangular. What is left for us to do is to perform so called reverse course of Gauss method: first, we get z from the last equation:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\y-\frac{5}{2}z=\frac{5}{4}\\z=-\frac{5}{6}\end{aligned}\right.
Then we substitute obtained value for z into the second equation to obtain y:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\y-\frac{5}{2}\cdot(-\frac{5}{6})=\frac{5}{4}\\z=-\frac{5}{6}\end{aligned}\right.
Rearranging terms and performing required calculations we get:
\left\{ \begin{aligned}x-2y+3z =\frac{3}{2}\\y=\frac{5}{2}\cdot(-\frac{5}{6})+\frac{5}{4}=-\frac{5}{6}\\z=-\frac{5}{6}\end{aligned}\right.
And the last step: we substitute values for y,z into the first equation to obtain x:
\left\{ \begin{aligned}x-2(-\frac{5}{6})+3(-\frac{5}{6}) =\frac{3}{2}\\y=-\frac{5}{6}\\z=-\frac{5}{6}\end{aligned}\right.
Performing necessary calculations, we finally obtain:
\left\{ \begin{aligned}x=\frac{7}{3}\\y=-\frac{5}{6}\\z=-\frac{5}{6}\end{aligned}\right.
So the answer is the following:
\left\{ \begin{aligned}x=\frac{7}{3}\\y=z=-\frac{5}{6}\end{aligned}\right.
That’s it. More examples in the next section.
[…] previous sections you can find theoretical background and examples including application of matrix representation and example of linear system having no solutions. […]
[…] method. Earlier we’ve prepared several tutorials covering theoretical background and examples including application of matrix representation. Yet, all those examples suggested systems of […]