Inverse elements in a ring I am asked to determine the inverse elements in a ring, e.g. $\mathbb{Z}_{30}$.
The units of the ring are: $1,7,11,13,17,19,23,29$. Is there any faster way then using the euclidean algorithm for each element? (besides guessing)
Greetings,
JAS
 A: You might take any invertible element and compute powers of it until you hit $1$, then reverse the list to get their inverses. If any elements are still missing, repeat with one of them. You can also combine several inverses by $\def\inv{^{-1}}(ab)\inv=b\inv a\inv$ (but of course this multiplication is commutative here), for instance $(-a)\inv=(-1)\inv a\inv=-a\inv$.
For example, modulo $30$ the first invertible element that comes to mind (apart from $1$ which is of course its own inverse) is $7$, its powers are (starting from $7^0$) successively $1,7,19,13,1$ so that in $\mathbf Z/30\mathbf Z$ one has $7\inv=7^3=13$, $19\inv=19$, and $13\inv=7$. This also gives $23\inv=(-7)\inv=-13=17$, as well as $11\inv=11$, and $17\inv=23$. Modulo $30$ this exhausts the inverses of all invertible elements.
A: For small numbers like $30$ I just try multiplying elements together. It's easy to compute cause it's modulo $30$ and usually faster than performing the Euclidean Algorithm. 
A: Hint $\rm\ x^{-1}\equiv a\,\ (mod\ 5)\:\Rightarrow\: x^{-1}\equiv 6a\!-\!5x\,\ (mod\ 30).\ $ See below for a derivation. More directly we may use the CRT (Chinese remainder Theorem) isomorphism $\rm\ \Bbb Z/30\, \cong\, \Bbb Z/6 \times \Bbb Z/5,\ $ where 
with $\rm\, n_k := n\ mod\ k,\:$  $\rm\ n_{30}\leftrightarrow (n_6, n_5),\:$ so $\rm\ n^{-1}\leftrightarrow (n_6, n_5)^{-1}\! \equiv({n_6}^{-1}, {n_5}^{-1}),\,$  e.g.
$$\begin{eqnarray} 11^{-1} &\equiv& 11&\rm\ \ by\ \ &(-1,1)^{-1} &\equiv& ((-1)^{-1},1^{-1}) &\equiv& (-1,1)\\ 
13^{-1} &\equiv& \ \, 7&\rm\ \ by\ \ & \ \ \ (1,3)^{-1} &\equiv& \ \ \ \ \ \ (1^{-1},\color{#C00}{3^{-1}}) &\equiv& \ \ \ (1,\color{#C00}2)\qquad\end{eqnarray}$$
Note that the only (slightly) nontrivial inversion above was $\rm\: \color{#C00}{3^{-1}\equiv 2}\,\ (mod\ 5).\,$ Indeed, the $\rm\,mod\ 6\,$ inversions in the first component are always trivial, since it has only trivial units $\pm1 $. Those are all the inversions we need, since the units mod $\,30\,$ are $\,\pm \{1\ 7\ 11\ 13\},\:$ and $\rm\, (-n)^{-1}\equiv - n^{-1}.$
Remark $\ $ Similarly, we may reduce inverse computation $\rm\,mod\ 6n\:$ to inverse computation $\rm\,mod\ n,\:$ for any natural $\rm\,n\,$ coprime to $\,6.\,$ Therefore, $\rm\ n \equiv \color{#C00}{\pm1}\ (mod\ 6),\:$ so using Easy CRT we obtain
$\rm\displaystyle\qquad\qquad\quad
\begin{eqnarray} 
\rm x^{-1}\!&\equiv&\rm\ a\ \ (mod\ n) \\
\rm x^{-1}\!&\equiv&\rm\ x\ \ (mod\ 6)\end{eqnarray}  \iff\ $ $\begin{eqnarray}\rm x^{-1}\! &\equiv&\rm\ a + n\ \bigg[\frac{x-a}{n}\ mod\ 6\:\bigg]\, \ (mod\ 6n)\\
&\equiv&\rm\  a \color{#C00}{\pm} n\,\ (\,\ x-a\ \ mod\ 6\,)\ \ (mod\ 6n)\end{eqnarray}$
$$\begin{eqnarray}   \hline\\ \\
\rm &\rm i.e. &\rm &\rm x^{-1}\equiv&\rm a\ \ (mod\ n)\ &\Rightarrow&\rm\ \ x^{-1}&\equiv&\,\rm a \color{#C00}{\pm} n\smash[b]{(x\!-\!a)_6}\ \ (mod\ 6n)\\ &\rm e.g.&  &\rm x^{-1}\equiv&\rm a\ \ (mod\ 5)\ &\Rightarrow&\rm\ \ x^{-1}&\equiv&\,\rm a \color{#C00}{\bf -} 5(x\!-\!a)_6\ \ (mod\ 30)\\
&\rm e.g.&\quad \rm 7^{-1}\equiv&\rm 2^{-1} \equiv&\rm 3\ \ (mod\ 5)\ &\Rightarrow&\rm\ \ 7^{-1}&\equiv&\rm\, 3 \color{#C00}{\bf -} 5(7\!-\!3)\equiv 13\, \ (mod\ 30)\end{eqnarray}$$
A: You can half the research observing that $-n$ is invertible iff $n$ is invertible, where $-n$ of course corresponds to $30-n$ in this case. 
In addition, if a prime $p$ does not divide the module (now $30$), then it will be coprime to it. It justifies your list: $1,7,11,13,-13,-11,-7,-1$.
