Calculations of First Example

Let U = xI - A and V = xI - B. These two matrices in long format can be generated by entering the following commands (on separate lines): A = diag([1 2]), U = xminusa(A);ldisp(U), P = [3 1;5 3], B = P*A*inv(P), T = eye(2), BN = round(4*B), V = penter(2,4,[4*T(:) -BN]);ldisp(V).

Once U and V are entered, the matrices M1, N1, M2, N2 for which M1(xI - A)N1 and M2(xI - B)N2 can be found by [D,M1,N1] = pquick(U);ldisp(D) and [D,M2,N2] = pquick(V);ldisp(D). The matrix M in the middle of page 104 is M2 inverse times M1. Since M2 is unimodular, its inverse can be found by entering [D,M3,N3] = pquick(M2); and noting that the inverse of M2 is the product of N3 and M3, in that order. Therefore, the matrix M in the middle of page 104 is given in long format by M = pmult(N3,pmult(M3,M1)); ldisp(M).

Since the polynomials in M have degree at most 2, the three coefficient matrices of M can be read off, and entered, in order to compute the matrix R1 found at the bottom of page 104. This computation can be done using Matlab as follows.

Let MN0, MN1, and MN2 be the three 2x2 matrices that contain the numerators (the denominators are 4) of the coefficients of x to the power 2, 1, 0 in the matrix M. They can be found using the commands MN0 = reshape(M(3:6,1),2,2), MN1 = reshape(M(3:6,2),2,2), MN2 = reshape(M(3:6,3),2,2). (Do not forget to make use of the up arrow key to enter these mostly repetitive commands more easily.) Here M(3:6,1) is the 4x1 matrix in rows 3 through 6 and column 1 of M, and the command reshape(A,2,2) `reshapes' it as a 2x2 matrix. Then the command R1 = (1/4)*(B*B*MN0 + B*MN1 + MN2) computes R1 (with some roundoff error). Check that this matrix indeed satisfies B = R1*A*inv(R1).

Note that the very different matrices P and R1 both demonstrate the similarity of A and B. That is, B = P*A*inv(P) = R1*A*inv(R1). Many other matrices have this same property.

The same steps make it possible, at least in principle, to find a solution R1 of B = R1*A*inv(R1) whenever A and B are square matrices of rational numbers for which xI - A is equivalent to xI - B.

Return to Chapter 9.