TITLE: how to find inverse of a matrix in $\Bbb Z_5$
QUESTION [7 upvotes]: 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.

REPLY [7 votes]: 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.

REPLY [6 votes]: 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$.