Systems of Linear Equations
The program on this page uses Gaussian elimination to solve any system of linear equations of the form
A x = b.
A is the matrix of coefficients, x is the vector of unknowns and b is the vector of the right-hand side.
The system of equations can be underdetermined. A may be of any decline of rank.
It is possible to define auxiliary parameters, that can be used in the system matrix and the vector of the right-hand side.
Unused cells are interpreted as 0, so there is no need to specify zeros.
You can use cursor keys to change the input cell. CR initiates a new calculation.
Mathematical background
A unique solution only exists for regular matrix A, that is if det(A)≠0.
If det(A)=0 and rk(A)<rk(A|b), then there is no solution.
A|b is the so called augmented coeffient matrix. A is augmented by the vector b.
If det(A)=0 and rk(A)=rk(A|b), an infinitive number of solutions exist.
These solutions can be presented in the form of a general solution.
The general solution is the sum of a particular solution of the inhomogeneous system of equations
and the linear combination of all solutions of the homogeneous system of equations formed with the help of free parameters λi (λi ∈ ℝ).
The number of necessary parameters equals the difference between the number of unknowns and the rank of the system matrix.
The particular solution presented here is orthogonal to the set of solutions of the homogeneous system.
How to create the coefficient matrix
In matrix notation, a system of linear equations can be represented as:
A x = b.
The matrix A and the vector b must be given in order to determine the vector x.
If you are given a system of n equations, you must create the n×n matrix A and the vector b.
To do this, terms that do not contain any unknowns are moved to the right-hand side of the system by addition or subtraction.
Terms with unknowns on the right-hand side are also moved to the left-hand side of the system by addition or subtraction.
Furthermore, the terms in the equations are rearranged so that the unknowns appear in the same order in each equation:
Example:
5a - 3c - 7b + 8 = 0
b - a - 2c = -4
c = a + b
Terms on the right and left sides are correctly assigned (this step is often not necessary):
5a - 3c - 7b = -8
b - a - 2c = -4
c - a - b = 0
Reordered (order of unknowns is in principle arbitrary, here lexical):
5a - 7b - 3c = -8
-a + b - 2c = -4
-a - b + c = 0
Now, the coefficients of the unknowns a, b, c on the left-hand side can be transferred row by row in this order
into the coefficient matrix A.
This then results in the following assignment for A:
If one of the unknowns in an equation is not included, 0 is entered in the coefficient matrix.
The vector of the right-hand side b is filled with the numbers of the right-hand side of the system of equations.
This results in the system consisting of the matrix and the right-hand side:
| A | │ | b |
| 5 | -7 | -3 | │ | -8 |
| -1 | 1 | -2 | │ | -4 |
| -1 | -1 | 1 | │ | 0 |
After the calculation is complete, the solution vector x contains the unknowns in the
order chosen when setting up the rearranged system of equations.
The program Nonlinear Systems of Equations is primarily used to solve nonlinear systems of equations,
but can also be used for linear systems of equations. You can enter the equations directly there.
Gaussian Algorithm
The goal is to transform a given, generally fully populated matrix into upper triangular form:
* * * * * * * * * * *
* * * * * 0 * * * * *
* * * * * -> 0 0 * * * *
* * * * * 0 0 0 * * *
* * * * * 0 0 0 0 * *
* * * * * 0 0 0 0 0 *
The algorithm proceeds column by column from left to right.
First, the column below the first diagonal element is set to 0,
then the column below the second diagonal element is set to 0, and so on.
The respective diagonal element is the so-called pivot element.
It must be non-zero.
If it is not, a non-zero element is searched for below the pivot element.
If no such element is found, the matrix is singular and the algorithm terminates.
Otherwise, the row found is swapped with the row containing the pivot element.
The column below of the pivot element is then set to 0 by subtracting suitable multiples
of the row containing the pivot element from the columns below it. The values of the other row are added.
A recurring step is therefore to set all cells below a diagonal cell to 0:
* * * * * * | * * * * * * * | *
0 * * * * * | * 0 * * * * * | *
0 0 * * * * | * 0 0 * * * * | *
0 0 * * * * | * -> 0 0 0 * * * | *
0 0 * * * * | * 0 0 0 * * * | *
0 0 * * * * | * 0 0 0 * * * | *
A suitable multiple of row n with the pivot element an,n is obtained for row n+1,
by multiplying row n by -an+1,n/an,n.
Once the coefficient matrix of the system of equations has been transformed into upper triangular form,
the system of equations can easily be solved row by row from the bottom up.
more JavaScript applications