Académique Documents
Professionnel Documents
Culture Documents
-1
1
f +x/ dx)
2.3504
Comparing the exact value with the different approximations shows an
exponential decay of the error
8 Lecture_010.nb
2012 G. Baumann
ListLogLogPlot#2, Abs#exact - integral2',
4, Abs#exact - integral4', 8, Abs#exact - integral8',
16, Abs#exact - integral16', Frame - True,
FrameLabel - "M", "e"'
10.0 5.0 2.0 3.0 15.0 7.0
10
4
0.001
0.01
0.1
1
M
e
Solutions of Equations
Systems of simultaneous linear equations occur in solving problems in a wide
variety of disciplines, including mathematics, statistics, the physical, biological,
and social sciences, engineering, and business. They arise directly in solving
real-world problems, and they also occur as part of the solution process for
other problems, for example, solving systems of simultaneous nonlinear
equations. Numerical solutions of boundary value problems and initial boundary
value problems for differential equations are a rich source of linear systems,
especially large-size ones. In this chapter we will examine some classical
methods for solving linear systems, including direct methods such as the
Gauian elimination method, and iterative methods such as the Jacobi method
and Gau-Seidel method.
Lecture_010.nb 9
2012 G. Baumann
2.1 Systems of linear Equations
One of the topics studied in elementary algebra is the solution of pairs of linear
equations such as
a x + b y = c
d x + e y = f
The coefficients a, b, , f are given constants, and the task is to find the
unknown values x, y. In this chapter, we examine the problem of finding
solutions to longer systems of linear equations, containing more equations and
unknowns.
To write the most general system of linear equations that we will study, we must
change the notation used in (0.0) to something more convenient. Let n be a
positive integer. The general form for a system of n linear equations in the n
unknowns x
1
, x
2
, x
3
, x
n
is
a
11
x
1
+a
12
x
2
+... +a
1 n
x
n
= b
1
a
21
x
1
+a
22
x
2
+... +a
1 n
x
n
= b
2
a
m1
x
1
+a
m2
x
2
+... +a
mn
x
n
= b
m
.
The coefficients are given symbolically by a
ij
, with i the number of the equation
and j the number of the associated unknown component. On some occasions,
to avoid possible confusion, we also use the symbol a
i, j
. The right-hand side
b
1
, b
2
, , b
n
are given numbers; and the problem is to calculate the unknowns
x
1
, x
2
, , x
n
. The linear system is said to be of order n.
A solution of a linear equation a
1
x
1
+a
2
x
2
++a
n
x
n
= b is a sequence of n
numbers s
1
, s
2
, s
3
, , s
n
such that the equation is satisfied when we substitute
x
1
= s
1
, x
2
= s
2
, , x
n
= s
n
. The set of all solutions of the equation is called its
solution set or sometimes the general solution of the equation.
A finite set of linear equations in the variables x
1
, x
2
, , x
n
is called a system
of linear equations or a linear system. The sequence of numbers s
1
, s
2
, s
3
, ,
s
n
is called a solution of the system if x
1
= s
1
, x
2
= s
2
, , x
n
= s
n
is a solution
of every equation in the system.
10 Lecture_010.nb
2012 G. Baumann
A system of equations that has no solutions is said to be inconsistent; if there is
at least one solution of the system, it is called consistent. To illustrate the
possibilities that can occur in solving systems of linear equations, consider a
general system of two linear equations in the unknowns x
1
= x and x
2
= y:
a
1
x +b
1
y = c
1
with a
1
, b
1
not both zero
a
2
x + b
2
y = c
2
with a
2
, b
2
not both zero.
The graphs of these equations are lines. Since a point (x, y) lies on a line if and
only if the numbers x and y satisfy the equation of the line, the solutions of the
system of equations correspond to points of intersection of line l
1
and line l
2
.
There are three possibilities, illustrated in Figure 0.0
Lecture_010.nb 11
2012 G. Baumann
l
1
l
2
0 1 2 3 4 5
1.0
0.5
0.0
0.5
1.0
1.5
2.0
2.5
x
y
l
1
l
2
0 1 2 3 4 5
0.0
0.5
1.0
1.5
2.0
2.5
3.0
x
y
l
1
l
2
0 1 2 3 4 5
0.0
0.5
1.0
1.5
2.0
2.5
x
y
Figure 0.0. The three possible scenarios to solve a system of linear equations.
Top a single and unique solution exists, middle no solution exists, and bottom
an infinite number of solutions exists.
The line l
1
and l
2
may intersect at only one point, in which the system has
exactly one solution
The lines l
1
and l
2
may be parallel, in which case there is no intersection and
consequently no solution to the system.
The lines l
1
and l
2
may coincide, in which case there are infinitely many points
12 Lecture_010.nb
2012 G. Baumann
of intersection and consequently infinitely many solutions to the system.
Although we have considered only two equations with two unknowns here, we
will show that the same three possibilities hold for arbitrary linear systems:
Remark 0.0. Every system of linear equations has no solutions, or has exactly
one solution, or has infinitely many solutions.
For linear systems of small orders, such as the system (0.0) it is possible to
solve them by paper and pencil calculations or with the help of a calculator, with
methods learned in elementary algebra. For systems arising in most
applications, however, it is common to have larger orders, from several dozens
to millions. Evidently, there is no hope to solve such large systems by hand. We
need to employ numerical methods for their solutions. For this purpose, it is
most convenient to use the matrix/vector notation to represent linear systems
and to use the corresponding matrix/vector arithmetic for their numerical
treatment.
The linear system of equations (0.0) is completely specified by knowing the
coefficients a
ij
and the right-hand constants b
i
. These coefficients are arranged
as the elements of a matrix:
A =
a
11
a
12
a
1 n
a
21
a
22
a
2 n
a
n1
a
n2
a
nn
We say a
ij
is the (i, j) entry of a matrix A. Similarly, the right-hand constants b
i
are arranged in the form of a vector
b =
b
1
b
2
b
n
The letters A and b are the names given to the matrix and the vector. The
indices of a
ij
now give the numbers of the row and column of A that contain a
ij
.
The solution x
1
, x
2
, , x
n
is written similarly
Lecture_010.nb 13
2012 G. Baumann
x =
x
1
x
2
x
n
With this notation the linear system (0.0) is then written in compact form
A.x = b.
The reader with some knowledge of linear algebra will immediately recognize
that the left-hand side of (0.0) is the matrix multiplied by a vector x, and (0.0)
expresses the equality between the two vectors A.x and b.
The basic method for solving a system of linear equations is to replace the
given system by a new system that has the same solution set but is easier to
solve. This new system is generally obtained in a series of steps by applying
the following three types of operations to eliminate unknowns symbolically:
1. Multiply an equation through by a nonzero constant.
2. Interchange two equations.
3. Add a multiple of one equation to another.
Since the rows (horizontal lines) of an augmented matrix correspond to the
equations in the associated system, these three operations correspond to the
following operations on the rows of the augmented matrix:
4. Multiply a row through by a nonzero constant.
5. Interchange two rows.
6. Add a multiple of one row to another row.
These are called elementary row operations. The following example illustrates
how these operations can be used to solve systems of linear equations. Since a
systematic procedure for finding solutions will be derived in the next section, it
is not necessary to worry about how the steps in this example were selected.
The main effort at this time should be devoted to understanding the
computations and the discussion.
Example 0.0. Using Elementary Row Operations
14 Lecture_010.nb
2012 G. Baumann
In the first line below we solve a system of linear equations by operating on the
equations in the system, and in the same line we solve the same system by
operating on the rows of the augmented matrix.
Solution 0.0.
x +y +2 z = 9
2 x +4 y 3 z = 1
3 x +6 y 5 z = 0
1 1 2 9
2 4 3 1
3 6 5 0
Add 2 times the first equation (row) to the second to obtain which
x +y +2 z = 9
2 y 7 z = 17
3 x +6 y 5 z = 0
1 1 2 9
0 2 7 17
3 6 5 0
Add 3 times the first equation (row) to the third to obtain
x +y +2 z = 9
2 y 7 z = 17
3 y 11 z = 27
1 1 2 9
0 2 7 17
0 3 11 27
Multiply the second equation (row) by 1 f 2 to obtain
x +y +2 z = 9
y
7
2
z =
17
2
3 y 11 z = 27
1 1 2 9
0 1
7
2
17
2
0 3 11 27
Add 3 times the second equation (row) to the third to obtain
x +y +2 z = 9
y
7
2
z =
17
2
1
2
z =
3
2
1 1 2 9
0 1
7
2
17
2
0 0
1
2
3
2
Multiply the third equation (row) by 2 to obtain
x +y +2 z = 9
y
7
2
z =
17
2
z = 3
1 1 2 9
0 1
7
2
17
2
0 0 1 3
Lecture_010.nb 15
2012 G. Baumann
Add 1 times the second equation (row) to the first to obtain
x +
11
2
z =
35
2
y
7
2
z =
17
2
z = 3
1 0
11
2
35
2
0 1
7
2
17
2
0 0 1 3
Add
11
2
times the third equation (row) to the first and
7
2
times the third equation
to the second to obtain
x = 1
y = 2
z = 3
1 0 0 1
0 1 0 2
0 0 1 3
The solution thus is x = 1, y = 2, z = 3.
2.1.1 Gau Elimination Method
We have just seen how easy it is to solve a system of linear equations once its
augmented matrix is in reduced row-echelon form. Now we shall give a step-by-
step elimination procedure that can be used to reduce any matrix to reduced
row-echelon form. As we state each step in the procedure, we shall illustrate
the idea by reducing the following matrix to reduced row-echelon form. To
demonstrate the procedure let us consider the following augmented matrix
0 0 2 0 7 12
2 4 10 6 12 28
2 4 5 6 5 1
Step 1: Locate the leftmost column that does not consist entirely of zeros.
0 0 2 0 7 12
2 4 10 6 12 28
2 4 5 6 5 1
Step 2: Interchange the top row with another row, if necessary, to bring a
nonzero entry to the top of the column found in step 1.
16 Lecture_010.nb
2012 G. Baumann
2 4 -10 6 12 28
0 0 2 0 7 12
2 4 5 6 5 1
Step 3: If the entry that is now at the top of the column found in step 1 is a,
multiply the first row by 1 f a in order to introduce a leading 1.
1 2 -5 3 6 14
0 0 2 0 7 12
2 4 5 6 5 1
Step 4: Add suitable multiples of the top row to the rows below so that all
enters below the leading 1 become zeros.
1 2 5 3 6 14
0 0 2 0 7 12
0 0 5 0 -17 -29
Step 5: Now cover the top row in the matrix and begin again with step 1 applied
to the submatrix that remains. Continue in this way until the entire matrix is in
row-echelon form.
1 2 5 3 6 14
0 0 1 0
-7
2
-6
0 0 5 0 -17 -29
1 2 5 3 6 14
0 0 1 0
7
2
6
0 0 0 0
1
2
1
1 2 5 3 6 14
0 0 1 0
7
2
6
0 0 0 0 1 2
The entire matrix is now in row-echelon form. To find the reduced row echelon
form we need the following additional step.
Step 6: Beginning with the last nonzero row and working upward, add suitable
multiples of each row to the rows above to introduce zeros above the leading
Lecture_010.nb 17
2012 G. Baumann
g
1's.
1 2 5 3 6 14
0 0 1 0
7
2
6
0 0 0 0 1 2
1 2 5 3 6 14
0 0 1 0 0 1
0 0 0 0 1 2
1 2 5 3 0 2
0 0 1 0 0 1
0 0 0 0 1 2
1 2 0 3 0 7
0 0 1 0 0 1
0 0 0 0 1 2
The last matrix is in reduced row-echelon form.
If we use only the first five steps, the above procedure creates a row-echelon
form and is called Gauian elimination. Caring out step 6 in addition to the first
five steps which generates the reduced row-echelon form is called Gau-
Jordan elimination.
Remark 0.0. It can be shown that every matrix has a unique reduced-echelon
form; that is, one will arrive at the same reduced row-echelon form for a given
matrix no matter how the row operations are varied. In contrast, a row-echelon
form of a given matrix is not unique; different sequences of row operations can
produce different row-echelon forms.
In Mathematica there exists a function which generates the reduced-echelon
form of a given matrix. For the example above the calculation is done by
18 Lecture_010.nb
2012 G. Baumann
MatrixForm%RowReduce%
0 0 -2 0 7 12
2 4 -10 6 12 28
2 4 -5 6 -5 -1
))
1 2 0 3 0 7
0 0 1 0 0 1
0 0 0 0 1 2
Example 0.0. Gau-Jordan Elimination
Solve by Gau-Jordan elimination the following system of linear equations
x
1
+5 x
2
3 x
3
+5 x
5
= 1
3 x
1
+7 x
2
4 x
3
x
4
+3 x
5
+2 x
6
= 3
2 x
1
+9 x
2
+9 x
4
+3 x
5
12 x
6
= 7
Solution 0.0. The augmented matrix of this system is
am=
1 5 -3 0 5 0 1
3 7 -4 -1 3 2 3
2 9 0 9 3 -12 7
;
The reduced-echelon form is gained by adding 3 times the first row to the
second row
am=
1 5 -3 0 5 0 1
0 -8 5 -1 -12 2 0
2 9 0 9 3 -12 7
;
Adding in addition 2 times the first row to the third one gives
am=
1 5 -3 0 5 0 1
0 -8 5 -1 -12 2 0
0 -1 6 9 -7 -12 5
;
Interchanging the second with the third row and multiplying the third by 1 will
give
Lecture_010.nb 19
2012 G. Baumann
am=
1 5 -3 0 5 0 1
0 1 -6 -9 7 12 -5
0 -8 5 -1 -12 2 0
;
A multiple of the second row of 8 will give
am=
1 5 -3 0 5 0 1
0 1 -6 -9 7 12 -5
0 0 -43 -73 44 98 -40
;
Division of the last row by 43 gives
am=
1 5 -3 0 5 0 1
0 1 -6 -9 7 12 -5
0 0 1
73
43
-44
43
-98
43
40
43
;
Adding a multiple of 6 of the third row to the second row produces
am=
1 5 -3 0 5 0 1
0 1 0
51
43
37
43
-72
43
25
43
0 0 1
73
43
-44
43
-98
43
40
43
;
Three time the last row added to the first row generates
am=
1 5 0
219
43
83
43
-294
43
163
43
0 1 0
51
43
37
43
-72
43
25
43
0 0 1
73
43
-44
43
-98
43
40
43
;
5 times the second row added to the first row gives
20 Lecture_010.nb
2012 G. Baumann
am=
1 0 0 -
36
43
-
102
43
66
43
38
43
0 1 0
51
43
37
43
-72
43
25
43
0 0 1
73
43
-44
43
-98
43
40
43
;
The same result is generated by
MatrixForm#RowReduce#am''
1 0 0
36
43
102
43
66
43
38
43
0 1 0
51
43
37
43
72
43
25
43
0 0 1
73
43
44
43
98
43
40
43
The same augmented matrix a
m
can be treated by a function which prints the
intermediate steps.
MatrixForm#am'
1 5 3 0 5 0 1
3 7 4 1 3 2 3
2 9 0 9 3 12 7
The application of the function GaussJordanForm to the matrix a
m
is shown in
the following lines. On the left of the matrix the operations carried out on rows
are stated
GaussJordanForm#am' ss MatrixForm
Forward pass
(Row 2)-(3)*(Row 1)
1 5 3 0 5 0 1
0 8 5 1 12 2 0
2 9 0 9 3 12 7
(Row 3)-(2)*(Row 1)
1 5 3 0 5 0 1
0 8 5 1 12 2 0
0 1 6 9 7 12 5
Lecture_010.nb 21
2012 G. Baumann
(Row 2)/(8)
1 5 3 0 5 0 1
0 1
5
8
1
8
3
2
1
4
0
0 1 6 9 7 12 5
(Row 3)-(1)*(Row 2)
1 5 3 0 5 0 1
0 1
5
8
1
8
3
2
1
4
0
0 0
43
8
73
8
11
2
49
4
5
(Row 3)/(
43
8
)
1 5 3 0 5 0 1
0 1
5
8
1
8
3
2
1
4
0
0 0 1
73
43
44
43
98
43
40
43
Backward pass
(Row 1)-(3)*(Row 3)
1 5 0
219
43
83
43
294
43
163
43
0 1
5
8
1
8
3
2
1
4
0
0 0 1
73
43
44
43
98
43
40
43
(Row 2)-(
5
8
)*(Row 3)
1 5 0
219
43
83
43
294
43
163
43
0 1 0
51
43
37
43
72
43
25
43
0 0 1
73
43
44
43
98
43
40
43
(Row 1)-(5)*(Row 2)
1 0 0
36
43
102
43
66
43
38
43
0 1 0
51
43
37
43
72
43
25
43
0 0 1
73
43
44
43
98
43
40
43
1 0 0
36
43
102
43
66
43
38
43
0 1 0
51
43
37
43
72
43
25
43
0 0 1
73
43
44
43
98
43
40
43
in a single step. The result is that there are three leading variables x
1
, x
2
and x
3
which are determined by x
4
, x
5
, and x
6
22 Lecture_010.nb
2012 G. Baumann
2.1.2 Operations Count
It is important to know the length of a computation and, for that reason, we
count the number of arithmetic operations involved in Gau-Jordan elimination.
For reasons that will be apparent in later sections, the count will be divided into
three parts.
Table 0.0. The following Table contains the number of operations for each of
the steps in the elimination.
Step Additions Multiplications Divisions
1 (n1)
2
(n 1)
2
n 1
2 (n2)
2
(n 2)
2
n 2
n 1 1 1 1
Total
n(n1) (2 n1)
6
n(n1) (2 n1)
6
n(n1)
2
The elimination step. We count the additions/subtractions (A,S),
multiplications (M), and the divisions (D) in going from the original system to the
triangular system. We consider only the operations for the coefficients of A and
not for the right-hand side b. Generally the division and multiplications are
counted together, since they are about the same in operation time. Doing this
gives us
AS =
n (n 1) (2 n1)
6
MD =
n (n 1) (2 n1)
6
+
n (n 1)
2
=
1
3
n |n
2
1]
AS denotes the number of addition and subtraction and MD denotes that of
multiplication and division.
Modification of the right side b. Proceeding as before, we get
AS = (n 1) +(n 2) ++1 =
n(n 1)
2
Lecture_010.nb 23
2012 G. Baumann
MD = (n1) +(n 2) ++1 =
n(n 1)
2
The back substitution step. As before
AS = 0 +1++(n 1) =
n(n1)
2
MD = 1 +2++n =
n(n +1)
2
.
Combining these results, we observe that the total number of operations to
obtain x is
AS =
n(n 1) (2 n1)
6
+
n(n 1)
2
+
n(n 1)
2
=
n(n 1) (2 n+5)
6
MD =
n|n
2
+3 n1]
3
Since AS and MD are almost the same in all of these counts, only MD is
discussed. These operations are also slightly more expensive in running time.
For large values of n, the operation count for Gau-Jordan elimination is about
n
3
3. This means that as n is doubled, the cost of solving the linear system
goes by a factor of 8. In addition, most of the cost of Gau-Jordan elimination
is in the elimination step since for the remaining steps
MD =
n(n 1)
2
+
n(n+1)
2
= n
2
.
Thus, once the elimination steps have been completed, it is much less
expensive to solve the linear system.
Consider solving the linear system
A.x = b
where A has order n and is non singular. Then A
1
exists and
A
1
.|A.x] = A
1
.b
24 Lecture_010.nb
2012 G. Baumann
x = A
1
.b.
Thus, if A
1
is known, then x can be found by matrix multiplication.
For this, it might at first seem reasonable to find A
1
and to solve for x. But this
is not an efficient procedure, because of the great cost needed to find A
1
. The
operations cost for finding A
1
can be shown to be
MD = n
3
.
This is about three times the cost of finding x by the Gau-Jordan elimination
method. Actually there is no savings in using A
1
.
The chief value of A
1
is a theoretical tool for examining the solution of non
singular systems of linear equations. With a few exceptions, one seldom needs
to calculate A
1
explicitly.
2.1.3 Iterative Solutions
The linear system A.x = b that occur in many applications can have a very large
order. For such systems, the Gauian elimination method is often too
expensive in either computation time or computer memory requirements, or
possibly both. Moreover the accumulation of round-off errors can sometimes
prevent the numerical solution from being accurate. As an alternative, such
linear systems are usually solved with iteration methods, and that is the subject
of this section.
In an iterative method, a sequence of progressively accurate iterates is
produced to approximate the solution. Thus, in general, we do not expect to get
the exact solution in a finite number of iteration steps, even if the round-off error
effect is not taken into account. In contrast, if round-off errors are ignored, the
Gauian elimination method produces the exact solution after (n 1) steps of
elimination and backward substitution for the resulting upper triangular system.
Gauian elimination method and its variants are usually called direct methods.
In the study of iteration methods, a most important issue is the convergence
property. We provide a framework for the convergence analysis of a general
iteration method. For the two classical iteration methods, the Jacobi and Gau-
Seidel methods, studied in this section, a sufficient condition for convergence is
stated.
Lecture_010.nb 25
2012 G. Baumann
We begin with some numerical examples that illustrate to popular iteration
methods. Following that, we give a more general discussion of iteration
methods. Consider the linear system
9 x
1
+x
2
+x
3
= b
1
2 x
1
+10 x
2
+3 x
3
= b
2
3 x
1
+4 x
2
+11 x
3
= b
3
One class of iteration methods for solving (0.0) proceeds as follows. In the
equation numbered k, solve for x
k
in terms of the remaining unknowns. In the
above case,
x
1
=
1
9
(b
1
x
2
x
3
)
x
2
=
1
10
(b
2
2 x
1
3 x
3
)
x
3
=
1
11
(b
3
3 x
1
4 x
2
)
Let x
(0)
= {x
1
(0)
, x
2
(0)
, x
3
(0)
T
be an initial guess of the true solution x. Then define
an iteration sequence:
x
1
(k+1)
=
1
9
b
1
x
2
(k)
x
3
(k)
x
2
(k+1)
=
1
10
b
2
2 x
1
(k)
3 x
3
(k)
x
3
(k+1)
=
1
11
b
3
3 x
1
(k)
4 x
2
(k)
Lecture_010.nb 33
2012 G. Baumann