1.2 Solving Linear Systems via Gaussian Elimination
Forward elimination and back substitution are all you need
1ReadingΒΆ
Material related to this page, as well as additional exercises, can be found in ALA Ch. 1.1, LAA Ch 1.1, and ILA Ch. 2.2. These notes are mostly based on ALA Ch 1.1.
2Learning ObjectivesΒΆ
By the end of this page, you should know:
- what a linear equation is, how to identify one, and how they combine to form a system of linear equations (also called a linear system)
- what a solution set is, and the kinds of solution sets a linear system can have
- how to solve most small systems of linear equations by hand using Gaussian Elimination
3TerminologyΒΆ
A linear equation[1] in the variables is an equation that can be written in the form
where and the coefficients are real or complex numbers[2] that are typically known in advance. The subscript is a positive integer, and encodes how many variables appear in the linear equation. When we ask you to solve problems by hand, is typically 2 or 3, but we will see and solve problems where is in the hundreds or even thousands!
A system of linear equations (or linear system) is a collection of one or more linear equations involving the same variables, say . An example is
which is a system of three equations in three unknowns.
A solution of the system is a list of numbers that makes each equation a true statement when the values are substituted for , respectively. For instance, is a solution of system (2) because, when these values are substituted in (2) for , respectively, the equations simplify to , , and . The set of all possible solutions is called the solution set of the linear system. We state an important fact regarding the solution set of linear systems that we will understand very deeply by the end of this chapter:
4Solving Linear SystemsΒΆ
We start with a simple observation: we know how to solve equations that look like
These equations are ``easyββ to solve because they only involved one unknown, that we can solve for using simple algebra. Our strategy will be to develop a systematic way of reducing linear systems, like the example (2) above, into an equivalent system of equations that are easy to solve.
To illustrate, letβs start with the system of three linear equations (2) we introduced above:
Our strategy will be to systematically employ the following very useful observation:
Before continuing, you might try to convince yourself that this observation is true. Our goal is to apply ObservationΒ 1 judiciously to transform the system of linear equations (4) into a much simpler one that is easy to solve but still has the same solutions as the original. Any linear system that is derived from the original system by successive application of such operations will be called an equivalent system. An important property is that equivalent systems have the same solutions.
Our strategy will be to successively eliminate variables in our equations in order of appearance. So, here, our first step is to eliminate the first variable, , from the second equation. Weβll do that by subtracting twice the first equation from the second:
so that now, our equivalent system of linear equations is given by
This system of equations is simpler than (4) because no longer appears in the second equation. We can eliminate from the third equation by subtracting the first equation from it, giving
The equivalent system (7) is even simpler than the original (4): notice that the second and third equations do not involve (by design), and so constitute a system of two linear equations in two unknowns. Moreover, once we have solved this subsystem for and , we can substitute the answer into the first equation, and we need only solve a single linear equation for .
We continue on, with our goal in this next phase to eliminate the second variable, , from the third equation by adding the second equation to it. The result is
which is the simple system we have been working towards. It is in what is called triangular form: the first equation depends on all three variables, the second only depends on the second and third variables, and the last equation involves only the last variable. The process we went through of transforming the original system (4) to the triangular system (8) is an example of Forward Elimination: we work our way down the equations, eliminating variables as we go. Once a system is in triangular form, it can be straightforwardly solved by the method of Back Substitution. As the name suggests, we work backwards, solving the last equation first, which requires that . We substitute the result back into the middle equation, which becomes , with solution . We finally substitute the two values and into the first equation, which becomes , and so the solution to the triangular system (8) is
Even more exciting is that recalling ObservationΒ 1, we know that the triangular system (8) is equivalent to our original system (4), which means that this is also the solution to our original system of equations (you can check). We note that in this case, system (4) has a unique, meaning one and only one, solution. Weβll understand why this is the case later in the semester.
This process was incredibly simple and intuitive: add equations together to eliminate ``downstairsββ variables until you have found an equivalent triangular system, which can then be readily solved via back substitution. Amazingly, barring a few minor complications that can come up from time to time, this is essentially all there is to Gaussian Elimination. This incredibly simple algorithm is also unbelievably important and powerful. After a brief detour to remind ourselves about matrix and vector notation, weβll revisit Gaussian Elimination through the lens of matrix factorization, which will allow us to easily automate and scale out these ideas to systems with hundreds or even thousands of variables.
5Worked ExamplesΒΆ
Weβll see later exactly why we call these equations linear, and the deep implications that linearity has on science and engineering. For now, itβs enough to think of an equation as being linear if the unknowns only appear to the first power, and there are no product terms like or , in it.
Almost all equations that we will encounter in this class will be defined in terms of real numbers. In certain settings, we will need to use complex numbers, but donβt worry, weβll go over how to work with complex numbers carefully then.