The General Solution of a System of Linear Equations using Gaussian elimination

This online calculator solves a system of linear algebraic equations using the Gaussian elimination method. It produces the result whether you have a unique solution, an infinite number of solutions, or no solution. It also outputs the result in floating point and fraction format.

This page exists due to the efforts of the following people:

Timur

Timur

Anton

Created: 2022-10-06 12:28:47, Last updated: 2022-10-06 12:28:47
Creative Commons Attribution/Share-Alike License 3.0 (Unported)

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/6200/. Also, please do not modify any references to the original work (if any) contained in this content.

The site already has one calculator that solves SLAE (System of Linear Algebraic Equations) by the Gauss–Jordan elimination (aka Gaussian elimination) method - Gaussian elimination. It even shows the solution step by step.

However, it has some disadvantages that the new calculator from this article will solve:

  • the previous calculator gives the solution in floating point format, while in many problem books the answer is usually given as a fraction.
  • the previous calculator only determines the fact that there are an infinite number of solutions, but does not give a general solution.
  • the previous calculator works only in the case when the number of equations is the same as the number of unknowns, and thus cannot solve underdetermined (the number of unknowns is greater than the number of equations) and overdetermined systems (the number of unknowns is less than the number of equations).

As for the second and third points, the universality of the Gauss–Jordan elimination method makes it suitable for a systems of linear equations with any number of equations and unknowns.

The description of the Gaussian elimination method itself can be viewed at the link above, and below the calculator we look at the different systems of linear equations: those with one solution, with an infinite number of solutions, with no solution, and underdetermined and overdetermined systems.

The calculator finds a unique solution if it exists, or a general solution if an infinite number of solutions exist. The default data below is the example of a system with an infinite number of solutions:

PLANETCALC, Gaussian Method for system of linear equations with any number of variables.

Gaussian Method for system of linear equations with any number of variables.

Number of solutions
 
Solution coefficients
 
The file is very large. Browser slowdown may occur during loading and creation.

1. System of linear equations which has a unique solution

Example: the system of linear equations:
\begin{cases}3x+2y+z=2; \\x-y+2z=-1;\\2x+2y+z=3;\end{cases}

After bringing the matrix to a trapezoidal form by the Gauss method, we get:
\begin{array}{|ccc|c|} 3 & 2 & 1 & 2 \\ 0 & -5 & 5 & -5 \\ 0 & 0 & -5 & -5 \\ \end{array}

Using back substitution we find the only solution:
x=-1; y=2; z=1
The system is consistent and defined.

2. System of linear equations which has an infinite number of solutions

Example: the system of linear equations:
\begin{cases}x_1+2x_2-3x_3+5x_4=1; \\x_1+3x_2-13x_3+22x_4=-1;\\3x_1+5x_2+x_3-2x_4=5;\\2x_1+3x_2+4x_3-7x_4=4;\end{cases}

After bringing the matrix to a trapezoidal form by the Gauss method, we get:
\begin{array}{|cccc|c|} 1 & 2 & -3 & 5 & 1 \\ 0 & 1 & -10 & 17 & -2 \\ 0 & 0 & 0 & 0 & 0 \ \ 0 & 0 & 0 & 0 & 0 \\ \end{array}

As a result, we get the system:
\begin{cases}x_1+2x_2-3x_3+5x_4=1; \\x_2-10x_3+17x_4=-2;\\0=0;\\0=0;\end{cases}

The last two equations are true for any values ​​of the variables:
0 \cdot x_1+0 \cdot x_2+0 \cdot x_3+0 \cdot x_4=0
so they can be discarded.

To find solutions for the remaining two equations, x1 and x2 should be expressed in terms of x3 and x4.
\begin{cases}x_2=10x_3-17x_4-2; \\x_1=-17x_3+29x_4+5;\end{cases}
In this case, x3 and x4 themselves can take any values

The resulting system is underdetermined. Formulas:
\begin{cases}x_1=-17x_3+29x_4+5; \\x_2=10x_3-17x_4-2; \\x_3 \in R; \\x_4 \in R; \end{cases}
for arbitrary x3 and x4 describe an infinite set of solutions to this system.

3. System of linear equations which has no solutions

Example: the system of linear equations:
\begin{cases}x_1-2x_2+3x_3-4x_4=2; \\3x_1+3x_2-5x_3+x_4=-3;\\-2x_1+x_2+2x_3-3x_4=5;\\3x_1+3x_3-10x_4=8;\end{cases}

After bringing the matrix to a trapezoidal form by the Gauss method, we get:
\begin{array}{|cccc|c|} 1 & -2 & 3 & -4 & 2 \\ 0 & 9 & -14 & 13 & -9 \\ 0 & 0 & 30 & -60 & 54 \\ 0 & 0 & 0 & 0 & 60 \\ \end{array}

The resulting system is inconsistent, since the last equation:
0 \cdot x_1+0 \cdot x_2+0 \cdot x_3+0 \cdot x_4=60
cannot be satisfied by any values ​​of the unknowns.

This system is inconsistent, that is, it has no solution.

4. Overdetermined system of linear equations (the number of unknowns is less than the number of equations)

Example: the system of linear equations:
\begin{cases}x_1+2x_2+3x_3=6; \\2x_1-3x_2+x_3=0;\\3x_1-2x_2+4x_3=5;\\x_1-x_2+3x_3=3;\end{cases}

After reducing the matrix to a trapezoidal form by the Gauss method, we obtain
\begin{array}{|ccc|c|} 1 & 2 & 3 & 6 \\ 0 & -7 & -5 & -12 \\ 0 & 0 & -5 & -5 \\ 0 & 0 & 0 & 0 \\ \end{array}

As you can see, in this case, the "extra" equation can simply be discarded and the problem is reduced to cases 1 or 2. Also, as a result of transformations, you can get the same equations, the “extra” of which can also be discarded - and again, the problem is reduced to cases 1 or 2.

5. Underdetermined system of linear equations (the number of unknowns is greater than the number of equations)

Example: the system of linear equations:
\begin{cases}x_1-x_2+3x_3-4x_4=0; \\2x_1+3x_2+6x_3-8x_4=0;\end{cases}

After bringing the matrix to a trapezoidal form by the Gauss method, we get:
\begin{array}{|cccc|c|} 1 & -1 & 3 & -4 & 0 \\ 0 & 5 & 0 & 0 & 0 \\ \end{array}

The resulting equivalent system has the form:
\begin{cases}x_1-x_2+3x_3-4x_4=0; \\5x_2=0;\end{cases}

As you can see, there are no equations in it that give single values ​​for x3 and x4, which is equivalent to the equations:
0 \cdot x_1+0 \cdot x_2+0 \cdot x_3+0 \cdot x_4=60
which can be discarded.

Thus, this case is reduced to case 2 with an infinite set of solutions, which are described by the following formulas:
\begin{cases}x_1=-3x_3+4x_4; \\x_2=0; \\x_3 \in R; \\x_4 \in R; \end{cases}

URL copied to clipboard
PLANETCALC, The General Solution of a System of Linear Equations using Gaussian elimination

Comments