Chapter 10. The Spectral Theorem

The partition of unity I = P + Q at the beginning of the examples section (bottom of page 125) can easily be constructed using Matlab by entering A = [1;2;1], P = A*pinv(a), and Q = eye(3) - P. The answers will take the form given in the book, of course, only after you enter `format rat.' (Even then, Matlab will write 1/3 and 2/3, not 2/6 and 4/6.) Note that trace(P) = 1 and trace(Q) = 2.

As is to be expected, if you check the conditions P*P = P, Q*Q = Q, and PQ = 0 you will get asterisks instead of zeros, indicating that the fractions given by `format rat' are not the numbers with which Matlab is computing. The exact matrices P and Q cannot in most cases, be represented in Matlab, but you can deal with the exact matrices, if you like, by finding a common denominator of the entries and the matrix of integers that results when the matrix is multiplied by this common denominator. In the case above, for example, it is clear from inspection that 6 is a common denominator of the entries of P and Q. Setting Pr = round(6*P) and Qr = round(6*Q) then gives matrices that satisfy Pr*Pr = 6*Pr, Qr*Qr = 6*Qr, Pr*Qr = 0 exactly.

To partition Q into Q1 + Q2 as is done in the book (page 126), enter A = Q(:,2) (defines A to be the second column of Q), Q1 = A*pinv(A), and Q2 = Q - Q1. The symmetric matrix S = 6*P + 3*Q1 + 2*Q2 is then found in one step. The characteristic polynomial of S can then be found immediately by entering poly(S). (The Matlab function `poly' gives the characteristic polynomial of a square matrix.) Although the expected characteristic polynomial will be shown as the result, bear in mind that the coefficients computed by Matlab are not the exact integers, as you will find if you look at them in `format long.'

To go the other way---to start with S and construct the spectral representation of S---the natural first step is to use the Matlab function eig(S) which finds the "eigenvalues" of S, that is, the roots of the characteristic polynomial. In this case, Matlab will instantly tell you that these roots are (of course) 6, 3, 2. To find the spectral representation of S, one needs to find the orthogonal projection corresponding to each of these roots, which is also easy using Matlab. For example, the projection corresponding to 6 is found by entering G1 = (S - 3*eye(3))*(S - 2*eye(3)) and then G1*pinv(G1), to find P.

(The computation of the mate (pinv) of a matrix can be very sensitive to roundoff error, as you will find if you do this example with an approximate, rather than an exact, value of S. The problem is that roundoff error can cause Matlab to find a too large value for the rank of the matrix, which throws off the computation of the mate. This problem can be averted by computing with exact values, or by omitting redundant columns so that the computation involves finding the mate of a matrix whose rank is equal to the number of columns.)

Verify that S*((1/6)*P + (1/3)*Q1 + (1/2)*Q2) is the identity matrix.

Return to Table of Contents.