3

I have the following matrix:

$$ \left( \begin{array}{ccc} 13 & 9.1 & 8.19 & 8.281 & 8.9271\\ 9.1 & 8.19 & 8.281 & 8.9271 & 10.02001\\ 8.19 & 8.281 & 8.9271 & 10.02001 & 11.562759\\ 8.281 & 8.9271 & 10.02001 & 11.562759 & 13.6147921\\ 8.9271 & 10.02001 & 11.562759 & 13.6147921 & 16.27802631\end{array} \right) $$

When I find the inverse of this matrix on Excel, I get:

$$ \left( \begin{array}{ccc} 5.657342657 & -48.60139861 & 124.4172494 & -122.3776224 & 40.79254079\\ -48.6013986 & 467.9916897 &-1266.958328 & 1288.221582 & -438.9197404\\ 124.4172494 & -1266.958328 & 3565.198078 & -3723.319165 & 1293.334933\\ -122.3776224 & 1288.221582 & -3723.319165 & 3967.84588 & -1399.744047\\ 40.79254079 & -438.9197404 & 1293.334933 & -1399.744047 & 499.9085881\end{array} \right) $$

These values are not exact values. I can indefinitely keep adding more and more decimal places on Excel - However, I need exact values (in the form of a fraction).

I tried converting the values in the initial matrix into fractions before inverting it (the following matrix), but had no luck:

$$ \left( \begin{array}{ccc} 130/10 & 91/10 & 819/10^2 & 8281/10^3 & 89271/10^4\\ 91/10 & 819/10^2 & 8281/10^3 & 89271/10^4 & 1002001/10^5\\ 819/10^2 & 8281/10^3 & 89271/10^4 & 1002001/10^5 & 11562759/10^6\\ 8281/10^3 & 89271/10^4 & 1002001/10^5 & 11562759/10^6 & 136147921/10^7\\ 89271/10^4 & 1002001/10^5 & 11562759/10^6 & 136147921/10^7 & 1627802631/10^8\end{array}\right) $$

How can I get an exact inverse? I'd like to do some matrix multiplication with the exact inverse, and so a method to do that would also be much appreciated.

  • why do you need it? usually there are faster and more stable computational methods than working with the inverse directly – gt6989b Jul 31 '16 at 02:31
  • Multiplying the inverse with another matrix gives me a 1x5 matrix with the coefficients of a fifth order polynomial (regression). Seven decimal places (as in the second matrix above) were not enough for my purposes. – StopReadingThisUsername Jul 31 '16 at 02:33

2 Answers2

3

The inverse is:

$$\begin{pmatrix} \dfrac{809}{143} & -\dfrac{6950}{143} & \dfrac{53375}{429} & -\dfrac{17500}{143} & \dfrac{17500}{429} \\ -\dfrac{6950}{143} & \dfrac{95565775}{204204} & -\dfrac{110879125}{87516} & \dfrac{9395000}{7293} & -\dfrac{9603125}{21879} \\ \dfrac{53375}{429} & -\dfrac{110879125}{87516} & \dfrac{312011875}{87516} & -\dfrac{81462500}{21879} & \dfrac{28296875}{21879} \\ -\dfrac{17500}{143} & \dfrac{9395000}{7293} & -\dfrac{81462500}{21879} & \dfrac{28937500}{7293} & -\dfrac{30625000}{21879} \\ \dfrac{17500}{429} & -\dfrac{9603125}{21879} & \dfrac{28296875}{21879} & -\dfrac{30625000}{21879} & \dfrac{10937500}{21879} \end{pmatrix} $$

In Mathematica code, this is simply:

 mat = {{130/10,91/10,819/10^2,8281/10^3,89271/10^4}, {91/10,819/10^2,8281/10^3,89271/10^4,1002001/10^5},{819/10^2,8281/10^3,89271/10^4,1002001/10^5,11562759/10^6},{8281/10^3,89271/10^4,1002001/10^5,11562759/10^6,136147921/10^7},{89271/10^4,1002001/10^5,11562759/10^6,136147921/10^7,1627802631/10^8}}

 Inverse[mat]
Moo
  • 11,311
1

Glance at the derivations of the normal equations for least squares regression and can see a relatively numerically stable way to get the fitted values for the given X axis data points if don't care about accurate values for the coefficients. This works even if are 'overfitting'.

Under mild assumptions, the normal equations matrix for polynomial fitting is the notoriously ill-conditioned Hilbert matrix.

But look in IIRC (with TeX mark-up)

George E.\ Forsythe and Cleve B.\ Moler, {\it Computer Solution of Linear Algebraic Systems,/} Prentice-Hall, Englewood Cliffs, 1967.\ \

for how to use a family of orthogonal polynomials found for the given X axis values and then do the fit with those polynomials. The fitting is easy just by projections using inner products. It's more stable numerically than via the normal equations.

If want exact matrix inversion, then can get that with just normal machine whole number arithmetic via some simple number theoretic techniques. First for the given matrix, multiply by a power of 10 to yield all whole numbers. Then pick a sufficiently long list of single precision integer prime numbers. Then for each prime in the list, find the inverse in the finite field of integers modulo that prime. Get multiplicative inverse from the Euclidean greatest common divisor algorithm. Then at the end put the multiple precision rational answers back together using the Chinese remainder theorem. Details are in (with TeX mark-up):

Morris Newman, ``Solving Equations Exactly,'' {\it Journal of Research of the National Bureau of Standards -- B.\ Mathematics and mathematical {\it Physics,/} volume 71B, number 4, October-December, 1967, pages 171-179.\ \

Numerical accuracy in fitting is an old challenge. All of the above is from early in my career.

Pollux
  • 11