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$ Let $G$ be a group of order $2p$ , where $p$ is a prime greater than $2$. Then, G is isomorphic to $Z_{2p}$ or $D_p$ .
Gallian gives a proof as follows : They prove that G = $\langle a \rangle \bigcup b \langle a \rangle$ where $a$ is an element of order $p$ and $b$ is an element of order $2$.... $(1)$
Now consider $ab$. Since $ab \notin \langle a \rangle$, it is proved that $ab$ has order $2$. Hence , $ab = (ab)−1 = b^{−1}a^{−1} = ba^{−1} $(as $b$ has order $2$). 
Furthermore, $a^ib = ba^{−i} ~\forall ~i \geq 1$ , so this relation completely determines the multiplication table for $G$.  Since the multiplication tables of all non cyclic groups of order $2p$ are uniquely determined , they must all be isomorphic to each other. 
Attempt : I have trouble understanding the above statement in bold. I do have an intuition that $a^ib = ba^{−i} ~\forall ~i \geq 1$ , might be able to completely determine the multiplication table for $G$ because : 
Order of $ab = 2$ { as proved in Gallian}
Any element in G is of the form $a^l b a^m $  
But to prove that the mutliplication tables for all non cyclic groups of order $2p$ are uniquely determined, if we consider the multiplication of two elements $x,y$ $\in G$ , we 
$x y = a^{l_1} b a^{m_1} a^{l_2} b a^{m_2}$
How is this uniquely determined? 
And if they are uniquely determined, why should all non cyclic groups of order $2p$ be isomorphic to each other?
Attempt :  If they are uniquely determined, then i can think of a one to one correspondence between the cayley tables of two groups $G_1$ and $G_2$ . They will surely be onto as well as both $G_1$ and $G_2$ are of order $2p$ .
But to prove isomorphism, how do i prove the group function operation preservation? 
 A: 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.
A: 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.
A: We need to rewrite $b^xa^y\cdot b^za^w$ with $x,z\in\{0,1\}$, $y,w\in\{0,\ldots,p-1\}$ in the form $b^ua^v$. The only "difficult" case is when $y>0, z=1$. But then $a^yb=a^{y-1}ab=a^{y-1}ba^{p-1}$ allows us to decrease $y$ (at the cost of $w$) step by step until we reach $y=0$, i.e. are left with $b^{x+z}a^{w'}$.
