Non-trivial groups pairwise non-isomorphic with isomorphic direct products

Are there four non-trivial groups $G_1,G_2,H_1,H_2$ pairwise non-isomorphic but such that $G_1 \times G_2$ is isomorphic to $H_1 \times H_2$?

My idea was to consider the abelian groups and something related to their decomposition as direct product of cyclic groups, but it doesn't work.

• Try again with abelian groups of the form $C_2^k = C_2 \times C_2 \times \cdots \times C_2$ with $k$ direct factors. It's easy. – Derek Holt May 16 '17 at 8:20
• What do you mean for $C_2^k$? – TheWanderer May 16 '17 at 8:21
• $C_2$ meaning $Z/2Z$. Can use small finite products. – quasi May 16 '17 at 8:23
• I think the minimal $\;k\;$ for this to fully work is $\;k=5\;$ ... – DonAntonio May 16 '17 at 8:34
• @TheWanderer: Hint: 2 + 3 = 1 + 4 – quasi May 16 '17 at 8:35

Let $C_n$ denote the cyclic group with $n$ elements.

Relevant fact: If $a$ and $b$ are relatively prime, then $C_a \times C_b = C_{ab}$.

Idea of proof of fact (or look in any group theory book): It suffices to show that $C_{ab}$ is cyclic - i.e. is generated by a single element. The naive guess is $(1,1)$. Observe that $a*(1,1) = (0,a)$, and since $a$ is a unit modulo $b$ (this is equivalent to them being relatively prime), there is some c so that $ca*(1,1) = (0,1)$. Similarly you can get $(1,0)$ as a mutliple of $(1,1)$.

Do you see how to use this fact?

There are other ways also, such as what is being suggested in the comments.

It would be more fun if we were to insist that $G_{1}\simeq G_{2}$ and $H_{1}\simeq H_2$ and then give a counterexample.

Tony Corner's example of an abelian group $A\not\simeq A\oplus A$ but with $A\simeq A\oplus A\oplus A$ will give an example. Take $B=A\oplus A$ and then $$A\oplus A\simeq A\oplus (A\oplus A\oplus A)\simeq (A\oplus A)\oplus (A\oplus A)\simeq B\oplus B$$

(For the group $A$ see MR0169905 Corner, A.L.S., On a conjecture of Pierce concerning direct decomposition of Abelian groups. 1964 Proc. Colloq. Abelian Groups (Tihany, 1963) pp.43--48 Akademiai Kiado, Budapest.)