Originally Posted by

**Swlabr** Or, you could just do it the way you do for a normal matrix, using the determinant, but you need to work out 1 over the determinant modulo n.

For example, if $\displaystyle \frac{1}{det(A)}=1/2$ and $\displaystyle n$ is $\displaystyle 7$ then you just need to find the inverse of 2 mod 7. This is 4. Therefore, $\displaystyle \frac{1}{det(A)}$ is 4.

So, to work out the inverse of $\displaystyle \left(\begin{array}{cc} 4&1\\3&3\end{array}\right)$ one simply calculates the determinant, which is 12-3=9, and $\displaystyle \frac{1}{9} = \frac{1}{4}=4$ modulo $\displaystyle 5$.

Thus, our inverse is

$\displaystyle 4\cdot \left(\begin{array}{cc} 3&-1\\-3&4\end{array}\right)$

$\displaystyle =4\cdot \left(\begin{array}{cc} 3&4\\2&4\end{array}\right)$

$\displaystyle =\left(\begin{array}{cc} 12&16\\8&16\end{array}\right)$

$\displaystyle =\left(\begin{array}{cc} 2&1\\3&1\end{array}\right)$

as required.