If $H,K$ are finite groups with $\text{gcd}(|H|,|K|)=1$, then $\text{Aut}(H \times K) \cong \text{Aut}(H) \times \text{Aut}(K)$. I have a proof, but it doesn't seem to use the fact that $\text{gcd}(|H|,|K|)=1$, and I can't seem to see where my argument is wrong.
Here is what I did:  Define the map $\iota: \text{Aut}(H) \times \text{Aut}(K) \hookrightarrow \text{Aut}(H \times K)$ by $(\varphi_H,\varphi_K) \mapsto \varphi_H \times \varphi_K \in \text{Aut}(H \times K)$ where $\varphi_H \times \varphi_K: H \times K \longrightarrow H \times K$ is given by $(h,k) \mapsto (\varphi_H(h),\varphi_K(k))$.  Clearly $\iota$ is a monomorphism, so we only need to show that $\iota$ is onto. Let $\xi \in \text{Aut}(H \times K)$.  Let $\pi_H: H \times K \longrightarrow H$ and $\pi_K: H \times K \longrightarrow K$ be the canonical projections, and define the maps $\varphi_H: H \longrightarrow H$ and $\varphi_K: K \longrightarrow K$ given by $\varphi_H(h) = \pi_H(\xi(h,e_K))$ and $\varphi_K(k) = \pi_K(\xi(e_H,k))$.
Suppose that $h_1=h_2$.  Then $\xi(h_1,e_K) = \xi(h_2,e_K)$ and hence $\pi_{H}(\xi(h_1,e_K)) = \pi_H(\xi(h_2,e_K))$ since $\xi,\pi_H$ are well defined.  Hence $\varphi_H$ is well defined.  Also: $$\varphi_H(h_1h_2) = \pi_H(\xi(h_1h_2,e_K)) = \pi_H\bigg(\xi\big((h_1,e_K)(h_2,e_K)\big)\bigg)$$ $$= \pi_H \bigg(\xi(h_1,e_K)\xi(h_2,e_K) \bigg) = \pi_H(\xi(h_1,e_K))\pi_H(\xi(h_2,e_K)) = \varphi(h_1)\varphi(h_2).$$ Hence $\varphi$ is a homomorphism. Let $h \in H$ be arbitrary, and consider $(h,e_K)$.  Since $\xi$ is an automorphism, there exists a $h' \in H$ such that $\xi(h',e_K) = (h,e_K)$, and thus $\pi_H(\xi(h',e_K)) = \pi_H((h,e_K)) = h$.  Thus $\varphi_H$ is onto.  Finally, suppose that $\varphi(h)=e_H$.  Then $\pi_H(\xi(h,e_K)) = e_H$.  Since $\pi_H|_{H \times \{e_K\}}$ is an isomorphism onto its image $H$, we conclude that $\xi(h,e_K)= (e_H,e_K)$.  Since $\xi$ is injective, this implies that $h=e_H$.  Hence $\varphi_H$ is an automorphism.  Similarly $\varphi_K$ is an automorphism of $K$. Hence the map $\varphi_H \times \varphi_K$ is an automorphism with $\varphi_H \times \varphi_K = \xi$.
I'm not sure what I'm missing from this argument. Where am I going wrong?  Thank you.
 A: Hint
Any endomorphism of $G×H$ can be written as a $2×2$ matrix of the form $$\begin {pmatrix}\alpha \quad \beta \\\gamma\quad \delta\end {pmatrix}$$, with $\alpha $ an endomorphism of $G$, $\delta $ an endomorphism of $H$, $\beta: H\to G$ a homomorphism,  and $\gamma: G\to H$ a homomorphism.   See here.
Anyway,  the condition on the orders of the groups means $\beta,\gamma $ are trivial.
A: So I think I figured it out after looking at a counter example as to why we need $\text{gcd}(|H|,|K|)=1$. It doesn't follow necessarily that $\xi(h,e_K) \in H \times \{e_K\}$ or $\xi(e_H,k) \in \{e_H\} \times K$.
But since $\text{gcd}(|H|,|K|)=1$, and $(h,k) \in H \times K$, we conclude $(h,k)$ has order $|(h,k)| = \text{lcm}(|h|,|k|)$.  Hence for any element of the form $(h,e_K)$, $|(h,e_K)| = |h| \not\mid |K|$, so for any automorphism $\xi \in \text{Aut}(H \times K)$: $$|\xi((h,e_K))| = |(h,e_K)| = |h| \implies \xi(h,e_K) \in H \times e_K$$ otherwise if $\xi(h,e_K) = (h',k') \in H \times K \setminus \{(e_H,e_K)\}$, then:
$$\begin{align}
|\xi(h,e_K)| = |(h',k')| &\implies (h',k')^{|h|} = (e_H,e_K)\\
 &\implies |k'| \mid |h| \mid |H|\\
& \implies |k'| \mid |H|
\end{align}$$
which contradicts that $\text{gcd}(|H|,|K|)=1$. Then I'm allowed to use the fact that $\pi_H|_{H \times \{e_K\}}$ is an isomorphism onto its image.
If this is correct, I'd really appreciate some feedback confirming or denying this, thanks!
