Is semidirect product unique?

I find it helpful to distinguish between the inner semidirect product and the outer semidirect product. (Similiar to the distinction between the inner direct sum and the outer direct sum of vector (sub)spaces.)

Given a group $G$ and two subgroups $H$ and $N$ of $G$, the group $G$ is called the inner semidirect product of $H$ and $N$ with $N$ normal, if we have $NH = G$ and $H \cap N = 1$, and $N$ is normal in $G$. We then write $$ G = N \rtimes H \,. $$ (This notion of an inner semidirect product does not depend on any homomorphism.)

Given on the other hand any two groups $N$ and $H$ and a group homomorphism $\theta \colon H \to \operatorname{Aut}(N)$, the corresponding outer semidirect product $N \rtimes_\theta H$ is defined as the set $N \times H$ together with the multiplication $$ (n_1, h_1) \cdot (n_2, h_2) := (n_1 \theta(h_1)(n_2), h_1 h_2) \,. $$ Note that this group $N \rtimes_\theta H$ very much depends on $\theta$.

Now what is the connection between these two?

If $G$ is a group and $H$ and $N$ are two subgroups of $G$ such that $G = N \rtimes H$, then $N$ is normal in $G$. The conjugation action of $H$ on $G$ does therefore restrict to an action of $H$ on $N$. From this we get a group homomorphism $$ \theta \colon H \to \mathrm{Aut}(N) \quad\text{given by}\quad \theta(h)(n) = hnh^{-1} \,. $$ It can then be checked that the map $$ N \rtimes_\theta H \to G = N \rtimes H, \quad (n,h) \mapsto n \cdot h $$ is a group isomorphism. So every inner semidirect product can be seen as an outer semidirect product via the conjugation action of $H$ on $N$.

If on the other hand $N$ and $H$ are two groups and $\theta \colon H \to \operatorname{Aut}(N)$ a group homomorphism, then we can regard both $N$ and $H$ as subgroups $\widehat{N}$ and $\widehat{H}$ of the outer semidirect product $N \rtimes_\theta H$ via the inclusions \begin{alignat*}{2} N &\to N \rtimes_\theta H \,, &\quad n &\mapsto (n,1) \,, \\ H &\to N \rtimes_\theta H \,, &\quad h &\mapsto (1,h) \,. \end{alignat*} It then follows for those subgroup $\widehat{N}$ and $\widehat{H}$ that both $\widehat{N} \cdot \widehat{H} = \widehat{N} \rtimes_\theta \widehat{H}$ and $\widehat{N} \cap \widehat{H} = 1$, and that the subgroup $\widehat{N}$ is normal in $N \rtimes_\theta H$. The group $N \rtimes_\theta H$ is therefore the inner semidirect product of its subgroups $\widehat{N}$ and $\widehat{H}$, with $\widehat{N}$ normal.

PS: So given any two groups $H$ and $N$ there may exist multiple outer semidirect products $N \rtimes_\theta H$ because we can choose different group homomorphisms $\theta \colon H \to \operatorname{Aut}(N)$. But if we are given an inner semidirect product $G = N \rtimes H$ (i.e. we are given the group $G$ and its subgroups $H$ and $N$ such that $G = N \rtimes H$) then we are also implicitely given a group homomorphism $\theta \colon H \to \operatorname{Aut}(N)$ with $G \cong N \rtimes_\theta H$: The homomorphism $\theta$ is hidden in the group structure of $G$ and can be retrieved via the conjugation action of $H$ on $N$.


(A) You are right: semi-direct product of $H$ by $K$ depends on choice of homomorphism $\varphi\colon K\rightarrow Aut(H)$.

(B) When we start with group $G$, and subgroups $H,K$ with

(1) $H\trianglelefteq G$,

(2) $HK=G$,

(3) $H\cap K=1$,

then (the known group) $G$ is called as internal semi-direct product of $H$ by $K$. Here, we already know that $H$ is normal in $G$, hence every element $k\in K$ determines an automorphism of $H$: $h\mapsto khk^{-1}$. This gives a homomorphism $\varphi\colon K\rightarrow Aut(H)$.

(C) Suppose we don't know $G$, but we start with groups $H$ and $K$ (not subgroups), with a homomorphism $\varphi\colon K\rightarrow Aut(H)$ [like, in your question, see after ..for example...]. Then we can construct a group $G$ such that (roughly) $H$ and $K$ satisfy (1), (2) and (3) above. In this case, the constructed group $G$ is called as external semi-direct product of $H$ by $K$.