# If $G \times H$ is isomorphic to $G _1\times H_1$, must $G$ be isomorphic to either $G_1$ or $H_1$?

Just proved if $G$ is isomorphic to $G_1$, $H$ is isomorphic to $H_1$, then $G \times H$ is isomorphic to $G_1 \times H_1$. I am wondering could this be an if and only if statement. Which means, If $G\times H$ is isomorphic to $G _1\times H_1$, must $G$ be isomorphic to either $G_1$ or $H_1$?

-
$\{1\} \times (A \times B)$ is isomorphic to $A \times B$ for any $A$ and $B$. – sdcvvc Feb 15 '12 at 22:50
$C_2 \times C_{15} \cong C_{30} \cong C_6 \times C_5$. – lhf Feb 16 '12 at 1:59
@sdcvvc is it a counter example you gave? It is same as {1} * G is isomorphic to G. But it doesn't fit the condition. – Shannon Feb 16 '12 at 21:47
@Shannon: Yes, this is a counterexample as long as $A$ and $B$ are not trivial one-element groups (for example, they can be ${\mathbb Z}_2$); using the notation from the question, $G=\{1\}$, $H=A \times B$, $G_1 = A$, $H_1 = B$, then $G \times H$ is isomorphic to $G_1 \times H_1$ but $G$ is not isomorphic to $G_1$ or $H_1$. – sdcvvc Feb 16 '12 at 23:19
Awesome. I was trying to use {1} to make some counterexample, but failed. Yours is very good one. – Shannon Feb 16 '12 at 23:40

This isn't even true for integers (for example $4 \times 4 = 2 \times 8$). The corresponding group-theoretic example is that $(C_2^2) \times (C_2^2) \cong C_2 \times (C_2^3)$.
A modified version of this question asks whether $G \cong G_1$ implies $H \cong H_1$. This turns out to be true if $G$ is finite; see Hirshon's On cancellation in groups. This result is clearly false in general for infinite groups (it suffices to find a nontrivial group $G$ such that $G \cong G^2$, and for example the direct sum of countably many copies of any given group works).
Direct products are associative in the sense that $(A\times B)\times C \;\cong A\times(B\times C)$ are isomorphic. So we could pick $A=\mathbb{Z}/p\mathbb{Z},\,B=\mathbb{Z}/q\mathbb{Z},\,C=\mathbb{Z}/r\mathbb{Z}$ for distinct primes $p,q,r$ for an easy counterexample.