TITLE: Is there a nontrivial semidirect product of two groups isomorphic to their direct product?
QUESTION [19 upvotes]: Suppose $N$ and $H$ are groups and $\phi: H \rightarrow \operatorname{Aut}(N)$ is a homomorphism. We know that $N \rtimes_{\phi} H = N \times H$ if and only if $\phi$ is trivial, but this question is a bit different.

Does $N \rtimes_{\phi} H \cong N \times H$ imply that $\phi$ is trivial? 

My first idea is that there should be a counterexample, but I haven't been able to figure out anything yet. 
Since nontrivial semidirect products are always nonabelian, we definitely need at least one of $N$ or $H$ nonabelian. I think finding a counterexample to the statement would also be equivalent to finding $G$ such that $G = NH = N'H'$ where 

$N \cap H = N' \cap H' = 1$
$N \cong N'$ and $H \cong H'$ 
$N, N', H' \trianglelefteq G$  but $H$ is not normal in $G$

REPLY [3 votes]: Here is just an elaboration of Derek Holt's answer:
Each $n\in N$ defines an inner automorphism
$$\sigma_n:N\to N,\qquad x\mapsto nxn^{-1}.$$
The function
$$\rho:N\to\operatorname{Inn}(N),\qquad n\mapsto\sigma_n$$
is then a (surjective) group homomorphism, and
$$\ker\rho=Z(N).$$
Now suppose that $Z(N)=1$. Then $\rho$ is an isomorphism. Now let
$$\phi:H\to\operatorname{Inn}(N)$$
be a group homomorphism. If $h\in H$, then $\phi(h)=\sigma_{\xi(h)}$ for some unique $\xi(h)\in N$. This defines a function
$$\xi:H\to G,$$
and since $\phi$ is a group homomorphism,
$$\sigma_{\xi(h_1h_2)}=\phi(h_1h_2)=\phi(h_1)\phi(h_2)=\sigma_{\xi(h_1)}\sigma_{\xi(h_2)}=\sigma_{\xi(h_1)\xi(h_2)}.$$
Since $\rho$ is an isomorphism, this implies that
$$\xi(h_1h_2)=\xi(h_1)\xi(h_2)$$
for all $h_1,h_2\in H$, i.e., $\xi$ is a group homomorphism. Now define
$$\psi:N\rtimes_\phi K\to N\times H,\qquad (n,h)\mapsto(n\xi(h),h),$$
and
$$\eta:N\rtimes_\phi K\leftarrow N\times H,\qquad (n\xi(h)^{-1},h)\mapsto(n,h).$$
One can check that $\psi$ and $\eta$ are group homomorphisms, and that they are inverses of each other.