Return the inverse of a Hilbert matrix of order n. This can be computed exactly using
The validity of this formula can easily be checked by expanding the binomial coefficients in both formulas as factorials. It can be derived more directly via the theory of Cauchy matrices: see J. W. Demmel, Applied Numerical Linear Algebra, page 92.
Compare this with the numerical calculation of
inverse (hilb (n))
, which suffers from the ill-conditioning of the Hilbert matrix, and the finite precision of your computer's floating point arithmetic.