how to find inverse of a matrix in $\Bbb Z_5$
Solution 1:
Perhaps the easiest way here (though not the easiest way in general) is to write $$A^{-1} = \left( \begin{array}{ccc} a & b & c \\ d & e & f \\ g & h & i \end{array}\right)$$ and then do the multiplication $A \cdot A^{-1} = I$. Some nice cancellation happens (which does not occur in general), and there is your inverse.
More generally speaking, you can always do row operations to find your matrix. You do need to be a bit careful since, say, division by $2$ is not defined, though multiplication by $3$ is defined. Row operations are permitted in general, though not every element in $\mathbb{Z}_n$ is invertible. Since $n = 5$ is prime, then $\mathbb{Z}_5$ is a field, and hence every nonzero unit is invertible.
Solution 2:
Remember that you can compute the inverse of a matrix by reducing it to row echelon form. I mean set the $3\times 6$ matrix $ (A \vert I)$, where $A$ is the matrix you want to invert and $I$ the unit matrix. When you have finished the process, you'll get a matrix like $(I\vert A^{-1})$ and the matrix on the right, yes!, is the inverse of $A$. (For more about this approach see Hoffman and Kunzi). I prefer this way personally. The point we should care about it is that: When you are doing the way, whenever we need to multiply a number to another one, we consider the operation in $\mathbb Z_5$. For example, if we want to multiply the row $$(1~~2~~0)$$ by 3, we, indeed, have $$3(1~~2~~0)=(4~~0~~3)$$ because $3\times 1=3+1=4$ and $3\times 2=3+2=5=0$.
Solution 3:
Hint: Use the adjugate matrix.
Answer: The cofactor matrix of $A$ comes
$\color{grey}{C_A= \begin{pmatrix} +\begin{vmatrix} 2 & 4 \\ 0 & 3 \end{vmatrix} & -\begin{vmatrix} 0 & 4 \\ 0 & 3 \end{vmatrix} & +\begin{vmatrix} 0 & 2 \\ 0 & 0 \end{vmatrix} \\ -\begin{vmatrix} 2 & 0 \\ 0 & 3 \end{vmatrix} & +\begin{vmatrix} 1 & 0 \\ 0 & 3 \end{vmatrix} & -\begin{vmatrix} 1 & 2 \\ 0 & 0 \end{vmatrix} \\ +\begin{vmatrix} 2 & 0 \\ 2 & 4 \end{vmatrix} & -\begin{vmatrix} 1 & 0 \\ 0 & 4 \end{vmatrix} & +\begin{vmatrix} 1 & 2 \\ 0 & 2 \end{vmatrix} \end{pmatrix}= \begin{pmatrix} 6 & 0 & 0 \\ -6 & 3 & 0 \\ 8 & -4 & 2 \end{pmatrix}=} \begin{pmatrix} 1 & 0 & 0 \\ -1 & 3 & 0 \\ 3 & 1 & 2 \end{pmatrix}.$
Therefore the adjugate matrix of $A$ is
$\color{grey}{\text{adj}(A)=C_A^T= \begin{pmatrix} 1 & 0 & 0 \\ -1 & 3 & 0 \\ 3 & 1 & 2 \end{pmatrix}^T=} \begin{pmatrix} 1 & -1 & 3 \\ 0 & 3 & 1 \\ 0 & 0 & 2 \end{pmatrix}$.
Since $\det{(A)}=1$, it follows that $A^{-1}=\text{adj}(A)= \begin{pmatrix} 1 & -1 & 3 \\ 0 & 3 & 1 \\ 0 & 0 & 2 \end{pmatrix}$.
And we confirm this by multiplying them matrices:
$\begin{pmatrix} 1 & -1 & 3 \\ 0 & 3 & 1 \\ 0 & 0 & 2\end{pmatrix} \begin{pmatrix} 1 & 2 & 0 \\ 0 & 2 & 4 \\ 0 & 0 & 3\end{pmatrix}= \begin{pmatrix} 1 & 0 & 5 \\ 0 & 6 & 15 \\ 0 & 0 & 6\end{pmatrix}= \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1\end{pmatrix}$.