Let $G$ be a group of order $2p$ , where $p$ is a prime greater than $2$. Then, G is isomorphic to $\mathbb{Z}_{2p}$ or $D_p$
Solution 1:
Let's try a complete solution.
We know that there is an element of order 2, by Cauchy's theorem. Let's call $\tau$ this element. Consider $\phi_{\tau}: G \rightarrow G $ wich maps $g \rightarrow \tau g$. Since there are 2p elements we also know that there is an element s of order p (and so a subgroup isomorphic to $\mathbb{Z}_{p}$). It's a matter of count to prove that $G=\{e,\tau, <s>, \phi_{\tau}(<s>)\}$. This is true because for any $\tau s^k$ if $\tau s^k=s^j \Rightarrow \tau s^{k-j}=e$ wich means that $k=j$, wich is absurd by cancellativity.
Simmetrically the map $\phi_{\tau^{-1}}: G \rightarrow G $ which maps $ g \rightarrow g\tau^{-1}$ is such that $\phi_{\tau^{-1}}\phi_{\tau}(<s>)=<s>$, so $\psi=\phi_{\tau^{-1}}\phi_{\tau}$ is an automorphism (prove it's linear) of $<s>$ and has order at most 2.
Now $Aut(\mathbb{Z}_p)=\mathbb{Z}_{p-1}$, where only two elements have order at most 2. which are: $\{g\mapsto g \}, \{g\mapsto g^{-1} \}$.
Consider now immersions $id^{*}:\mathbb{Z}_{2p} \hookrightarrow G$ mapping $p \mapsto \tau $ and $2 \mapsto s$ if the action of $\psi$ is $\{g\mapsto g \}$ and choose $Inv^{*}:D_p \hookrightarrow G$ mapping $reflection \mapsto \tau $ and $rotation \mapsto s$ if the action of $\psi$ is $\{g\mapsto g^{-1} \}$ and verify they are isos.
Solution 2:
So Gallian has proved that $G$ has two generators, $a$ and $b$. Since we have the relation that $a^i b = b a^{-i}$, we can iteratively simplify any multiplications of $a$-s and $b$-s as follows: $$ a^{k_1} b^{j_1} a^{k_2} b^{j_2}\cdots a^{k_n} b^{j_n} = b^{\sum_{i=1}^n j_i} a^{-\sum_{i=1}^n k_i}.$$
Since any $g\in G$ can be written in the form on the left-hand side, we may assume any $g$ can be written in the form on the right-hand side, with all the $b$-s multiplying from the left and $a$-s from the right. Now, take $g,h\in G$, and write $$g = b^{j_1} a^{k_1},$$ $$h = b^{j_2} a^{k_2}.$$ Then our relation tells us exactly what $gh$ is: $$gh = b^{j_1+j_2} a^{k_2-k_1}.$$
Being able to do this means that we can completely determine the multiplication table for $G$. Now, $G$ was an arbitrary nonabelian group of order $2p$. So we can completely determine the multiplication table for any nonabelian group of order $2p$. Let $G$ and $H$ be two such groups, and like in the proof suppose $G$ is generated by $a$ and $b$, and $H$ is generated by $c$ and $d$, such that we have the relations $$a^i b = b a^{-i}$$ and $$c^i d = d c^{-i}.$$
The correspondence $a \mapsto c$ and $b \mapsto d$, extended to respect multiplication, defines a homomorphism from $G$ to $H$. (You may be familiar with this: to define a homomorphism on a group with generators it suffices to define its action on the generators.) This homomorphism is clearly one-to-one and onto, so we have an isomorphism.
Finally, the dihedral group $D_p$ is an example of a nonabelian group with order $2p$ (note the relation $r^i s = s r^{-i}$ holds in $D_p$, so this gives us an explicit description of the isomorphism class.