# How to directly compute the inverse of an ill-conditioned dense matrix

I know that it is generally a bad idea to compute the inverse matrix directly. However, if it is necessary to compute the inverse of an ill-conditioned invertible dense matrix, then what can I try?

For example, I know that scaling a matrix may decrease the condition number of it. This may be an example of preconditiong, but I don't know much about the theory of preconditioners.

I also know that the computation technique can be varied depending on properties of the matrix. Questions posted on this site (e.g., 1, 2, 3) have their specific answer, not a general one.

But I can't find the general principle to compute the inverse because I am new to this field. What properties of the matrix should I check to reduce the condition number? Is there any strategy, or, any books/papers which explain more accurate methods to compute the inverse directly?

(I don't know if there is a short answer of this. Feel free to close this question as too broad.)

I would use the term badly-conditioned instead of ill-conditioned. For badly conditioned matrices, you might opt in the SVD-route to calculate the inverse: $$A=U\Sigma V^H \implies A^{-1}=V\Sigma^{-1}U^H.$$ If your matrix $$A$$ is actually badly conditioned, you still should be able to perform $$\Sigma^{-1}$$. However, you see a problem right away: if the condition number is large (ill-conditioning), the relation of $$\sigma_1/\sigma_N$$ is huge ($$\sigma_1,\ldots,\sigma_N$$ being the singular values of $$A$$, the entries constituting a diagonal matrix $$\Sigma$$, where $$\sigma_1\ge\sigma_2\ge\ldots\ge \sigma_N$$).
This approach also enables (and is close by virtue of $$^{-1}\to ^{+}$$) to use a notion of a pseudo-inverse $$A^{+}$$: $$A^+=V\Sigma^{+}U^H$$ Now, only non-zero elements of $$\Sigma$$ are "reciprocated", and you can filter out too small singular values and singular values based on some tolerance (truncated SVD). Again, that does not help the ill-conditioning of the original problem in any way, just offers a way to compute something that should be avoided in a more accurate way.