# Math Help - Matrix determinants (modulo)

1. ## Matrix determinants (modulo)

When calculating the inverse of a normal matrix, for $M = \begin{pmatrix}
x & y \\
z & v
\end{pmatrix}$
for example, you would simply use $\frac{1}{xv-yz}\begin{pmatrix}
v & -y \\
-z & x
\end{pmatrix}$
.

However, if your matrix was $\begin{pmatrix}
\bar{1} & \bar{2} \\
\bar{2} & \bar{0}
\end{pmatrix}$
in $\mathbb{Z}_3$, the inverse would be:

$(-\bar{4})^{-1}\begin{pmatrix}
\bar{0} & \bar{-2} \\
\bar{-2} & \bar{1}
\end{pmatrix} = (\bar{2})^{-1}\begin{pmatrix}
\bar{0} & \bar{1} \\
\bar{1} & \bar{1}
\end{pmatrix}$
.

Ok up to here, just forgotten how to calculate $(\bar{2})^{-1}$

Thanks in advance

2. I suppose with $\mathbb{Z}_3$ you mean the invertible elements of $\mathbb{Z}/3\mathbb{Z}$? (I've seen different notation for that).

Anyway, $(\overline{2})^{-1}=2$ since $2\cdot 2 = 4 \equiv 1$ mod 3

3. Yeh that was what I meant, cheers.

4. For finding an arbitrary modular inverse (if it exists), there is an algorithm using the extended Euclidean algorithm, described here. Also, if you choose the method involving direct exponentiation using Euler's theorem, there are algorithms for fast modular exponentiation, one of which is described in this thread, posts #5 and #7.