Chapter 4
Linear algebra in Matlab
Mathematical problems involving equations of the form
Ax=b,
where
A
is a matrix and
x
and
b
are both column vectors are problems in
linear algebra
, sometimes also called
matrix algebra
. Engineering and scientific and disciplines are rife with such problems.
Thus, an understanding of their set-up and solution is a crucial part of the education of
many engineers and scientists. As we will see in this brief introduction, Matlab provides a
powerful and convenient means for finding solutions these problems, but, as we will also
see, the solution is not always what it appears to be.
4.1 Solution difficulties
The most common problems of importance are those in which the unknowns are the
elements of
x
or the elements of
b
. The latter problems are the simpler ones. The former
are fraught with many difficulties. In some cases, the “solution”
x
may in fact not be a
solution at all! This situation obtains when there is conflicting information hidden in the
inputs (i.e.,
A
and
b
), and the non-solution obtained is a necessary compromise among
them. That compromise solution may be a perfectly acceptable approximation, even
though it is not in fact a solution to the equations. In other cases Matlab’s result may be a
solution, but, because of small errors in
A
or
b
, it may be completely different from the
exact solution that would be obtained were
A
and
b
exact. This situation can have a
serious impact on the application at hand. The elements of
A
and
b
are typically
measurements made in the field, and even though much time, effort, and expense goes
into reducing the error of those measurements, the calculated
x
may have an error that is
so large as to render those measurements useless. This situation occurs when the solution
x
is highly sensitive to small changes in
A
and
b
, and it is just as important, or in many
cases more important, than the problem of the approximate non-solution.
Neither of these problems is Matlab’s “fault”, nor would it be the fault of any other
automatic solver that you might employ. It is the nature of linear algebra. The person who
relies on a solution to
Ax = b
provided by Matlab, or by any other solver, without
investigating the sensitivity of the solution to errors in the input, is asking for trouble, and
will often get it. When accuracy is critical (and it usually is), the reliability of the solution
must be investigated, and that investigation requires some understanding of linear
algebra. The study of linear algebra can be life-long, and there are many books and
courses, both undergraduate and graduate, on the subject. While it is not possible for
every engineer and scientist to master the subject, it is possible for him or her to be aware
of the nature of the difficulties and to learn how to recognize them in his or her discipline.
The goals of this chapter are to give you some insight into the nature of the difficulties