How to invert a matrix by computer with out so much errors

479 Views Asked by At

I was trying to find the inverse of a positive definite matrix with high dimension by computer. However, I tried even for a $5 \times 5$ matrix I cannot invert it correctly. I multiplied the original matrix and the inverse of it returned by the computer, the result is quite close to the identity matrix but not exactly the identity matrix.

Is there better ways (better algorithm etc.) to find the inverse by computer?

2

There are 2 best solutions below

2
On BEST ANSWER

If a package can give you an approximate inverse to $A,$ call the approximation $X,$ an improvement can be found by $$ g(X) = 2X - XAX $$

You are concerned about $AX-I;$ it has small entries but is not quite zero. $$ A g(X) - I = A(2X - XAX) - I = -AXAX + 2AX - I = -(AX-I)^2 $$

That is, using some submultiplicative norm for matrices, as soon as $|AX-I|$ is significantly smaller than $1,$ the improvement is considerable.

ADDED: a piece of luck. In the strange world of numerical matrices, you are also worried about $XA-I.$ However, $$ g(X) A - I = (2X - XAX)A - I = -XAXA + 2XA - I = -(XA-I)^2 $$

0
On

If your matrix is ill-conditioned you can use regularization. There is the truncated-SVD.

$$ A_{k} = U_{m \times k} \Sigma_{k \times k} V_{k \times n}^{T} \tag{1} $$

then the pseudo inverse is given as

$$ A^{\dagger} = V\Sigma^{\dagger} U^{T} \tag{2}$$

The pseudoinverse is already a command in matlab. It is pinv(A)