Group of order $pq$ I am struggling with this exercise:

Let $G$ be a group of order $pq$, where $p > q$ and $p, q$ are primes.Prove that if $q|p−1$, then either $G \cong \mathbb{Z}_{pq}$ or $G \cong \mathbb{Z}_{p} \rtimes \mathbb{Z}_{q}$.

I already proved the case $G \cong \mathbb{Z}_{pq}$. However, for the case $G \cong \mathbb{Z}_{p} \rtimes \mathbb{Z}_{q}$, I don't understand what it is means. The semidirect product should be defined with a homomorphism $\phi : \mathbb{Z}_{q} \to \mathrm{Aut}(\mathbb{Z}_{p})$ but the exercise doesn't give one. So I want to konw which of the following is true

*

*For all homomorphism $\phi : \mathbb{Z}_{q} \to \mathrm{Aut}(\mathbb{Z}_{p})$, $G \cong \mathbb{Z}_{p} \rtimes_{\phi} \mathbb{Z}_{q}$.

*There exist a homomorphism $\phi : \mathbb{Z}_{q} \to \mathrm{Aut}(\mathbb{Z}_{p})$ such that $G \cong \mathbb{Z}_{p} \rtimes_{\phi} \mathbb{Z}_{q}$.

If case 1 is true, could you please prove that? As $\phi$ is arbitrary, I don't know how to start.
 A: Hint: if $\mathbb{Z}_p$ is normal in $G,$ what does conjugation by a generator of $\mathbb{Z}_q$ do?
A: First of all notice that $Aut(Z_{p})\cong U_{p}$ where $U_{p}$ is the group of units modulo multiplication $p$. and it has order $p-1$.
So what you are looking for is a homomorphism $f:Z_{q}\to U_{p}$. now any homomorphism is given by the image of $1$ in $Z_{q}$. so $f(1)$ divides $q$ and it must also divide $p-1$. So we are looking to map $1$ to an element $z\in U_{p}$ such that $z^{q}=1\mod p$. Now as $q|p-1$. you have an element of order $q$ in $U_{p}$ by Cauchy's theorem.
So you get a homomorphism from $Z_{q}\to Aut(Z_{p})$ such that $\phi(y)=\phi_{y}$ where $\phi_{y}(x)= xz^{y}$ . Now for $z\neq 1$ you get a non-trivial homomorphism. This will give you the semi-direct product.
Then this $\phi$ gives you the required homormorphism. If $Z_{p}$ is normal in $G$ then the homomorphism is trivial(i.e. $f(1)=1$ ) then you get that the semi-direct product coincides with the direct product. and ${Z}_{p} \rtimes_{\phi} {Z}_{q}\cong Z_{p}\times Z_{q}\cong Z_{pq}$.
If $Z_{p}$ is not normal then you get a non-trivial homomorphism and you get $G\cong {Z}_{p} \rtimes_{\phi} {Z}_{q}$ . Now the $z$ we mapped to earlier might not be unique. So in that case you compose the homomorphism with an automorphism of $Z_{q}$ to get another semi-direct product. But even in that case they will coincide . So in totality you get only two groups of order $pq$. One is cyclic and the other is non-abelian.
