[proofplan]
Choose a generator $g \in G$ and compare $G$ with the universal [cyclic group](/page/Cyclic%20Group) $\mathbb{Z}$ through the map sending an integer $k$ to $g^k$. This map is always a surjective homomorphism because every element of $G$ is a power of $g$. In the infinite case its kernel must be zero, so it is an isomorphism. In the finite case the kernel is exactly $n\mathbb{Z}$, and the corresponding quotient map induces an isomorphism $\mathbb{Z}/n\mathbb{Z} \to G$.
[/proofplan]
[step:Construct the canonical homomorphism from $\mathbb{Z}$ onto $G$]
Write the group operation on $G$ multiplicatively, and let $1_G$ denote its identity element. Since $G$ is cyclic, choose a generator $g \in G$, so $G = \langle g \rangle = \{g^k : k \in \mathbb{Z}\}$.
Define the map $\varphi: \mathbb{Z} \to G$, $k \mapsto g^k$. Here $\mathbb{Z}$ is regarded as an additive group. For all $a,b \in \mathbb{Z}$, the exponent law in the group $G$ gives
\begin{align*}
\varphi(a+b) = g^{a+b}
\end{align*}
\begin{align*}
g^{a+b} = g^a g^b
\end{align*}
\begin{align*}
g^a g^b = \varphi(a)\varphi(b).
\end{align*}
Thus $\varphi$ is a [group homomorphism](/page/Group%20Homomorphism) from the additive group $\mathbb{Z}$ to $G$. Since $g$ generates $G$, every element of $G$ has the form $g^k$ for some $k \in \mathbb{Z}$, so $\varphi$ is surjective.
[guided]
We use multiplicative notation for the cyclic group $G$, even though the model groups $\mathbb{Z}$ and $\mathbb{Z}/n\mathbb{Z}$ are written additively. The bridge between the two notations is exponentiation: addition of integers corresponds to multiplication of powers.
Because $G$ is cyclic, there exists an element $g \in G$ such that every element of $G$ is a power of $g$. In symbols, $G = \langle g \rangle = \{g^k : k \in \mathbb{Z}\}$.
Define $\varphi: \mathbb{Z} \to G$, $k \mapsto g^k$. This is the natural candidate for an isomorphism: the integer $k$ records how many times the generator is applied.
We verify the homomorphism property. The domain $\mathbb{Z}$ has operation addition, while $G$ has multiplication. For $a,b \in \mathbb{Z}$, the exponent law in a group gives $\varphi(a+b) = g^{a+b} = g^a g^b = \varphi(a)\varphi(b)$.
Therefore $\varphi$ is a group homomorphism.
We also verify surjectivity. Let $x \in G$. Since $g$ generates $G$, there exists $k \in \mathbb{Z}$ such that $x = g^k$. Hence $x = \varphi(k)$, so every element of $G$ lies in the image of $\varphi$. Thus $\varphi$ is surjective.
[/guided]
[/step]
[step:Show that the infinite cyclic case has trivial kernel]
Assume that $G$ is infinite. We prove that $\ker \varphi = \{0\}$.
Suppose, toward a contradiction, that there exists $k \in \ker \varphi$ with $k \ne 0$. Let $m = |k| \in \mathbb{N}$. Since $\varphi(k)=1_G$, we have $g^k=1_G$. If $k<0$, then $g^m = g^{-k} = 1_G$; if $k>0$, then $g^m=g^k=1_G$. Hence in all cases
\begin{align*}
g^m = 1_G.
\end{align*}
For any integer $q \in \mathbb{Z}$, write $q = am + r$ with $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,m-1\}$ by Euclidean division. Then
\begin{align*}
g^q = g^{am+r} = (g^m)^a g^r = 1_G^a g^r = g^r.
\end{align*}
Therefore every element of $G=\langle g\rangle$ belongs to the finite set
\begin{align*}
\{1_G,g,g^2,\dots,g^{m-1}\}.
\end{align*}
This makes $G$ finite, contradicting the assumption that $G$ is infinite. Hence $\ker \varphi=\{0\}$.
Since $\varphi$ is a surjective homomorphism and has trivial kernel, it is injective. Therefore $\varphi: \mathbb{Z} \to G$ is an isomorphism, so $G \cong \mathbb{Z}$.
[/step]
[step:Identify the kernel in the finite cyclic case]
Assume that $G$ is finite and $|G|=n$. Since $G$ has at least its identity element, $n \ge 1$.
We first show that the least positive exponent sending $g$ to $1_G$ is exactly $n$. Because $G$ has $n$ elements, the $n+1$ elements $1_G,g,g^2,\dots,g^n$ cannot all be distinct. Hence there exist integers $i,j$ with $0 \le i < j \le n$ and $g^i=g^j$. Multiplying on the left by $g^{-i}$ gives $g^{j-i}=1_G$. Thus the set of positive integers $r$ with $g^r=1_G$ is nonempty. Let $m$ be its least element.
We claim that $G=\{1_G,g,g^2,\dots,g^{m-1}\}$ and that these $m$ displayed elements are distinct. For any $q \in \mathbb{Z}$, write $q=am+r$ with $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,m-1\}$. Since $g^m=1_G$, $g^q = g^{am+r} = (g^m)^a g^r = g^r$. Thus the displayed set equals $G$. If $0 \le r < s \le m-1$ and $g^r=g^s$, then multiplying by $g^{-r}$ gives $g^{s-r}=1_G$, where $0<s-r<m$, contradicting the minimality of $m$. Hence the displayed elements are distinct. Therefore $|G|=m$, and since $|G|=n$, we have $m=n$.
It follows that $\ker \varphi = \{k \in \mathbb{Z} : g^k=1_G\} = n\mathbb{Z}$. Indeed, if $k=an$ for some $a \in \mathbb{Z}$, then $g^k=(g^n)^a=1_G$. Conversely, if $g^k=1_G$, write $k=an+r$ with $a \in \mathbb{Z}$ and $0 \le r \le n-1$. Then $1_G = g^k = g^{an+r} = (g^n)^a g^r = g^r$. By the minimality of $n$, this forces $r=0$, so $k \in n\mathbb{Z}$.
[guided]
The finite case is controlled by the first time a positive power of the generator returns to the identity. Since $G$ has $n$ elements, the list $1_G,g,g^2,\dots,g^n$ contains $n+1$ elements of an $n$-element set. Therefore two entries in the list must be equal: there exist integers $i,j$ with $0 \le i < j \le n$ and $g^i=g^j$. Multiplying by $g^{-i}$ gives $g^{j-i}=1_G$. Thus at least one positive exponent sends $g$ to the identity.
Let $m$ be the least positive integer such that $g^m=1_G$. We now show that $m$ counts the elements of the cyclic group generated by $g$. First, every power of $g$ reduces to one of the powers with exponent between $0$ and $m-1$. If $q \in \mathbb{Z}$, Euclidean division gives integers $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,m-1\}$ such that $q=am+r$. Then $g^q = g^{am+r} = (g^m)^a g^r = 1_G^a g^r = g^r$.
So every element of $G=\langle g\rangle$ lies in $\{1_G,g,g^2,\dots,g^{m-1}\}$.
Second, these $m$ elements are distinct. Suppose $0 \le r < s \le m-1$ and $g^r=g^s$. Multiplying by $g^{-r}$ gives $g^{s-r}=1_G$. But $s-r$ is a positive integer strictly smaller than $m$, contradicting the minimal choice of $m$. Therefore the displayed elements are distinct.
We have shown that $G$ consists of exactly $m$ elements. Since the hypothesis says $|G|=n$, it follows that $m=n$. Therefore $g^n=1_G$, and no positive exponent smaller than $n$ sends $g$ to $1_G$.
Now we compute the kernel of $\varphi$. By definition, $\ker \varphi = \{k \in \mathbb{Z} : \varphi(k)=1_G\} = \{k \in \mathbb{Z} : g^k=1_G\}$.
If $k \in n\mathbb{Z}$, then $k=an$ for some $a \in \mathbb{Z}$, and $g^k = g^{an} = (g^n)^a = 1_G$.
Thus $n\mathbb{Z}\subseteq \ker\varphi$.
Conversely, suppose $k \in \ker\varphi$. Write $k=an+r$ with $a \in \mathbb{Z}$ and $r \in \{0,1,\dots,n-1\}$. Since $g^k=1_G$ and $g^n=1_G$, $1_G = g^k = g^{an+r} = (g^n)^a g^r = g^r$.
The integer $r$ is between $0$ and $n-1$. Since $n$ is the least positive exponent with $g^n=1_G$, the equality $g^r=1_G$ forces $r=0$. Hence $k=an \in n\mathbb{Z}$. Therefore $\ker\varphi=n\mathbb{Z}$.
[/guided]
[/step]
[step:Descend the homomorphism to $\mathbb{Z}/n\mathbb{Z}$]
Define $\overline{\varphi}: \mathbb{Z}/n\mathbb{Z} \to G$, $k+n\mathbb{Z} \mapsto g^k$.
This map is well-defined. If $k+n\mathbb{Z}=\ell+n\mathbb{Z}$, then $k-\ell \in n\mathbb{Z}=\ker\varphi$, so $g^{k-\ell}=1_G$. Hence $g^k=g^\ell$, and the value of $\overline{\varphi}$ does not depend on the representative.
For $k,\ell \in \mathbb{Z}$, we have
\begin{align*}
\overline{\varphi}((k+n\mathbb{Z})+(\ell+n\mathbb{Z})) = \overline{\varphi}(k+\ell+n\mathbb{Z})
\end{align*}
\begin{align*}
\overline{\varphi}(k+\ell+n\mathbb{Z}) = g^{k+\ell}
\end{align*}
\begin{align*}
g^{k+\ell} = g^k g^\ell
\end{align*}
\begin{align*}
g^k g^\ell = \overline{\varphi}(k+n\mathbb{Z})\overline{\varphi}(\ell+n\mathbb{Z}).
\end{align*}
Thus $\overline{\varphi}$ is a group homomorphism.
Since $\varphi$ is surjective, every element of $G$ has the form $g^k=\overline{\varphi}(k+n\mathbb{Z})$, so $\overline{\varphi}$ is surjective. If $\overline{\varphi}(k+n\mathbb{Z})=1_G$, then $g^k=1_G$, so $k \in \ker\varphi=n\mathbb{Z}$, and therefore $k+n\mathbb{Z}=n\mathbb{Z}$ is the identity element of $\mathbb{Z}/n\mathbb{Z}$. Hence $\overline{\varphi}$ is injective.
Therefore $\overline{\varphi}: \mathbb{Z}/n\mathbb{Z}\to G$ is an isomorphism, so $G \cong \mathbb{Z}/n\mathbb{Z}$.
[/step]
[step:Conclude the classification]
In the infinite case, the canonical homomorphism $\varphi:\mathbb{Z}\to G$ is an isomorphism, giving
\begin{align*}
G \cong \mathbb{Z}.
\end{align*}
In the finite case with $|G|=n$, the induced homomorphism $\overline{\varphi}:\mathbb{Z}/n\mathbb{Z}\to G$ is an isomorphism, giving
\begin{align*}
G \cong \mathbb{Z}/n\mathbb{Z}.
\end{align*}
This proves both alternatives in the classification of cyclic groups.
[/step]