# Methods for obtaining inverses of matrices $\mod p$ and comparisons to methods for inverses of regular matrices

I have read through many of the methods on Wikipedia listed under (https://en.m.wikipedia.org/wiki/Invertible_matrix) for obtaining inverses of regular matrices.

I would like to know which if any of these methods can be used to calculate an inverse of a matrix $\mod p$?

If any of the methods stated can be used, please advise why & provide an example. Similarly if none of the methods can be used.

• In any field Gaussian elimimination works, and Cramer's rule too (but that's quite inefficient). I think series and approximations will not work over a finite field (which has the discrete topology), Elimination is the way to go. Division becomes multiplication with the modular inverse but the procedure is totally the same as over any other field. Sep 4 '17 at 21:03
• Ok thanks. Is there a list / site somewhere that details most / common methods for obtaining inverse matrices $\mod p$? Sep 5 '17 at 6:23

For $2 \times 2$ matrices we can apply Cramer's rule; the inverse of

$$\begin{bmatrix} a & b \\ c & d \end{bmatrix}$$

is $$\frac{1}{\det(A)}\begin{bmatrix}d & -b\\-c &a\end{bmatrix}$$ where

$\det(A) = ad -bc \neq 0$. This works modulo any prime, or even modulo $n$ if $\gcd(\det(A), n) = 1$.

For higher order I'd use Gaussian elimination, like I showed here being done modulo $11$.

$$\left[ \begin{array}{ccc|ccc} a & b & c & 1 & 0 & 0\\ d & e & f & 0 & 1 & 0\\ g & h & i & 0 & 0 & 1 \end{array} \right]$$
and keep multiplying and substracting equations till we have the identity matrix on the left and $A^{-1}$ on the right.