how to find inverse of a matrix in $\Bbb Z_5$ how to find inverse of a matrix in $\Bbb Z_5$
please help me explicitly how to find the inverse of matrix below, what I was thinking that to find inverses separately of the each term in $\Bbb Z_5$ and then form the matrix?
$$\begin{pmatrix}1&2&0\\0&2&4\\0&0&3\end{pmatrix}$$
Thank you.
 A: 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.
A: 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$.
A: 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}$.
A: "I was thinking that to find inverses separately of the each term in Z5 and then form the matrix?" The way I interpret that sentence you are saying that $(a_{ij})^{-1}=(a_{ij}^{-1})$ which is not true.
To find the inverse of a matrix you can't just take the inverse of each element. Now to answer the question, it depends on how/what can you use to compute the inverse. If you are doing it by hand, then just make a quick addition and multiplication table of $\mathbb{Z_5}$ and just find the inverse exactly as how you would with real numbers except that all addition, subtraction, multiplication, and division should be done in $\mathbb{Z_5}$.
If you are using Matlab for example, then (in general) just take the "normal" inverse (over the reals), multiply every entry in the matrix by the (real) determinant which would turn all entries into integers if you had any decimals/rationals. Then multiply all of the entries in the matrix by the multiplicative inverse of the determinant in $\mathbb{Z_5}$ to "undo" the real multiplication you did. You still have all integers. Then you reduce mod 5 and done.
In your case, the determinant in reals is 6 meaning the determinant over $\mathbb{Z_5}$ is 1. General rule, if the determinant is invertible in whatever number system you working in, the matrix will be invertible too. So in this case your matrix is invertible AND you don't have to do the last two steps where you multiply by the determinant and then its inverse.
