Chapter 7. The Method of Least Squares

The first example in Chapter 7 (page 73) gives the `solution' X of AX = Y when A and Y are the 2x1 matrices with entries 3, 2 and 2, 1 respectively. It can be computed with Mathlab simply by entering the matrices A and Y and then entering inv(A'*A)*A'*Y. You are unlikely to recognize the answer as 8/13, however, unless you specify `format rat.' (Note that A' means the transpose of A to Matlab.)

Actually, finding this `solution' is even easier, because Matlab has a function that computes the mate of any given matrix, namely, the function pinv (which stands for pseudo-inverse). Thus, instead of inv(A'*A)*A'*Y, you can simply enter pinv(A)*Y. In the same way, if A and Y are any two matrices with the same number of rows, the best approximate solution X of AX = Y is found by entering A and Y and then entering X = pinv(A)*Y.

Because computations with mates involve matrices with rational number entries, and because Matlab computations with rational numbers involve approximations, it is to be expected that roundoff errors will arise. For example, if you enter a matrix A and compute its mate using B = pinv(A) you will find that A*B*A looks like A, but that entering A - A*B*A will not normally result in a matrix of zeros. The task of producing the exact mate of a given A leads to some interesting computations.

When A is a matrix that has a right inverse, the mate of A is the `best' right inverse of A. There are ways to use Matlab to see computationally the meaning of this statement.

The proof of the theorem of Section 7.4 is simplified in a revision.

Return to Table of Contents.