HP 15c User Manual

Page 83

Advertising
background image

Section 4: Using Matrix Operations

83

Row interchanges can also reduce rounding errors that can occur during the calculation of the
decomposition.

The HP-15C uses the Doolittle method with extended-precision arithmetic to construct the
LU decomposition. It generates the decomposition entirely within the result matrix. The LU
decomposition is stored in the form

L

U

It is not necessary to save the diagonal elements of L since they are always equal to 1. The
row interchanges are also recorded in the same matrix in a coded form not visible to you. The
decomposition is flagged in the process, and its descriptor includes two dashes when
displayed.

When you calculate a determinant or solve a system of equations, the LU decomposition is
automatically saved. It may be useful to use the decomposed form of a matrix as input to a
subsequent calculation. If so, it is essential that you not destroy the information about row
interchanges stored in the matrix; don't modify the matrix in which the decomposition is
stored.

To calculate the determinant of a matrix, A for example, the HP-15C uses the equation
A = P

−1

LU, which allows for row interchanges. The determinant is then just (−1)

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

A

−1

= (P

−1

LU)

−1

= U

−1

L

−1

P.

It does this by first decomposing matrix A, inverting both L and U, calculating their product
U

−1

L

−l

, 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 LU 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 LU decomposition can be used in lieu of
the original matrix as input to these calculations.

Advertising