Skip to main content
Logo image

Applied Discrete Structures

Section 12.1 Systems of Linear Equations

Subsection 12.1.1 Solutions

The method of solving systems of equations by matrices that we will look at is based on procedures involving equations that we are familiar with from previous mathematics courses. The main idea is to reduce a given system of equations to another simpler system that has the same solutions.

Definition 12.1.1. Solution Set.

Given a system of equations involving real variables x1, x2,, xn, the solution set of the system is the set of n-tuples in Rn, (a1,a2,,an) such that the substitutions x1=a1, x2=a2,, xn=an make all the equations true.
In terms of logic, a solution set is a truth set of a system of equations, which is a proposition over n-tuples of real numbers.
In general, if the variables are from a set S, then the solution set will be a subset of Sn. For example, in number theory mathematicians study Diophantine equations, where the variables can only take on integer values instead of real values.

Definition 12.1.2. Equivalent Systems of Equations.

Two systems of linear equations are called equivalent if they have the same set of solutions.

Example 12.1.3. Two equivalent systems.

The previous definition tells us that if we know that the system
4x1+2x2+x3=12x1+x2+x3=42x1+2x2+x3=3
is equivalent to the system
 x1+0x2+0x3=10x1+x2 +0x3=10x1+0x2 +x3=7
then both systems have the solution set {(1,1,7)}. In other words, the simultaneous values x1=1, x2=1, and x3=7 are the only values of the variables that make all three equations in either system true.

Subsection 12.1.2 Elementary Operations on Equations

Let us now use the above theorem to work out the details of Example 12.1.3 and see how we can arrive at the simpler system.
The original system:
(12.1.1)4x1+2x2+x3=12x1+x2+x3=42x1+2x2+x3=3
Step 1. We will first change the coefficient of x1 in the first equation to one and then use it as a pivot to obtain 0’s for the coefficients of x1 in Equations 2 and 3.
  • Multiply Equation 1 by 14 to obtain
    (12.1.2)x1+x22+x34=142x1+x2+x3=42x1+2x2+x3=3
  • Multiply Equation 1 by 2 and add the result to Equation 2 to obtain
    (12.1.3)x1+x22+x34=140x1+0x2+x32=722x1+2x2+x3=3
  • Multiply Equation 1 by 2 and add the result to Equation 3 to obtain
    (12.1.4)x1+x22+x34=140x1+0x2+x32=720x1+x2+x32=52
We’ve explicitly written terms with zero coefficients such as 0x1 to make a point that all variables can be thought of as being involved in all equations. After this example is complete, we will discontinue this practice in favor of the normal practice of making these terms “disappear.”
Step 2. We would now like to proceed in a fashion analogous to Step 1; namely, multiply the coefficient of x2 in the second equation by a suitable number so that the result is 1. Then use it as a pivot to obtain 0’s as coefficients for x2 in the first and third equations. This is clearly impossible (Why?), so we will first interchange Equations 2 and 3 and proceed as outlined above.
  • Exchange Equations 2 and 3 to obtain
    (12.1.5)x1+x22+x34=140x1+x2+x32=520x1+0x2+x32=72
  • Multiply Equation 2 by 12 and subtract the result from Equation 1 to obtain
    (12.1.6)x1+0x2+0x3=10x1+x2+x32=520x1+0x2+x32=72
Step 3. Next, we will change the coefficient of x3 in the third equation to one and then use it as a pivot to obtain 0’s for the coefficients of x3 in Equations 1 and 2. Notice that the coefficient of x3 is already zero in Equation 1, so we have been saved some work!
  • Multiply Equation 3 by 2 to obtain
    x1+0x2+0x3=10x1+x2+x32=520x1+0x2+x3=7
  • Multiply Equation 3 by 1/2 and add the result to Equation 2 to obtain
    (12.1.7)x1+0x2+0x3=10x1+x2+0x3=10x1+0x2+x3=7
From the system of equations at the end of Step 3, we see that the solution to the original system is x1=1, x2=1, and x3=7.

Subsection 12.1.3 Transition to Matrices

In the above sequence of steps, we note that the variables serve the sole purpose of keeping the coefficients in the appropriate location. This we can effect by using matrices. The matrix of the original system in our example is
(421121142213)
where the matrix of the first three columns is called the coefficient matrix and the complete matrix is referred to as the augmented matrix. Since we are now using matrices to solve the system, we will translate Theorem 12.1.4 into matrix language.

Subsection 12.1.4 Elementary Row Operations

Definition 12.1.6. Row Equivalent Matrices.

Two matrices, A and B, are said to be row-equivalent if one can be obtained from the other by any sequence of zero or more elementary row operations.
If we use the notation Ri to stand for Row i of a matrix and to stand for row equivalence, then
AcRi+RjB
means that the matrix B is obtained from the matrix A by multiplying the Row i of A by c and adding the result to Row j. The operation of multiplying row i by c is indicated by
AcRiB
while exchanging rows i and j is denoted by
ARiRjB.
The matrix notation for the system given in our first example, with the subsequent steps, is:
(421121142213) 14R1 (112141421142213)  2R1+R2 (11214140012722213) 2R1+R3 (1121414001272011252)  R2R3 (1121414011252001272) 12R2+R1 (1001011252001272)  2R3 (10010112520017)  12R3+R2 (100101010017)
This again gives us the solution. This procedure is called the Gauss-Jordan elimination method.
It is important to remember when solving any system of equations via this or any similar approach that at any step in the procedure we can rewrite the matrix in “equation format” to help us to interpret the meaning of the augmented matrix.
In our first example we found a unique solution, only one triple, namely (1,1,7), which satisfies all three equations. For a system involving three unknowns, are there any other possible results? To answer this question, let’s review some basic facts from analytic geometry.
The graph of a linear equation in three-dimensional space is a plane. So geometrically we can visualize the three linear equations as three planes in three-space. Certainly the three planes can intersect in a unique point, as in the first example, or two of the planes could be parallel. If two planes are parallel, there are no common points of intersection; that is, there are no triple of real numbers that will satisfy all three equations. Another possibility is that the three planes could intersect along a common axis or line. In this case, there would be an infinite number of real number triples in R3. Yet another possibility would be if the first two planes intersect in a line, but the line is parallel to, but not on, the third plane, giving us no solution. Finally if all three equations describe the same plane, the solution set would be that plane.
We can generalize these observations. In a system of n linear equations, n unknowns, there can be
  1. a unique solution,
  2. no solution, or
  3. an infinite number of solutions.
To illustrate these points, consider the following examples:

Example 12.1.7. A system with no solutions.

Find all solutions to the system
 x1+3x2 +x3=2 x1 +x2+5x3=42x1+2x2+10x3=6
The reader can verify that the augmented matrix of this system, (1312115422106), reduces to (131211540002).
We can attempt to row-reduce this matrix further if we wish. However, any further row-reduction will not substantially change the last row, which, in equation form, is 0x1+0x2+0x3=2, or simply 0=2. It is clear that we cannot find real numbers x1, x2, and x3 that will satisfy this equation. Hence we cannot find real numbers that will satisfy all three original equations simultaneously. When this occurs, we say that the system has no solution, or the solution set is empty.

Example 12.1.8. A system with an infinite number of solutions.

Next, let’s attempt to find all of the solutions to:
 x1+6x2+2x3=12x1 +x2+3x3=24x1+2x2+6x3=4
The augmented matrix for the system is
(12.1.8)(162121324264)
which reduces to
(12.1.9)(10161110111100000)
If we apply additional elementary row operations to this matrix, it will only become more complicated. In particular, we cannot get a one in the third row, third column. Since the matrix is in simplest form, we will express it in equation format to help us determine the solution set.
(12.1.10)x1+1611x3=1x2+111x3=00=0
Any real numbers will satisfy the last equation. However, the first equation can be rewritten as x1=11611x3, which describes the coordinate x1 in terms of x3 . Similarly, the second equation gives x2 in terms of x3 . A convenient way of listing the solutions of this system is to use set notation. If we call the solution set of the system S, then
S={(11611x3,111x3,x3)x3R}.
What this means is that if we wanted to list all solutions, we would replace x3 by all possible numbers. Clearly, there is an infinite number of solutions, two of which are (1,0,0) and (15,1,11), when x3 takes on the values 0 and 11, respectively.
A Word Of Caution: Frequently we may can get “different-looking” answers to the same problem when a system has an infinite number of solutions. Assume the solutions set in this example is reported to be A={(1+16x2,x2,11x3)x3R}. Certainly the result described by S looks different from that described by A. To see whether they indeed describe the same set, we wish to determine whether every solution produced in S can be generated in A. For example, the solution generated by S when x3=11 is (15,1,11). The same triple can be produced by A by taking x2=1. We must prove that every solution described in S is described in A and, conversely, that every solution described in A is described in S. (See Exercise 6 of this section.)
To summarize the procedure in the Gauss-Jordan technique for solving systems of equations, we attempt to obtain 1’s along the main diagonal of the coefficient matrix with 0’s above and below the diagonal. We may find in attempting this that this objective cannot be completed, as in the last two examples we have seen. Depending on the way we interpret the results in equation form, we either recognize that no solution exists, or we identify “free variables” on which an infinite number of solutions are based. The final matrix forms that we have produced in our examples are referred to as echelon forms.
In practice, larger systems of linear equations are solved using computers. Generally, the Gauss-Jordan algorithm is the most useful; however, slight variations of this algorithm are also used. The different approaches share many of the same advantages and disadvantages. The two major concerns of all methods are:
  1. minimizing inaccuracies due to round-off errors, and
  2. minimizing computer time.

Subsection 12.1.5 The Gauss-Jordan Algorithm

The accuracy of the Gauss-Jordan method can be improved by always choosing the element with the largest absolute value as the pivot element, as in the following algorithm.

Note 12.1.10.

At the end of this algorithm, with the final form of C you can revert back to the equation form of the system and a solution should be clear. In general,
  • If any row of C is all zeros, it can be ignored.
  • If any row of C has all zero entries except for the entry in the (m+1)st position, the system has no solution. Otherwise, if a column has no pivot, the variable corresponding to it is a free variable. Variables corresponding to pivots are basic variables and can be expressed in terms of the free variables.

Example 12.1.11.

If we apply The Gauss-Jordan Algorithm to the system
5x1+x2+2x3+x4=23x1+x22x3=5x1+x2+3x3x4=1
the augmented matrix is
(512123120511311)
is reduced to
(1001212010323200101)
Therefore, x4 is a free variable in the solution and general solution of the system is
x=(x1x2x3x4)= (1212x432+32x41x4)
This conclusion is easy to see if you revert back to the equations that the final value the reduced matrix represents.

Subsection 12.1.6 SageMath Note - Matrix Reduction

Given an augmented matrix, C, there is a matrix method called echelon_form that can be used to row reduce C. Here is the result for the system in Example 12.1.11. In the assignment of a matrix value to C, notice that the first argument is QQ, which indicates that the entries should be rational numbers. As long as all the entries are rational, which is the case here since integers are rational, the row-reduced matrix will be all rational.
If we don’t specify the set from which entries are taken, it would assumed to be the integers and we do not get a fully row-reduced matrix. This is because the next step in working with the next output would involve multiplying row 2 by 12 and row 3 by 19, but these multipliers are not integers.
If we specifying real entries, the result isn’t as nice and clean as the rational output.
The default number of decimal places may vary from what you see here, but it can be controlled. The single small number in row three column four isn’t exactly zero because of round-off but we could just set it to zero.

Exercises 12.1.7 Exercises

1.

Solve the following systems by describing the solution sets completely:
  1. 2x1+x2=3x1x2=1
  2. 2x1+x2+3x3=54x1+x2+2x3=18x1+2x2+4x3=2
  3. x1+x2+2x3=1x1+2x2x3=1x1+3x2+x3=5
  4. x1x2+3x3=7x1+3x2+x3=4
Answer.
  1. {(4/3,1/3)}
  2. {(12x33,4x3+11,x3)x3R}
  3. {(5,14/5,8/5)}
  4. {(6.252.5x3,0.75+0.5x3,x3)x3R}

2.

Solve the following systems by describing the solution sets completely:
  1. 2x1+2x2+4x3=22x1+x2+4x3=03x1+5x2+x3=0
  2. 2x1+x2+3x3=24x1+x2+2x3=18x1+2x2+4x3=4
  3. x1+x2+2x3+x4=3x1x2+3x3x4=23x1+3x2+6x3+3x4=9
  4. 6x1+7x2+2x3=34x1+2x2+x3=26x1+x2+x3=1
  5. x1+x2x3+2x4=1x1+2x2+3x3+x4=5x1+3x2+2x3x4=1

3.

Given the final augmented matrices below from the Gauss-Jordan Algorithm, identify the solutions sets. Identify the basic and free variables, and describe the solution set of the original system.
  1. (10501.201402.600014.5)
  2. (109301040001)
  3. (106501210000)
  4. (100310102200111)
Answer.
  1. Basic variables: x1, x2 and x4. Free variable: x3. Solution set: {(1.2+5x3,2.64x3,4.5)x3R}
  2. Basic variables: x1 and x2. Free variable: x3. The solution set is empty because the last row of the matrix converts to the inconsistent equation 0=1.
  3. Basic variables: x1 and x2. Free variable: x3. Solution set: {(6x3+5,2x3+1,x3)x3R}
  4. Basic variables: x1, x2 and x3. Free variable: x4. Solution set: {(3x4+1,2x4+2,x4+1,x4)x4R}

5.

Solve the following systems using only mod 5 arithmetic. Your solutions should be ntuples from Z5.
  1. 2x1+x2=3x1+4x2=1 (compare your solution to the system in 5(a))
  2. x1+x2+2x3=1x1+2x2+4x3=4x1+3x2+3x3=0
Answer.
  1. {(3,0)}
  2. {(3,0,4)}

6.

  1. Use the solution set S of Example 12.1.8 to list three different solutions to the given system. Then show that each of these solutions can be described by the set A in the same example.
  2. Prove that S=A.

7.

Given a system of n linear equations in n unknowns in matrix form AX=b, prove that if b is a matrix of all zeros, then the solution set of AX=b is a subgroup of Rn.
Answer.
Proof: Since b is the n×1 matrix of 0{’}s, let’s call it 00. Let S be the set of solutions to AX=00. If X1 and X2 be in S. Then
A(X1+X2)=AX1+AX2=00+00=00
so X1+X2S; or in other words, S is closed under addition in Rn.
The identity of Rn is 00, which is in S. Finally, let X be inS. Then
A(X)=(AX)=00=00
and so X is also in S.
You have attempted of activities on this page.