98
Section
4:
Using
Matrix
Operations
To
calculate
the
determinant
of a
matrix,
A for
example,
the
HP-15C
uses
the
equation
A =
P^LU,
which allows
for row
interchanges.
The
determinant
is
then just
(-l)r
times
the
product
of
the
diagonal elements
of U,
where
r is the
number
of row
interchanges.
The
HP-15C calculates
this
product with
the
correct
sign
after
decomposing
the
matrix.
If the
matrix
is
already
decomposed,
the
calculator just computes
the
signed product.
It's easier
to
invert
an
upper-
or
lower-triangular matrix
than
a
general
square matrix.
The
HP-15C calculates
the
inverse
of a
matrix,
A for
example, using
the
relationship
It
does
this
by
first
decomposing
matrix
A,
inverting both
L and U,
calculating their product
U^Lf1,
and
then interchanging
the
columns
of the
result.
This
is all
done within
the
result
matrix
—
which
could
be A
itself.
If A is
already
in
decomposed
form,
the
decomposition
step
is
skipped. Using
this
method,
the
HP-15C
can
invert
a
matrix without using additional storage registers.
Solving
a
system
of
equations, such
as
solving
AX — B for X, is
easier with
an
upper-
or
lower-triangular system matrix
A
than
with
a
general square matrix
A.
Using
PA
—
LU, the
equivalent
problem
is
solving
LUX
=
PB for X. The
rows
of B are
interchanged
in the
same
way
that
the
rows
of the
matrix
A
were
during decomposition.
The
HP-15C solves
LY = PB for Y
(forward
substitution)
and
then
UX = Y for X
(backward substitution).
The
L
C7
form
is
preserved
so
that
you can
find
the
solutions
for
several
matrices
B
without
reentering
the
system matrix.
The
LU
decomposition
is an
important intermediate step
for
calculating determinants, inverting matrices,
and
solving linear
systems.
The L U
decomposition
can be
used
in
lieu
of the
original
matrix
as
input
to
these calculations.
Ill-Conditioned
Matrices
and
the
Condition Number
In
order
to
discuss errors
in
matrix calculations, it's
useful
to
define
a
measure
of
distance between
two
matrices.
One
measure
of the