Using MatLab, compute H^-1H for various n between 5 and 15. Describe the results and comment on the difference between the MatLab output and what is expected the answer to be (given that H is invertible for all n). At what point does Matlab give a warning indicating that it may not be giving the correct answer?
Try using the rref function to reduce H=hilb(n) for various n. What is expected for an invertible matrix? Describe how results differ from this. Does this shed light on why MatLab has difficulty with the calculation? Please explain.
HINT: The idea behind this problem is that MATLAB is not perfect at performing computations and the solutions it obtains are by no means exact. This problem involves doing computations on a special class of matrices called Hilbert matrices. Each Hilbert matrix is invertible. Thus, if H is a Hilbert matrix, and if inv(H) is the inverse of H, then inv(H) * H = H * inv(H) = I, where I is the identity matrix. As long as H is invertible (which it always will be), this identity will always be true regardless of the size of the matrices. Now do this exact computation in MATLAB with Hilbert matrices of various sizes. What do you notice? Try to explain your results by thinking about how computers deal with / store numbers (hint: think about digits).
The way to do part b is similar. If A is an invertible matrix, what should the result be if you do rref(A) in MATLAB? Do this with Hilbert matrices of various sizes and see what happens. In particular, try this with Hilbert matrices of size 11x11 and then 12x12. Look at the bottom row. What can you say about an inverse in this case?
The attached Matlab script creates Hilbert matrices, H, of rank from 5 to 15, and examines the numerical errors in two graphical ways.
One is calculating the difference between H^-1H and the unit matrix of the same rank and using its norm, ...
This provides an example of investigating how round-off error might affect the numerical calculations involving certain matrices using Matlab.