TITLE: Expanding an isomorphism between subgroups of $G$ to an automorphism on $G$
QUESTION [7 upvotes]: Question
Let $G$ be some finite group, $H_1, H_2 \leq G$ and $\phi:H_1 \mapsto H_2$ be a group isomorphism. Is it always possible to expand $\phi$ to an automorphism on $G$?
Explicitly, is there an automorphism $\sigma \in Aut_G$ s.t $\sigma \vert _{H_1}=\phi$?
Efforts so far
At first I considered defining $\sigma$ by letting $$\sigma\left(g\right)=\begin{cases}
\phi\left(g\right) & g\in H_{1}\\
\phi^{-1}\left(g\right) & g\in H_{2}\\
g & else
\end{cases}$$
but obviously such a $\sigma$ is not well-defined for elements in $H_1 \cap H_2$ (other than $e$). I then tried $$\sigma\left(g\right)=\begin{cases}
\phi\left(g\right) & g\in H_{1}\setminus H_{2}\\
\phi^{-1}\left(g\right) & g\in H_{2}\setminus H_{1}\\
g & else
\end{cases}$$
but then I'm unable to prove injectivity, for example when $x\in H_{1}\setminus H_{2},y\in H_{1}\cap H_{2}$ we get $\sigma\left(x\right)=\phi\left(x\right),\sigma\left(y\right)=y$ so it is unclear why $\sigma\left(x\right)\neq\sigma\left(y\right)$.
Right now I'm questioning the truthfulness of the claim. But perhaps it's just my constructive proof that's wrong?

REPLY [3 votes]: It's actually kind of hard to get even an automorphism of a subgroup that extends to an automorphism of the entire group (and when that is possible, there are usually many ways to do the extension part). There are some pretty strong conditions that are necessary for what you're asking about (isomorphism of subgroups extending to automorphism of whole group) to even be possible. First, there has to be an automorphism of $G$ which maps the subgroup $H_1$ to $H_2$, which requires that the subgroup lattice 'looks the same' (up to isomorphism types) from the perspective of either subgroup (giving a technical description of what 'looks the same' actually is, is a bit difficult and tedious, but if you look at enough reasonably small subgroup lattices, you should be able to intuit what all has to happen). Moreover, the 'looks the same' condition carries over to the subgroups of $H_1$ and their corresponding subgroups for $H_2$ (which limits which isomorphisms between them will work when it even is possible to do this).