Nonabelian semidirect products of order $pq$? I just constructed the semidirect product in Lang, and I'm trying to tie some facts together. From Ash's Algebra, I know that if $p\lt q$ are distinct primes, if $q\not\equiv 1\pmod{p}$, then any group $G$ of order $pq$ is abelian.
Is the converse true, that for any primes $p\lt q$, if $q\equiv 1\pmod{p}$ then there exists a nonabelian group of order $pq$?
One example I found online is that $\mathbb{Z}_3\ltimes \mathbb{Z}_7$ is nonabelian, and here $7\equiv 1\pmod{3}$. I was considering then semidirect products $\mathbb{Z}_p\ltimes\mathbb{Z}_q$ where $q\equiv 1\pmod{p}$ and some homomorphism $\phi\colon \mathbb{Z}_p\to\operatorname{Aut}(\mathbb{Z}_q)$ I calculate that 
$$
(1,0)(0,1)=(1+0,\phi_0(0)+1)=(1,1)
$$
and
$$
(0,1)(1,0)=(0+1,\phi_{-1}(1)+0)=(1,\phi_{p-1}(1)).
$$
Is it true somehow that $\phi_{p-1}(1)\neq 1$ in each case to show the group is nonabelian? I guess if it did this would imply $\phi_{p-1}$ is the trivial automorphism, so maybe there's something there? If not, is there a way to show $\mathbb{Z}_p\ltimes\mathbb{Z}_q$ is nonabelian in these cases in general? Thanks.
 A: Given $p,q$, with $p<q$ and $p|(q-1)$, there exist a non-abelian group of order $pq$ and it is unique up to isomorphism:
If $G$ is a non-abelian group, $|G|=pq$, then subgroup $H$ of order $q$ is normal (by Sylow theorem); let $K$ be its subgroup of order $p$. Then $HK\leq G$ (since $H\triangleleft G$) and $HK=G$ (since $|KH|=|H|.|K|/|H\cap K|=pq=|G|$). So,

$H\triangleleft G$, $K\leq G$, $HK=G$, $H\cap K=(1)$ $\implies G\cong H \rtimes K$.

Now, to get all possible (non-isomorphic) semidirect products $H$ by $K$, we have to consider homomorphisms $\phi \colon K \rightarrow Aut(H)$. 
Since $K\cong \mathbb{Z}/p$, $H\cong \mathbb{Z}/q$, we know that $Aut(H)\cong \mathbb{Z}/(q-1)$.
As $p|(q-1)$, and $Aut(H)$ is cyclic group of order $q-1$, it contains unique subgroup of order $p$. So for any two non-trivial homomorphisms $\phi, \psi \colon K\rightarrow Aut(H)$, we have $\phi(K)=\psi(K)$, and $K$ is cyclic. Also, these homomorphisms are injective, since $K$ is of prime order. (Note that trivial homomorphisms will give direct product of $H$ by $K$, so $G\cong H\times K$, abelian group of order $pq$).
Therefore by following theorem semidirect products of $H$ by $K$ w.r.t. $\phi$ and $\psi$ are isomorphic:

If $K$ is a cyclic group and $\phi,\psi\colon K\rightarrow Aut(H)$ are two injective homomorphisms such that $\phi(K)=\psi(K)$, then these two homomorphisms give isomorphic semi-direct products of $H$ by $K$ (Alperin and Bell- Groups and Representations).

Now it is clear the existance and uniqueness (up to isomorphism) of non-abelian groups of order $pq$.
A: I'm going to use a few facts from group theory, which are certainly in Lang. Let me know if I can clear anything up!
It should be clear that a non-trivial homomorphism
$$
\mathbf Z/p\mathbf Z \to \operatorname{Aut}(\mathbf Z/q\mathbf Z)
$$
will answer your question in the affirmative. You could use such a map to finish your calculations, since it will necessarily be an injection and so the class of $-1$ will map to an automorphism which is not the identity, which must move $1$.
Recall that $\operatorname{Aut}(\mathbf Z/q\mathbf Z)$ is isomorphic to $(\mathbf Z/q\mathbf Z)^*$. Since $q$ is prime, the latter group is cyclic; we can identify it with $\mathbf Z/(q - 1)\mathbf Z$ if we choose a primitive root mod $q$. Now, to give a non-trivial homomorphism $\mathbf Z/p\mathbf Z \to \mathbf Z/(q - 1)\mathbf Z$ is to give an element of $\mathbf Z/(q - 1)\mathbf Z$ having period $p$. I claim that you can find $p - 1$ such elements if $p$ divides $q - 1$.
In your example, $3$ is a primitive root mod $7$ and we can send $1 \in \mathbf Z/3\mathbf Z$ to the automorphism of $\mathbf Z/7\mathbf Z$ given by $a \mapsto 9a = 2a$.
