Can the semidirect product of two groups be abelian group?

while I was working through the examples of semidirect products of Dummit and Foote, I thought that it’s possible to show that any semdirect product of two groups can’t be abelian if the this semidirect product is not the direct product.

Here is my simple idea:

Suppose $H,K$ are two groups and $H\rtimes K$ be the semidirect product of $H$ and $K$. Let $f:K \rightarrow Aut(H)$ be our homomorphism from $K$ into $Aut(H)$, now we know that $H \unlhd H\rtimes K$ but not necessarily $K$.

If $H\rtimes K$ is abelian, then every subgroup of it is normal, so $K$ must be normal but if $K$ is normal then $f$ is the trivial homomorphism and so the semidirect product turns into the direct product, so the semdidirect product in this case is the direct product, which is a contradiction since we supposed that this semidirect product of $H,K$ is not their direct product.

Is this true? Or have I made a mistake and there exists a counterexample?

Solutions Collecting From Web of "Can the semidirect product of two groups be abelian group?"

You are correct. A semi-direct product of $H$ and $K$ is abelian iff $H$ is abelian, $K$ is abelian, and the semi-direct product is explicitly direct (the action is trivial).

When $H$ and $K$ are not abelian you can have bizarre things like $H \rtimes K$ is (isomorphic to) a direct product of $H$ and $K$, even though the action is not trivial. Take $H=K$ for example (to be non-abelian of order 6 to make it nice and clear). I learned this for $A_5 \rtimes A_5$, and was recently reminded it was true for all non-abelian groups $H=K$.

Sure. $H\rtimes_\theta K$ is abelian if and only if $H$ and $K$ are abelian and $\theta$ is the trivial homomorphism.

This is pretty easy to prove, so you should try to. Below is the solution if you get stuck.

Sufficiency is obvious. For necessity, if $\theta$ is nontrivial, then some $k\in K$ maps to some $\operatorname{id}\ne \theta_k\in \operatorname{Aut}(H)$, which means that $\theta_k(h)\ne h$ for some $h\in H$. Thus $hk=k\theta_k(h)\ne kh$, so we have two elements that don’t commute.