Let A be the 3x3 matrix in the examples section (page 75) with diagonal entries -3, -1, -3 and with 1 in the remaining entries. Enter A and give the command B = pinv(A). The response, in format rat, will be the mate of A given on page 75, except that the fraction 8/72 will be given in lowest terms 1/9. However, the matrix B that is defined in this way is not the exact mate of A, as you will find if you give the command A - A*B*A.
The display of the mate of A in format rat gives good reason to believe that the denominator of the mate of A is 72. Thus, it is reasonable to guess that the exact mate of A is C/32, where C is found by Matlab using C = round(72*pinv(A)). That this guess is correct can be verified by computing A*C*A - 72*A, C*A*C - 72*C, A*C - (A*C)', and C* A - (C*A)' and finding that all four are zero.
The same method can be used to find the exact mate of other matrices A with integer entries. Just compute pinv(A) in format rat and guess a common denominator of the resulting matrix. (In doing this, you might want to make use of the Matlab function `lcm', which gives the least common multiple of two integers. For example, lcm(72,9) = 72 was used in the example above.) If the guess of a common denominator d is correct, then the command C = round(d*pinv(A)) will give a matrix such that C/d is the exact mate of A. That the matrix C you have found has this property can be checked by checking that A*C*A - d*A, C*A*C - d*C, A*C - (A*C)', and C*A - (C*A)' are all zero. (Note that when A is not square these 4 matrices have 4 different sizes.)
Try this for a few matrices A with integer entries. You will need to pick fairly simple examples in order to have the common denominator be a number that is not too large.
The example of the 2x4 matrix A whose rows are 3, 7, 2, 6 and 10, 9, 8, 7 brings to light an interesting phenomenon. The least common denominator of the entries of B = pinv(A) is the least common multiple of 6011, 3027, 2608, and 1998. The sequence of commands lcm(6011,3027), lcm(ans,2608), lcm(ans,1998) gives the smallest common denominator of the entries shown in B. It is 15801960413808. With this value of d, the entries of C = d*B are too large to be displayed in format rat (if you enter `format long' you can see what they are) but Matlab nonetheless remembers them exactly, not as approximations, and you will find that A*C*A - d*A and the other test matrices are all zero, as expected. (To check that this is not an accident or a result of roundoff error, note that adding or subtracting 1 to an entry of C results in a matrix that no longer works.) But, if you reflect on the computation of the mate of A, you will realized that the least common denominator of its entries cannot possibly be a number with 14 digits! See if you can discover the reason that this number occurred. (Hint: Compare the decimal fractions 352/3027 and 699/6011 and think about the meaning of format rat.) Find the exact mate of this A in another way by finding the exact inverse of AA' (which is the exact mate of AA') and multiplying it on the left by A'.
Return to Chapter 7.