As you may already have noticed, Matlab normally uses decimal fraction representations of numbers. In the computations of this and later chapters, which will involve rational numbers, it is natural to enter the command `format rat', so that all fractions that occur will be displayed as common fractions rather than decimals. However, `format rat' affects only the displays of Matlab, not its computations. All computations are still done with (extremely accurate) decimal approximations. This fact about Matlab computations leads to some surprises that imply that the algorithms we have been using up to now cannot be applied using Matlab when the matrices have rational number entries. Briefly put, the reason is that the algorithms need to know whether or not two numbers are equal, and this is impossible to determine when the numbers are only known approximately.
Fortunately, this is no real problem, because, as is explained in Chapter 6, the needed computations can always be carried out on matrices of integers. All that is needed is to put all the fractions over a common denominator, so that the computation becomes a computation with integers such as we have been doing all along.
Let A and Y be given matrices with the same number of rows. If n is a nonzero number, then a matrix X satisfies AX = Y if and only if it satisfies nAX = nY. If A and/or Y contains fractions, n can be taken to be a common denominator of all the fractions, so the solutions of the matrix division problem AX = Y coincide with the solutions of the matrix division problem (nA)X = nY, in which the matrices have integer entries. Therefore, the solution of the problem of division on the left that was given in Chapter 3 can be used to solve AX = Y even when the entries of A and Y are fractions---you need only multiply A and Y by a common denominator.
If matrices are allowed to have rational entries, a change does occur, however, at the step at which one finds the most general solution Z of DZ = MY. The change is simple: The condition that the ith row of MY be divisible by the ith diagonal entry of D no longer applies. A solution exists whenever the other conditions are met (the ith row of MY is zero whenever the ith row of D is zero, and all rows of MY past the nth row are zero); its ith row is the ith row of MY divided by the ith diagonal entry of D whenever the ith diagonal entry of D is nonzero and its other rows are arbitrary.
Apply this method to find the most general solution of AX = I, that is, to find the most general right inverse of A for various matrices A.
Return to Table of Contents.