Given $G,H_1,H_2$ finite abelian groups and $G\times H_1 \cong G\times H_2$ then $H_1 \cong H_2$ 
Given $G,H_1,H_2$ finite abelian groups and $G\times H_1 \cong G\times H_2$
  Show $H_1 \cong H_2$

I think the proof would go something like this:
$H_1\cong(G\times H_1)/(G\times\{e_{H_1}\})\cong(G\times H_2)/(G\times\{e_{H_2}\})\cong H_2$
Though the first and third isomorphisms are somewhat obvious, I'm doubtful about the second isomorphism because
Given $\Phi:G_1 \to G_2$ is an isomorphism, I only know that (this is a guess) $G_1/H\cong G_2/\Phi(H)$ (is this true? I have not verified)
But $\Phi((G,e_{H_1}))$ may not be equal to $(G, e_{H_2})$
So how do I show this?
 A: Let $G,H_1,H_2$ be finite abelian groups. Let $\Phi$ be an isomorphism as follows
$$\Phi:G\times H_1\to G\times H_2$$
We write $\Phi$ as its components: $\Phi=(\Phi_1,\Phi_2)$ where
$$\Phi_1:G\times H_1\to G,\quad\Phi_2:G\times H_1\to H_2$$
are surjective group homomorphisms. Then they induce isomorphisms
$$G\cong\frac{G\times H_1}{\ker\Phi_1},\quad H_2\cong\frac{G\times H_1}{\ker\Phi_2}$$

Lemma 1. The following are isomorphisms
  $$\phi_1=\Phi_1|_{\ker\Phi_2}:\ker\Phi_2\to G$$
$$\phi_2=\Phi_2|_{\ker\Phi_1}:\ker\Phi_1\to H_2$$
Proof. Apparently $\phi_1,\phi_2$ are homomorphisms. We first prove that $\phi_1$ is injective. Let $(a,b),(c,d)\in\ker\Phi_2$ be such that
  $$\Phi_1(a,b)=\Phi_1(c,d)$$
  Then $\Phi_1(ac^{-1},bd^{-1})=1_G$. On the other hand, $\Phi_2(ac^{-1},bd^{-1})=1_{H_2}$, since $(a,b),(c,d)\in\ker\Phi_2$. This means $\Phi(ac^{-1},bd^{-1})=(1_G,1_{H_2})\implies(ac^{-1},bd^{-1})\in\ker\Phi\implies a=c,b=d$ as $\Phi$ is an isomorphism. Now note that
  $$G\times H_1\cong G\times H_2\implies|H_1|=|H_2|$$
$$H_2\cong\frac{G\times H_1}{\ker\Phi_2}\implies|H_2|=\frac{|G||H_1|}{|\ker\Phi_2|}$$
  We get
  $$|G|=|\ker\Phi_2|$$
  Hence $\phi_1$ is an injective homomorphism between two groups with equally many elements, and therefore an isomorphism. By the same argument $\phi_2$ is also an isomorphism.

$\quad$

Lemma 2. Every $(a,b)\in G\times H_1$ can be written uniquely as
  $$(a,b)=xy,\ x\in\ker\Phi_1,\ y\in\ker\Phi_2$$
Proof. Let
  $$x=\phi_2^{-1}\Phi_2(a,b)\in\ker\Phi_1,\quad y=\phi_1^{-1}\Phi_1(a,b)\in\ker\Phi_2$$
  This means
  $$\Phi(x)=(\Phi_1(x),\Phi_2(x))=(1_G,\Phi_2(a,b))$$
$$\Phi(y)=(\Phi_1(y),\Phi_2(y))=(\Phi_1(a,b),1_{H_2})$$
$$\implies\Phi(xy)=\Phi(x)\Phi(y)=(1_G,\Phi_2(a,b))(\Phi_1(a,b),1_{H_2})=(\Phi_1(a,b),\Phi_2(a,b))=\Phi(a,b)$$
$$\implies(a,b)=xy$$
  Suppose $(a,b)=xy=x'y'$ with $x',y'$ also as above. Then $\Phi_1(y)=\Phi_1(xy)=\Phi_1(x'y')=\Phi_1(y')$. But $\Phi_1$ restricted to $\ker\Phi_2$ is injective, hence $y=y'$. similarly $x=x'$.

Now we write elements in $G\times H_1$ as in Lemma 2 and define this mapping
$$G\times H_1\to G\times H_1$$
$$xy\mapsto(\phi_1(y),\phi_2(x))$$
This is easily verified to be an automorphism that carries $\ker\Phi_2$ to $G$. By my comments above
$$\frac{G\times H_1}{\ker\Phi_2}\cong\frac{G\times H_1}{G}$$
Combined with (obtained above Lemma 1)
$$H_2\cong\frac{G\times H_1}{\ker\Phi_2}$$
we have
$$H_2\cong\frac{G\times H_1}{\ker\Phi_2}\cong\frac{G\times H_1}{G}\cong H_1$$
