Systems of linear equations
A system of linear equations is a set of m linear equations in n variables. Solving the system means finding values that we can substitute for our n variables so that all the equations are true at the same time.
Definition of a system of linear equations
You have almost certainly met a simple pair of simultaneous equations like this:
where a11,…,a22, b1, b2 are given real numbers and x and y are variables. Just like an ordinary linear equation, this system can have different numbers of solutions – none, one or infinitely many. For a system of linear equations, deciding how many solutions there are and finding them is harder than for a single linear equation.
The definition of a system of linear equations:
where a11, …, amn, b1, …, bm are real numbers. This is called a system of m linear equations in the n unknowns x1, …, xn with coefficients a11, …, amn. A specific example of a system of linear equations might look like this:
If some aij is negative, though, it is usual to write the system in this form:
It is still true that a12 = −2 and a24 = −10.
Matrix form
We can convert this system into matrix form. We define three matrices in all: one for the coefficients, one for the right-hand sides of the equations and one for the variables themselves. The matrices look like this:
Matrix A contains the coefficients of the original equations and is called the “coefficient matrix”, matrix b contains the right-hand sides of the equations and matrix x contains the variables. We can then write the whole system as a single equation:
This equation makes sense because the left-hand side is a product of two matrices and the right-hand side is a matrix, and their dimensions match. Let’s try multiplying out the left-hand side. We multiply an m × n matrix by an n × 1 matrix, so the result is an m × 1 matrix with m rows and one column. So far so good.
Now we apply the standard method of matrix multiplication, starting with the first row of A and the first column of x (there is no other column). We get:
This sum gives the first element of the new matrix, which is the value b1. Putting that into the equation, we have:
This is exactly the first equation of our system. We would carry on in the same way for the other rows. We also define the augmented matrix, which is the coefficient matrix with the matrix b attached as an extra column:
Next we are interested in the rank of this augmented matrix. We write the rank of the original coefficient matrix as rank(A) and the rank of the augmented matrix as rank(A|b). How are these ranks related? If we attach the column b to the matrix A, there are two possibilities. If the new column is a linear combination of the columns of A, the rank does not change. If it is not a linear combination of them, the rank goes up by one.
Rouché–Capelli theorem
The rank of the augmented matrix matters because of an important theorem, the Rouché–Capelli theorem (also called the Frobenius theorem): The system Ax = b has a solution if and only if the rank of the coefficient matrix equals the rank of the augmented matrix: rank(A) = rank(A|b).
Let’s show that the theorem holds in at least one direction: if x = β is a solution of Ax = b, then rank(A) = rank(A|b). If these ranks are equal, the column b must be a linear combination of the columns of A. Let’s write it out. The matrix β has the form:
We are claiming that if we substitute β1 for x1 and so on, all the equations in the system are true:
Now let’s rewrite the equations a little. Looking at the first column, we always have the values a11, a21, …, am1, all multiplied by the same value β1. If we put that column into a matrix of its own, we can take out the common factor β1 in front of the matrix, which gives:
We can now rewrite the whole system in this way:
For this equation to hold, the matrix on the right-hand side must be a linear combination of the column matrices on the left-hand side, with the values β1, …, βn as their coefficients.
We have now shown that if the matrix β is to be a solution of the system, the right-hand side of the system, the matrix b, must be a linear combination of the columns of the coefficient matrix. And if the column b is a linear combination of the columns of A, then A must have the same rank as (A|b).
It is also true that if rank(A) = rank(A|b) = k and k equals the number of unknowns, that is k = n, then the system has exactly one solution. If k < n, the system has infinitely many solutions and we need n − k parameters to write them down.
Elementary row operations
The previous equation also shows that if we carry out elementary row operations on the matrix (A|b), the solutions of the system do not change. If we added the first row to the second row, we would get the equation:
Writing out the second row, we get:
Expanding the brackets:
Now we just rearrange the terms a little:
The first bracket is really the first row and the second bracket is the original second row. We know that the first row equals b1 and the second row equals b2, from the original equations. So we can write b1 for the first bracket and b2 for the second:
In the same way, we can multiply a whole row by a constant c ≠ 0 without changing the solutions of the system. Watch out, though: we cannot carry out column operations.
A system with one solution
Let’s use an example to see how to solve a system that has exactly one solution. Take this system of equations:
The matrix A looks like this:
Now we work out the rank of this matrix:
We see that rank(A) = 3. It follows that rank(A|b) = 3 as well, because a 3 × 4 matrix can have rank three at most. The system has three unknowns, so it has exactly one solution. How do we find it?
Gaussian elimination
Gaussian elimination means reducing the augmented matrix to row echelon form. Once the matrix is in row echelon form, we can read off the value of one variable. When we have found the value of one variable, we can start substituting it into the other equations.
The matrix (A|b) is:
We reduce it to row echelon form. We carry out the same operations as in the previous step, but this time we apply them to the fourth column too:
Because we used only elementary row operations, this matrix describes an equivalent system of equations – a system with the same solution set. Let’s write the system out in ordinary form, using the coefficients from our last matrix:
Now we start from the last equation. It tells us that 78x3 = 312. What must x3 be? This is a simple linear equation, so
We have the value of the first variable, x3. We substitute it into the second equation, which gives:
Finally, we substitute both values into the first equation:
The value of x1 is two. We now have the complete solution, and can write x = (x1, x2, x3) = (2, 5, 4). As you can see, Gaussian elimination is a simple but effective way to solve a system of linear equations.
Infinitely many solutions
If rank(A) = rank(A|b) = k and k is less than the number of unknowns, k < n, the system has infinitely many solutions. Let’s take a simple example:
We can see that the second equation is three times the first equation. If we multiply the first equation by minus three and add it to the second row, we get:
Now the number of variables is two, n = 2, the rank of the coefficient matrix is one, rank(A) = 1, and the rank of the augmented matrix is also one, rank(A|b) = 1. Since k < n, the system has infinitely many solutions. How do we find them?
Let’s look at the equations. The second equation is true for all x1, x2, so only the first equation matters. In fact, all the pairs x1, x2 that satisfy the first equation make up the set of all solutions of the system. So we solve the equation 4x1 + x2 = 5. We rearrange it to the form x2 = 5 − 4x1.
Next we use a parameter. We choose a parameter t and try to express the pair x1, x2 in terms of t, so that we could write, for example, that all pairs of the form (t, t + 2) are solutions of a system. That is, pairs such as (1, 3) or (14, 16). The point is to express one variable in terms of another, so that we know that whatever value x1 takes, x2 will be, say, three times as large. As a starting point we choose x1.
So we set t = x1. If x1 has the value t, what value does x2 have? We can see from the previous equation that x2 = 5 − 4x1. So if x1 = t, then x2 = 5 − 4t. We can therefore write that all pairs of the form (t, 5 − 4t) are solutions of the system.
We can check this. If we substitute one for t, we get x1 = 1 and x2 = 5 − 4 · 1 = 1. Substituting these values into the equation gives 4 · 1 + 1 = 5, which is correct.
If we substitute five for t, we get x1 = 5 and x2 = 5 − 4 · 5 = −15. Substituting into the equation gives 4 · 5 − 15 = 5. That works too.
General and particular solutions
A solution of a system of equations written using parameters is called a general solution. A specific solution, obtained by substituting specific numbers for the parameters, is called a particular solution.
So in the previous example, (x1, x2) = (t, 5 − 4t) is the general solution of the system, and (1, 1) and (5, −15) are particular solutions.
If we have a coefficient matrix A and an augmented matrix (A|b) with equal ranks, rank(A) = rank(A|b) = k, then we need n − k parameters to express the general solution. Notice that if n = k, we need zero parameters. That is the case where the system has exactly one solution – no parameter is needed.
Example
Solve the following system of linear equations:
First we work out the ranks of A and (A|b). We reduce the augmented matrix to row echelon form, which gives us the rank of both matrices. Let’s start. (We multiply the first row by two, then add the first and second rows and subtract this result from the third row. Next we subtract the first row from the second row and finally divide the first row by two again.)
From this last matrix we can see that rank(A) = rank(A|b) = k = 2. The number of unknowns is n = 4, so we need n − k = 2 parameters. Let’s write out the equations from the last matrix:
From the second equation we get
We choose the first parameter, t = x3. Then we can write x1 = −6t. We can substitute this into the first equation:
Now we bring in the second parameter, s = x4. Then we can write
This gives the general solution of the system:
We can try some particular solutions. For example, s = t = 0. Then we get
we get:
After removing the zero terms and multiplying out the fractions, we get:
Let’s try another particular solution: s = 2, t = 1. Then we get:
Substituting into the equations:
Simplifying:
And finally we get:
It looks as though the general solution is correct.
Chapters: Systems of linear equations, Cramer’s rule, Homogeneous systems of linear equations