Let $G$ be a group with $|G| = 18$. Suppose that $G$ has a cyclic subgroup of order $9$. Classify $G$ I know the answer to this question but I still don't understand how to find it and why it is only $Z_{18}$ and $D_{18}$. Can someone please explain it and try to be as clear as possible? 
 A: Let $H$ be the cyclic subgroup of order 9. Then $H$ is normal in $G$. Let $h$ be a generator of $H$. Let $i \in G$ be an element of order 2 (which must exist). Then $ihi^{-1} = h^n$ for some $n$.
Then $h = i^2hi^{-2} = i(ihi^{-1})i^{-1} = ih^ni^{-1} = h^{n^2}$. So $n = \pm 1$. If $n = 1$ then the group is isomorphic to $\mathbb Z_{18}$, and if $n = -1$ then the group is isomorphic to $D_{18}$.
A: Let $Z \leq G$ be the cyclic subgroup of order $9$.  Since $|G:Z| = 2$, $Z$ is normal in $G$ and $G/Z \cong \mathbb{Z}/2\mathbb{Z}$.  This $\mathbb{Z}/2\mathbb{Z}$ acts on $Z$ by conjugation, producing automorphisms of $Z$, $\mathrm{Aut}(Z) \cong Z^\times$, and such automorphisms are specified by their image of $1$ since $Z$ is cyclic.  If the action is the identity, we get $$G \cong Z \times \mathbb{Z}/2\mathbb{Z} \cong \mathbb{Z}/18\mathbb{Z} \cong \langle 1_Z, 1_2 \mid 1_2 1_Z 1_2^{-1} = 1_Z \rangle  \text{.}$$  If the action is inversion, $\varphi_1(z) = z^{-1}$, $$G \cong Z \rtimes_\varphi \mathbb{Z}/2\mathbb{Z} \cong D_{18} \cong \langle 1_Z, 1_2 \mid 1_2 1_Z 1_2^{-1} = 1_Z^{-1} \rangle  \text{.}$$  As no other subgroup of $\mathrm{Aut}(Z) \cong Z^\times$ has order divisible by $2$, there are no other actions to consider.
