On Isomorphism Theorems, the recognition theorem for direct products said: if $H, K \le G$, $H \cap K = \{1\}$, $HK = G$, and $H, K \unlhd G$, then $G \cong H \times K$.
That theorem needs both subgroups to be normal, and a lot of groups don't cooperate. In $S_3$, take $H = \langle (1\ 2\ 3) \rangle$ and $K = \langle (1\ 2) \rangle$. They meet only at $e$, and $|HK| = 3 \cdot 2 = 6$, so $HK = S_3$. $H$ is normal (it has index $2$), but $K$ isn't, and $S_3$ is definitely not $C_3 \times C_2$, which is Abelian. So what is it?
The answer is a new way to multiply pairs, one that remembers how $K$ conjugates $H$. This page builds it, shows how to recognize it inside a group, and then uses it for the finale of the Groups section: a complete list of the groups of order $pq$.
The ingredients are two groups and a homomorphism $\varphi : K \rightarrow \operatorname{Aut}(H)$. So each $k \in K$ gets an automorphism of $H$, which we'll write $\varphi_k$ instead of $\varphi(k)$.
Suppose $H$ and $K$ are groups and that $\varphi : K \rightarrow \operatorname{Aut}(H)$ is a homomorphism. The semidirect product $H \rtimes_\varphi K$ is the set $\{(h, k) : h \in H, k \in K\}$ with the binary operation $$(h_1, k_1)(h_2, k_2) = (h_1 \varphi_{k_1}(h_2), k_1 k_2).$$
Compare it with $H \times K$, where the first coordinate would be plain old $h_1 h_2$. The only change is that $h_2$ has to get past $k_1$ before it meets $h_1$, and getting past $k_1$ twists it into $\varphi_{k_1}(h_2)$. The $K$ coordinates don't notice anything.
Four symbols of notation, $H \rtimes_\varphi K$, and the one that matters most is the tiny subscript that everybody drops.
Inside $H \rtimes_\varphi K$ sit copies of both ingredients: $\{(h, 1) : h \in H\}$ and $\{(1, k) : k \in K\}$. Both are subgroups. Since $\varphi_1 = \operatorname{id}_H$, $(h_1, 1)(h_2, 1) = (h_1 h_2, 1)$. And since an automorphism sends $1$ to $1$, $(1, k_1)(1, k_2) = (\varphi_{k_1}(1), k_1 k_2) = (1, k_1 k_2)$. From now on, $H$ and $K$ also stand for these two copies.
If $H, K$ are groups and $\varphi : K \rightarrow \operatorname{Aut}(H)$ is a homomorphism, then:
Part (ii) is why the symbol is $\rtimes$ and not $\times$: the little $\lhd$ hiding inside it points at the normal factor, just like in $H \unlhd G$.
Proof. (i) Associativity. $$\begin{align*} (h_1, k_1)\big((h_2, k_2)(h_3, k_3)\big) &= (h_1, k_1)(h_2 \varphi_{k_2}(h_3), k_2 k_3) = \big(h_1 \varphi_{k_1}(h_2 \varphi_{k_2}(h_3)), k_1 k_2 k_3\big), \\ \big((h_1, k_1)(h_2, k_2)\big)(h_3, k_3) &= (h_1 \varphi_{k_1}(h_2), k_1 k_2)(h_3, k_3) = \big(h_1 \varphi_{k_1}(h_2) \varphi_{k_1 k_2}(h_3), k_1 k_2 k_3\big). \end{align*}$$ These agree, because $$\varphi_{k_1}(h_2 \varphi_{k_2}(h_3)) = \varphi_{k_1}(h_2)\, \varphi_{k_1}(\varphi_{k_2}(h_3)) = \varphi_{k_1}(h_2)\, \varphi_{k_1 k_2}(h_3).$$ The first step holds because $\varphi_{k_1} \in \operatorname{Aut}(H)$ is a homomorphism $H \rightarrow H$, and the second because $\varphi : K \rightarrow \operatorname{Aut}(H)$ is a homomorphism, so $\varphi_{k_1} \circ \varphi_{k_2} = \varphi_{k_1 k_2}$. $\checkmark$
Identity. $(1, 1)(h, k) = (1 \cdot \varphi_1(h), 1 \cdot k) = (h, k)$, since $\varphi_1 = \operatorname{id}_H$ is the identity element of $\operatorname{Aut}(H)$. And $(h, k)(1, 1) = (h \varphi_k(1), k) = (h, k)$. $\checkmark$
Inverses. Given $(h, k)$, take $(h, k)^{-1} = (\varphi_{k^{-1}}(h^{-1}), k^{-1})$. Note $\varphi_{k^{-1}} = \varphi_k^{-1}$, since $\varphi$ is a homomorphism. Then $$(\varphi_{k^{-1}}(h^{-1}), k^{-1})(h, k) = (\varphi_{k^{-1}}(h^{-1})\, \varphi_{k^{-1}}(h), 1) = (\varphi_{k^{-1}}(h^{-1} h), 1) = (1, 1),$$ $$(h, k)(\varphi_{k^{-1}}(h^{-1}), k^{-1}) = (h\, \varphi_k(\varphi_k^{-1}(h^{-1})), 1) = (h h^{-1}, 1) = (1, 1). \ \checkmark$$
(ii) $\forall (h_0, 1) \in H$ and $(h, k) \in H \rtimes_\varphi K$, $$\begin{align*} (h, k)(h_0, 1)(h, k)^{-1} &= (h, k)(h_0, 1)(\varphi_k^{-1}(h^{-1}), k^{-1}) \\ &= (h \varphi_k(h_0), k)(\varphi_k^{-1}(h^{-1}), k^{-1}) \\ &= (h \varphi_k(h_0)\, \varphi_k(\varphi_k^{-1}(h^{-1})), k k^{-1}) \\ &= (h \varphi_k(h_0) h^{-1}, 1) \in H. \ \checkmark \end{align*}$$
(iii) This is the computation in (ii) with $h = 1$ and $h_0 = h$. $\blacksquare$
Part (iii) is the whole idea. Inside $H \rtimes_\varphi K$, conjugating by $k$ is $\varphi_k$. We built a group where $K$ conjugates $H$ exactly the way $\varphi$ told it to.
Below, $H = C_q = \langle a \rangle$ and $K = C_p = \langle x \rangle$, and $\varphi_x$ is the automorphism $a \mapsto a^r$. Pick two elements and multiply them both ways, in the direct product and in the semidirect product.
With $r = 1$, the two columns always agree, and the order you multiply in never matters. With any other $r$, the semidirect column twists $h_2$ before using it, and it's easy to find pairs with $g_1 g_2 \neq g_2 g_1$. The next section turns that observation into a theorem.
If every $\varphi_k$ is the identity, the twist does nothing and the formula collapses to $(h_1 h_2, k_1 k_2)$. It turns out that's the only way to get a direct product.
So the direct product was a semidirect product the whole time, with $\varphi$ asleep on the job.
Suppose $H, K$ are groups and $\varphi : K \rightarrow \operatorname{Aut}(H)$ is a homomorphism. Then the following are equivalent:
Proof. (ii) $\Rightarrow$ (i). If every $\varphi_k = \operatorname{id}_H$, the operation is $(h_1, k_1)(h_2, k_2) = (h_1 h_2, k_1 k_2)$, which is the operation of $H \times K$. So the identity map on pairs is an isomorphism.
(i) $\Rightarrow$ (iii). $K = \{(1, k)\}$ is normal in $H \times K$: $(h, k')(1, k)(h, k')^{-1} = (1, k'kk'^{-1})$. If the identity map on pairs is an isomorphism, the two operations agree, so conjugation in $H \rtimes_\varphi K$ is the same computation, and $K \unlhd H \rtimes_\varphi K$.
(iii) $\Rightarrow$ (ii). Let $h \in H$ and $k \in K$, and look at the commutator $c = (1, k)(h, 1)(1, k)^{-1}(h, 1)^{-1}$. Group it two ways:
But $H \cap K = \{(1, 1)\}$, since $(h, 1) = (1, k)$ forces $h = 1$ and $k = 1$. So $c = (1, 1)$, which means $\varphi_k(h) h^{-1} = 1$, i.e. $\varphi_k(h) = h$. This holds for every $h$, so $\varphi_k = \operatorname{id}_H$ for every $k$: $\varphi$ is trivial. $\blacksquare$
That's the same commutator trick as Step 1 in the proof of the Internal Direct Product Theorem on Isomorphism Theorems: if both subgroups are normal, $hkh^{-1}k^{-1}$ lands in both, so it's $e$.
An Abelian group has every subgroup normal, including $K$. So a nontrivial twist always costs you commutativity.
If $\varphi$ is nontrivial, then $H \rtimes_\varphi K$ is non-Abelian.
Proof. If $H \rtimes_\varphi K$ were Abelian, every subgroup would be normal, including $K$. Then (iii) $\Rightarrow$ (ii) says $\varphi$ is trivial. $\blacksquare$
The corollary is a factory for non-Abelian groups: find a nontrivial homomorphism $K \rightarrow \operatorname{Aut}(H)$, and you get a non-Abelian group of order $|H||K|$ for free. Start with the smallest one possible.
Let $H = C_3 = \langle x \rangle$ and $K = C_2 = \langle y \rangle$, and define $\varphi : K \rightarrow \operatorname{Aut}(H)$ by $\varphi_y(x) = x^{-1}$. Show that $H \rtimes_\varphi K \cong S_3$.
$\varphi_y$ is an automorphism. Inversion $\iota(h) = h^{-1}$ is a homomorphism because $H$ is Abelian: $\iota(gh) = h^{-1}g^{-1} = g^{-1}h^{-1} = \iota(g)\iota(h)$. It's a bijection because $\iota \circ \iota = \operatorname{id}_H$. And $\varphi_y = \iota$, since both send $x \mapsto x^{-1}$ (Property 6a on Homomorphisms).
$\varphi$ is a homomorphism. $K = \langle y \mid y^2 = 1 \rangle$, and $\iota^2 = \operatorname{id}_H$ satisfies the same relation, so $y \mapsto \iota$ extends to a homomorphism (Property 6b on Homomorphisms).
Which group. $\iota(x) = x^2 \neq x$, so $\varphi$ is nontrivial, and by the corollary $H \rtimes_\varphi K$ is a non-Abelian group of order $6$. The only one is $S_3 \cong D_6$. $\checkmark$
The table on Groups of Order 4–8 listed exactly two groups of order $6$: $C_6 \cong C_2 \times C_3$ and $D_6 \cong S_3$. Here, part (iii) of the proposition reads $(1, y)(x, 1)(1, y)^{-1} = (x^{-1}, 1)$, which is the familiar $srs^{-1} = r^{-1}$: a reflection turns a rotation around.
The same move works whenever $\operatorname{Aut}(H)$ has room for a copy of something of order $p$. For $H = C_q$, the Automorphisms page computed exactly how much room there is.
Automorphisms showed $\operatorname{Aut}(\mathbb{Z}/q\mathbb{Z}) \cong (\mathbb{Z}/q\mathbb{Z})^\times$, and the Primitive Root Theorem makes that cyclic of order $q - 1$ when $q$ is prime. Its Sneak Peek promised to build a non-Abelian group of order $pq$ when $p \mid q - 1$. Promise kept:
Suppose $n = pq$, where $p < q$ are prime and $p \mid q - 1$. Show that there is a non-Abelian group of order $n$.
Proof. Let $K = C_p = \langle x \rangle$ and $H = C_q$. Then $\operatorname{Aut}(H) \cong (\mathbb{Z}/q\mathbb{Z})^\times \cong C_{q-1}$ (Primitive Root Theorem, since $q$ is prime). Since $p \mid q - 1$, $\operatorname{Aut}(H)$ has an element of order $p$: if $\sigma$ generates it, take $\Psi = \sigma^{(q-1)/p}$.
Let $\varphi : K \rightarrow \operatorname{Aut}(H)$ be the homomorphism determined by $\varphi(x) = \Psi$. It exists by Property 6b, because $K = \langle x \mid x^p = 1 \rangle$ and $\Psi^p = \operatorname{id}_H$. Since $\Psi \neq \operatorname{id}_H$, $\varphi$ is nontrivial, so $H \rtimes_\varphi K$ is a non-Abelian group of order $|H||K| = pq$. $\blacksquare$
For $p = 2$, every odd prime $q$ works ($2 \mid q - 1$ always), and the only element of order $2$ in a cyclic group of order $q - 1$ is inversion. That's the first example all over again, with $C_q$ in place of $C_3$. For $p = 3$, the first case is $q = 7$: a non-Abelian group of order $21$. We'll write it down at the end of the page.
So far we've built semidirect products from scratch. The other direction is more useful: spot one hiding inside a group you already have. In $S_3$, the subgroups $H = \langle (1\ 2\ 3) \rangle$ and $K = \langle (1\ 2) \rangle$ fill up the group without overlapping. There's a name for that.
We've met this word before. On Finite Abelian Groups, the proof of the classification peeled off one cyclic factor at a time by finding a complement for it. There, everything was Abelian, so every complement gave a direct product.
If $H \le G$, a complementary subgroup is a subgroup $K \le G$ with $HK = G$ and $H \cap K = \{e\}$.
The recognition theorem for direct products needed both $H$ and $K$ normal. Drop "$K$ normal," and you get a semidirect product, with $\varphi$ being conjugation.
The "Conjugating a Normal Subgroup" proposition on Automorphisms: if $H \unlhd G$, then each $g \in G$ conjugates $H$ by an automorphism, and $g \mapsto (h \mapsto ghg^{-1})$ is a homomorphism $G \rightarrow \operatorname{Aut}(H)$. Restrict it to $K$, and that's the $\varphi$ below.
If $H$ and $K$ are complementary subgroups of $G$ and $H \unlhd G$, then $G \cong H \rtimes_\varphi K$, with $\varphi : K \rightarrow \operatorname{Aut}(H)$ defined by $k \mapsto (h \mapsto khk^{-1})$.
Proof. The facts that $HK = G$ and $H \cap K = \{e\}$ guarantee that every element $g \in G$ has a unique representation $g = hk$ with $h \in H$, $k \in K$. It exists because $G = HK$. For uniqueness, suppose $hk = h'k'$. Then $(h')^{-1}h = k'k^{-1} \in H \cap K = \{e\}$, so $h' = h$ and $k' = k$.
Define $\tau : G \rightarrow H \rtimes_\varphi K$ by $\tau(hk) = (h, k)$. It's well defined and injective by uniqueness, and surjective since every pair $(h, k)$ comes from $hk$. To see that it's a homomorphism, slide $k$ past $h'$ by conjugating (the result $kh'k^{-1}$ is still in $H$, since $H \unlhd G$): $$\tau(hk\,h'k') = \tau\big((h\, kh'k^{-1})(kk')\big) = (h\, kh'k^{-1}, kk') = (h \varphi_k(h'), kk') = (h, k)(h', k'). \ \checkmark \ \blacksquare$$
That first equation is the whole story of semidirect products in one line: to multiply $hk \cdot h'k'$, you push $h'$ leftward past $k$, and it comes out conjugated. Dihedral groups are the cleanest example.
Show that $D_{2n} \cong C_n \rtimes_\varphi C_2$, where $C_2$ acts on $C_n$ by inversion.
Let $H = \langle r \rangle \cong C_n$ and $K = \langle s \rangle \cong C_2$. $H$ has index $2$, so $H \unlhd D_{2n}$. $s \notin H$ (it's a reflection), so $H \cap K = \{e\}$, and by the Product Formula $|HK| = \frac{n \cdot 2}{1} = 2n$, so $HK = D_{2n}$. By the Recognition Theorem, $D_{2n} \cong H \rtimes_\varphi K$ with $\varphi_s(h) = shs^{-1}$. From $rs = sr^{-1}$ we get $srs^{-1} = srs = s(sr^{-1}) = r^{-1}$, so $\varphi_s$ is inversion. $\checkmark$
In the widget, every element of $D_{2n}$ is written in the form $hk = r^i s^j$ that the proof uses (on other pages we wrote reflections as $sr^i$; since $sr^i = r^{-i}s$, it's the same list). Before revealing the product $g_1 g_2$, predict its $H$-part.
The tempting guess is $r^{i + m}$: just add the rotations. It's right whenever $k_1 = e$, and wrong whenever $k_1 = s$ and $h_2 \neq h_2^{-1}$, because then $h_2$ comes out of the swap inverted.
Now the finale. A group of order $pq$ will turn out to be $C_q \rtimes_\varphi C_p$ for some $\varphi$, so the question becomes: how many really different $\varphi$'s are there? Lots of them give the same group, because of one simple trick: rename the generator of $K$.
Let $\varphi : K \rightarrow \operatorname{Aut}(H)$ be a homomorphism and $\beta \in \operatorname{Aut}(K)$. Then $$H \rtimes_{\varphi \circ \beta} K \cong H \rtimes_\varphi K, \quad \text{via } (h, k) \mapsto (h, \beta(k)).$$
Proof. Let $\psi = \varphi \circ \beta$, so $\psi_k = \varphi_{\beta(k)}$, and let $f(h, k) = (h, \beta(k))$. It's a bijection, with inverse $(h, k) \mapsto (h, \beta^{-1}(k))$. And $$f\big((h_1, k_1)(h_2, k_2)\big) = f(h_1 \psi_{k_1}(h_2), k_1 k_2) = (h_1 \varphi_{\beta(k_1)}(h_2), \beta(k_1)\beta(k_2)) = (h_1, \beta(k_1))(h_2, \beta(k_2)). \ \blacksquare$$
Here's how we'll use it. If $K = \langle x \rangle$ and $\varphi(x) = \Psi^k$, use a different generator $x' = x^m$. Then $\varphi(x') = \Psi^{km}$, and if $km \equiv 1$, the "same" group now has $x'$ acting by $\Psi$. Try it below with $H = C_q = \langle a \rangle$, $K = C_p = \langle x \rangle$, and $\Psi$ the automorphism $a \mapsto a^r$.
For $(p, q) = (3, 5)$, only $r = 1$ works, so the only option is the direct product. For $(3, 7)$, there are three choices, $r = 1, 2, 4$, but $r = 2$ and $r = 4$ are the same group wearing different name tags. That's the whole theorem, in two examples.
Suppose $n = pq$, where $p < q$ are prime.
The proof uses three theorems from earlier pages. Cauchy's theorem (Finite Abelian Groups) finds the subgroups. The smallest prime index theorem (Group Actions) makes $H$ normal. The Product Formula (Isomorphism Theorems) shows the pieces fill the group.
Proof. Suppose $G$ is a group of order $n$. Let $H \le G$ be a subgroup of order $q$ and $K \le G$ a subgroup of order $p$ (these exist by Cauchy's theorem). Then:
By the Recognition Theorem, $G \cong H \rtimes_\varphi K$ for some homomorphism $\varphi : K \rightarrow \operatorname{Aut}(H)$. (Since $H \cong C_q$ and $K \cong C_p$, relabeling turns this into $C_q \rtimes C_p$ for a matching homomorphism, so we're really asking about homomorphisms $C_p \rightarrow \operatorname{Aut}(C_q)$.)
What are the possible homomorphisms $\varphi : K \rightarrow \operatorname{Aut}(H)$? Write $K = \langle x \rangle$. By Property 6a, $\varphi$ is determined by $\varphi(x)$, whose order divides $|x| = p$. Also $\operatorname{Aut}(H) \cong (\mathbb{Z}/q\mathbb{Z})^\times$ is a cyclic group of order $q - 1$, so the order of $\varphi(x)$ divides $q - 1$ (Lagrange).
(i) If $p \nmid q - 1$, then $\varphi(x)$ has order dividing $\gcd(p, q - 1) = 1$. So the only homomorphism $\varphi : K \rightarrow \operatorname{Aut}(H)$ is the trivial one, and $G \cong H \times K$. That's cyclic: if $H = \langle a \rangle$, then $(a, x)$ has order $\operatorname{lcm}(q, p) = pq$. So $G \cong C_n$.
(ii) If $p \mid q - 1$, then since $\operatorname{Aut}(H)$ is cyclic, it has exactly one subgroup of order $p$; call it $\langle \Psi \rangle$. The element $\varphi(x)$ has order $1$ or $p$, so either $\varphi(x) = \operatorname{id}_H$ or $\langle \varphi(x) \rangle$ is a subgroup of order $p$, which must be $\langle \Psi \rangle$. Either way $\varphi(x) \in \langle \Psi \rangle$, so the homomorphisms are determined by $\varphi(x) = \Psi^k$, $0 \le k \le p - 1$. Call that one $\varphi^{(k)}$.
So every group of order $n$ is $C_n$ or that one non-Abelian group. They're different (one is Abelian and one isn't), and both exist (the non-Abelian one by the earlier example). Exactly $2$. $\blacksquare$
Part (i) was the long proof on Automorphisms, with centers, centralizers, and a contradiction. Here it's one line: there's no room for a nontrivial $\varphi$, so the group is a direct product.
So $15$, $33$, $35$, $51$ allow only the cyclic group, while $6$, $10$, $14$, $21$, $22$, $39$ allow exactly one more. Here's the smallest odd one, written out.
Describe the two groups of order $21$.
$21 = 3 \cdot 7$ and $3 \mid 6$, so there are exactly two. One is $C_{21}$. For the other, let $H = C_7 = \langle a \rangle$ and $K = C_3 = \langle x \rangle$. The automorphisms of $H$ are $a \mapsto a^r$ for $r \in (\mathbb{Z}/7\mathbb{Z})^\times$, and the ones of order dividing $3$ have $r^3 \equiv 1 \pmod 7$: $r = 1, 2, 4$. Take $\varphi_x(a) = a^2$. Then $$(a^i, x^j)(a^m, x^l) = (a^{i + 2^j m}, x^{j + l}),$$ with exponents of $a$ mod $7$ and of $x$ mod $3$. For example, $(1, x)(a, 1) = (a^2, x)$, but $(a, 1)(1, x) = (a, x)$: non-Abelian, as promised. In generators and relations, it's $\langle a, x \mid a^7 = x^3 = 1,\ xax^{-1} = a^2 \rangle$.
Choosing $r = 4$ instead gives nothing new: with $x' = x^2$, $\varphi_{x'}(a) = a^{4^2} = a^{16} = a^2$.
$S_3$, the first non-Abelian group we ever met, was a semidirect product all along. Nobody told it.
And that's the end of the Groups section. Starting from the group axioms, we can now list every group of order $pq$ by hand, and the tools that did it (Lagrange, Cauchy, group actions, automorphisms, and now semidirect products) are the same ones every deeper classification is built on.
The first exercise is the theorem with $p = 2$. The second finds a semidirect product inside $S_n$, and the third is a semidirect product every group comes with.
Let $q$ be an odd prime. Show that every group of order $2q$ is isomorphic to $C_{2q}$ or $D_{2q}$.
Proof. Here $p = 2 < q$ and $2 \mid q - 1$, so by the theorem there are exactly two groups of order $2q$: $C_{2q}$ and $C_q \rtimes_\varphi C_2$ for any nontrivial $\varphi$. In the cyclic group $\operatorname{Aut}(C_q) \cong C_{q-1}$ there is exactly one element of order $2$. Inversion $\iota$ is one: it's an automorphism since $C_q$ is Abelian, $\iota^2 = \operatorname{id}$, and $\iota \neq \operatorname{id}$ since $a^{-1} \neq a$ for a generator $a$ (as $q > 2$). So the nontrivial $\varphi$ sends the generator of $C_2$ to $\iota$, and $C_q \rtimes_\varphi C_2 \cong D_{2q}$ by the dihedral example. $\blacksquare$
Let $n \ge 2$. Show that $S_n \cong A_n \rtimes_\varphi C_2$ for some homomorphism $\varphi : C_2 \rightarrow \operatorname{Aut}(A_n)$. What does $\varphi$ do?
Let $H = A_n$ and $K = \langle (1\ 2) \rangle \cong C_2$. $|S_n : A_n| = 2$, so $A_n \unlhd S_n$. $(1\ 2)$ is odd, so $A_n \cap K = \{e\}$. By the Product Formula, $|A_n K| = \frac{(n!/2) \cdot 2}{1} = n!$, so $A_n K = S_n$, and $K$ is a complementary subgroup. The Recognition Theorem gives $S_n \cong A_n \rtimes_\varphi K$, where $\varphi_{(1\ 2)}$ is conjugation by $(1\ 2)$: $\sigma \mapsto (1\ 2)\sigma(1\ 2)$.
For $n = 3$, this is the first example again: $A_3 = \langle (1\ 2\ 3) \rangle \cong C_3$, and $(1\ 2)(1\ 2\ 3)(1\ 2) = (1\ 3\ 2) = (1\ 2\ 3)^{-1}$, so $\varphi$ is inversion.
One more definition, which makes a good exercise. Take $K$ to be all of $\operatorname{Aut}(H)$, and let $\varphi : \operatorname{Aut}(H) \rightarrow \operatorname{Aut}(H)$ be the identity map, so each automorphism acts as itself. Then $H \rtimes_\varphi \operatorname{Aut}(H)$ is called the holomorph of $H$, written $\operatorname{Hol}(H)$.
(a) Write out the multiplication in $\operatorname{Hol}(H)$, and show $|\operatorname{Hol}(H)| = |H| \cdot |\operatorname{Aut}(H)|$ when $H$ is finite.
(b) Show that $\operatorname{Hol}(\mathbb{Z}/3\mathbb{Z}) \cong S_3$ and $\operatorname{Hol}(\mathbb{Z}/4\mathbb{Z}) \cong D_8$.
(a) Since $\varphi_\sigma = \sigma$, the product is $(h_1, \sigma_1)(h_2, \sigma_2) = (h_1\, \sigma_1(h_2), \sigma_1 \circ \sigma_2)$. As a set, $\operatorname{Hol}(H)$ is all pairs $(h, \sigma)$, so $|\operatorname{Hol}(H)| = |H| \cdot |\operatorname{Aut}(H)|$.
(b) For $n = 3$ or $4$, $\operatorname{Aut}(\mathbb{Z}/n\mathbb{Z}) \cong (\mathbb{Z}/n\mathbb{Z})^\times = \{1, n - 1\}$. The automorphism for $n - 1 \equiv -1$ is $k \mapsto -k$, which is inversion (written additively). So $\operatorname{Aut}(\mathbb{Z}/n\mathbb{Z}) = \{\operatorname{id}, \iota\} \cong C_2$, and $\operatorname{Hol}(\mathbb{Z}/n\mathbb{Z}) = \mathbb{Z}/n\mathbb{Z} \rtimes C_2$ with the generator acting by inversion. By the dihedral example, that's $D_{2n}$: $D_6 \cong S_3$ for $n = 3$, and $D_8$ for $n = 4$.
$D_8$ and $Q_8$ both have a cyclic normal subgroup of order $4$ with quotient $C_2$. $D_8$ is a semidirect product $C_4 \rtimes C_2$. Is $Q_8$?
Prove that $Q_8$ is not isomorphic to $H \rtimes_\varphi K$ for any nontrivial groups $H$, $K$ and any homomorphism $\varphi : K \rightarrow \operatorname{Aut}(H)$.
Hint: how many elements of order $2$ does $Q_8$ have?
Proof. Suppose $Q_8 \cong H \rtimes_\varphi K$ with $H, K$ nontrivial. Inside $H \rtimes_\varphi K$, the copies $\{(h, 1)\}$ and $\{(1, k)\}$ are subgroups with trivial intersection whose product is everything, since $(h, 1)(1, k) = (h, k)$. The isomorphism carries them to subgroups $H', K' \le Q_8$ with $H' \cap K' = \{1\}$ and $H'K' = Q_8$, both nontrivial. By the Product Formula, $|H'||K'| = 8$, so one of them has order $2$ and the other has order $4$.
But $Q_8$ has only one element of order $2$, namely $-1$, so its only subgroup of order $2$ is $\{\pm 1\}$. A subgroup of order $4$ is $C_4$ or $V_4$; it can't be $V_4$, which has three elements of order $2$. So it's cyclic, generated by an element of order $4$: one of $\pm i, \pm j, \pm k$. Each of these squares to $-1$, so every subgroup of order $4$ contains $\{\pm 1\}$. So $H' \cap K' \supseteq \{\pm 1\}$, a contradiction. $\blacksquare$
So $Q_8$ has a normal subgroup $\langle i \rangle$ with quotient $C_2$, but no complement to go with it. Knowing a normal subgroup and its quotient isn't enough to rebuild a group, and semidirect products don't reach every group.