Example 6.
2x1+x2=0,2x1+x2=1.
These equations are not consistent, and therefore no solution can exist.
Example 7.
There are infinitely many solutions to the linear system
2x1+x2=0,4x1+2x2=0.
Here the equations can be reduced to the same equation. Thus we have two unknowns, x1 and x2 , but only one equation. Thus any point on the line 2x1+x2=0 solves the system.
A geometric interpretation of solving linear systems is that if you were to plot each equation, the solution would be where they intersect. Hence, most often, two lines intersect at a point. However, the lines could be parallel and never intersect (this is the inconsistent case), or they could be the same line and intersect at every point on the line. The same idea can be extended to larger systems, and generally speaking, an n-equation, n-unknown consistent linear system will have a unique solution, provided that no equation is repeated.
In the 22 case, it is easy to see when an equation is repeated or inconsistent, but for larger systems, it is not always so easy. For example, consider the system of equations
2x1+x2=0,4x2+2x3=1,2x1+5x2+2x3=1.
Here the third equation is merely the sum of the first two equations. Hence it is not inconsistent, but it does not add anything to the system: if the first two equations are satisfied, then the third will automatically be satisfied. Two consistent equations with three unknowns means infinitely many solutions (two planes intersecting along a line).
It will be more convenient to use matrixvector notation to represent linear systems of equations. For example, the above 3-equation 3-unknown system can be equivalently written as
Ax=210042252x1x2x3=011=b.
If we are going to try to use a numerical algorithm to find a solution to a system of equations, it would be nice to know up front whether or not a unique solution exists for a particular linear system. It turns out that there are many ways to determine this for small systems (say, n<10,000 ); for example, if the determinant of the matrix of coefficients is nonzero, then a solution exists and is unique. For larger systems, however, this determination can be very difficult. Fortunately, most linear systems that arise in science and engineering from common approaches such as finite element and finite difference methods are uniquely solvable, and if not, then often a mistake has been made in the derivation of the coefficients, or there is a different approach to the problem that would lead to a solvable system. Thus we will assume for the rest of this chapter that all the square linear systems have a unique solution, but we will keep in mind this potential problem when we analyze the algorithms. As the definition below states, this assumption can be made in several equivalent ways.
Definition 8.
A square linear system Ax=b is uniquely solvable if the matrix A is nonsingular, which is equivalent to each of:
A is invertible;
det(A)0 ;
No eigenvalue of A is zero;
No singular value of A is zero;
The rows of A are linearly independent;
The columns of A are linearly independent.
3.2 Solving triangular systems
A first step along the way to solving general linear systems of equations is solving triangular systems, which get their name because the matrix representation of their coefficients has only 0s either above or below the main diagonal (which goes from the top left to the bottom right). For such systems, finding solutions is straightforward, as we show in the following example.
Example 9 (Back-substitution for an upper triangular system).
We want to use back-substitution to solve the upper triangular system of equations
123045006x1x2x3=156x1+2x2+3x3=1,4x2+5x3=5,6x3=6.
The last equation can be solved directly for x3 :
6x3=6x3=1.
Plug in x3 into the first two equations and rewrite as a system of two equations:
1204x1x2=13x355x3=13(1)55(1)=40x1+2x2=4,4x2=0.
Notice that the new, smaller 22 system remains upper triangular. That is a key point to the algorithm, as it can now be repeated over and over until the matrix reduces to a scalar. Solving the second equation directly for x2 gives x2=0 . Finally, plugging x2 into the first equation and solving yield x1=4 .
This procedure can easily be made into a general algorithm: For an nn upper triangular linear system starting at the bottom diagonal, solve for the unknown xn in that row, then plug it into the above rows. This leaves an (n1)(n1) triangular linear system, and so you repeat the process until the solution is determined. See for a visual representation of the following code that implements back-substitution:
It can happen that this algorithm fails. If a diagonal entry is zero, then dividing by the diagonal entry is not possible. In such cases, it turns out that the rows of the matrix must have repetitions, which means there is not a unique solution to the problem it has either no solutions or infinitely many solutions. Note that the code above checks for this.