# Classifying groups of order $6$ using semidirect products

Let G be a group of order 6. I am able to do the exercise without semidirect products($G \cong Z_6$ or $S_3$) but I don't know how to use semidirect products to do this.

By Sylow's theorem, there is only subgroup of order 3, say P. As it is unique, P is normal in G. Also, let Q be a 2-Sylow subgroup. Note that $P\cap Q=\{e\}$. That means G is a semidirect product $P \rtimes_{\phi} Q$ for $\phi:Q \to Aut(P)$. So there are two possible automorphisms on P, names $\alpha$ which is the identity on $P$ and $\beta$ which takes $x\in P$ to $x^{-1}$. That gives us two homomorphisms $\phi:Q \to Aut(P)$. How do I proceed after this? (I suspect I don't understand semidirect products well enough and I really don't know how to explicitly show that one gets two nonisomorphic groups)

By Cauchy's theorem, there must be an element $s$ of order $2$ in $G$, and an element $r$ of order $3$, because $2$ and $3$ divide $6$. Clearly $r$ generates a cyclic group $C_3$ which has index $2$ in $G$, hence is a normal subgroup. Then $G$ is a semidirect product of $C_2$ and $C_3$. In case it is abelian, this product is direct. One can say this more precisely. We have $$G=\{1,r,r^2,s,sr,sr^2\}$$ and since $C_3$ is a normal subgroup, we must have $srs^{-1}=r^k$ for some $k$. So we have $$r=s^2rs^{-2}=s(srs^{-1})s^{-1}=r^{k^2}$$ This means $k^2\equiv 1 \bmod 3$, which has exactly $2$ solutions, namely $k\equiv \pm 1 \bmod 3$. In the first case, $G$ is commutative and we have $G=C_2\times C_3=C_6$, and in the second case we have $G=D_3=S_3$.