Why is the group of units mod 8 isomorpic to the Klein 4 group? I recently learned that $U_8\cong \mathbb Z/2\mathbb Z\oplus \mathbb Z/2\mathbb Z$.
I can see, through a bit of computation, that this is the case, but I was wondering if this is just a coincidence or if there is something more general at play here?
Namely, could someone have known that this is the case without carrying out the computations?
Is there something general that states the group of units mod n, $U_n\cong X$ where $X$ is something involving maybe $\varphi(n)$ or some number of direct sums etc.?
 A: The Chinese remainder theorem implies that $U(mn) \cong U(m) \oplus U(n)$ if $m,n$ are relatively prime: thus, we only need to understand prime powers. The general formula is:


*

*$U(2) = 1$

*$U(2^n) \cong \mathbb{Z} / 2 \mathbb{Z} \oplus \mathbb{Z} / 2^{n-2} \mathbb{Z}$

*$U(p^n) \cong \mathbb{Z} / (p-1) \mathbb{Z} \oplus \mathbb{Z} / p^{n-1} \mathbb{Z} \cong \mathbb{Z} / \varphi(p^n) \mathbb{Z}$.



For odd primes, we have $U(p^n)$ is a cyclic group of order $\varphi(p^n) = (p-1)p^{n-1}$. A neat way to show the subgroup of order $p^{n-1}$ is cyclic is inspired by $p$-adic analysis: if $x \equiv 1 \bmod p$, we can actually define the $p$-adic logarithm by its power series
$$ \log(x) = \sum_{i=1}^{+\infty} (-1)^{i+1} \frac{(x-1)^i}{i} $$
and this gives an explicit isomorphism between the subgroup of $U(p^n)$ of things equivalent to $1$ modulo $p$, and the additive group of elements of $\mathbb{Z} / p^n \mathbb{Z}$ of things equivalent to $0$ modulo $p$. The inverse is $\exp(x)$, again defined by the power series.
These power series make sense, because for sufficiently large $i$, all the terms become zero modulo $p^n$. The divisions by $p$ aren't a problem: if we lift to the integers, $(x-1)^i$ always has more factors of $p$ than $i$ does, so we still get a rational number that we can reduce modulo $p^n$. (some care is needed to show this is well-defined if $n \geq p$)
The powers of $2$ are, unfortunately, weird: we get $U(2^n) \cong \mathbb{Z} / 2 \mathbb{Z}\oplus \mathbb{Z} / 2^{n-2}\mathbb{Z} $ for $n \geq 2$. You can still define the logarithm and exponential as above, but you only get an isomorphism between the elements that are equivalent to $1$ modulo $4$ and the elements that are equivalent to $0$ modulo $4$.
The $\mathbb{Z} / 2\mathbb{Z}$ summand of $U(2^n)$ is simply the subgroup $\pm 1$: the projection onto this summand from $U(2^n)$ is obtained by simply sending $x$ to its residue modulo $4$.
A: There is something general. The Chinese remainder theorem says that if the prime factorisation of $n$ is
$$n = \prod_{k=1}^r p_k^{m_k},$$
then we have a ring isomorphism
$$\phi \colon \mathbb{Z}/(n) \to \prod_{k=1}^r \mathbb{Z}/(p_k^{m_k}),$$
so in particular the group of units modulo $n$ is the direct product of the groups of units modulo the prime powers dividing $n$,
$$U_n \cong \prod_{k=1}^r U_{p_k^{m_k}}.$$
So it remains to find the structure of $U_{p^m}$ for prime powers. For odd primes, the group of units is cyclic, of order $\varphi(p^m) = (p-1)p^{m-1}$, and for $p = 2$ we have $U_{2^m} \cong \mathbb{Z}/(2)\times \mathbb{Z}/(2^{m-2})$ when $m \geqslant 2$ (and $U_2 = \{1\}$).
I don't know how one could see that $U_{p^m}$ has the stated structure without doing the computations (abstractly, of course).
A: There is a theorem that says:
Let $n=2^ap_1^{a_1}p_2^{a_2}\cdots p_l^{a_l}$ be the prime decomposition of n. Then
$$
U(\mathbb{Z}/n\mathbb{Z}) \cong U(\mathbb{Z}/2^a\mathbb{Z}) \times U(\mathbb{Z}/p_1^{a^1}\mathbb{Z}) \times \cdots \times U(\mathbb{Z}/p_l^{a_l}\mathbb{Z}).
$$
$U(\mathbb{Z}/p_i^{a_i}\mathbb{Z})$ is a cyclic group of order $p_i^{a_i-1}(p_i-1)$. $U(\mathbb{Z}/2^a\mathbb{Z})$ is cyclic of order 1 and 2 for $a=1$ and 2, respectively. If $a \geq 3$, then it is the product of two cyclic groups, one of order 2, the other of order $2^{a-2}$.
A proof of this statement can be found in 'A classical introduction to modern number theory' written by Ireland and Rosen from which a copied the theorem.
So in this case we have
$$
U(\mathbb{Z}/2^3\mathbb{Z}) \cong U(\mathbb{Z}/2\mathbb{Z}) \times U(\mathbb{Z}/2^{3-2}\mathbb{Z}) \cong U(\mathbb{Z}/2\mathbb{Z}) \times U(\mathbb{Z}/2\mathbb{Z}).
$$
