If $G \times G \cong H \times H$, then is $G \cong H$? Let $G,H$ groups. Suppose that $G \times G \cong H \times H$. Then is necessarily $G \cong H$?
I know that if $G,H$ are finite groups then it is true (you show that the map $FinGrp \rightarrow \mathbb{N}$, $A \mapsto \left|Hom(A,G)\right| $ determines $G$, and then $\left|Hom(A,G)\right|=\sqrt{\left|Hom(A,G\times G)\right|}=\sqrt{\left|Hom(A,H\times H)\right|}=\left|Hom(A,H)\right|$), so I am interested in the infinite case.
Note that the proof for the finite case also works for finite topological spaces, finite graphs, and maybe other categories I didn't consider. So I also interested on the analogous questions about infinite topological spaces, infinite graphs, or any other interesting category.
 A: In a word, no, even if $G$ and $H$ are assumed to be abelian. A. L. S. Corner has various results showing how strangely infinitely generated abelian groups behave. In particular, `given a positive integer $q$, there exist standard abelian $p$-groups $G$ and $H$ with no elements of infinite height such that $G^n≅H^n$ if and only if $q$ divides $n$'. (I'm quoting from the review on mathscinet.) So taking $q=2$ gives a counterexample to the question. This result is in 

Corner, A. L. S.
  On endomorphism rings of primary abelian groups.
  Quart. J. Math. Oxford Ser. (2) 20 1969 277–296.

A: Whether two (a) topological spaces, (b) metric spaces, or (c) groups $A$ and $B$, with isomorphic squares, are necessarily isomorphic, was Problem 77 (of Ulam) in the Scottish book. The following information is from the commentaries on Problem 77, by Mauldin for (a) and (b) and by Kaplansky for (c), in The Scottish Book: Mathematics from the Scottish Café, R. Daniel Mauldin, ed., 1981.
Mauldin gives a bibliography of 17 items for parts (a) and (b). The first counterexample for part (a), as well as a positive answer for two-dimensional compact manifolds, was given by R. H. Fox, On a problem of S. Ulam concerning Cartesian products, Fund. Math. 34 (1947), 278-287. The first counterexample to part (b) was given by G. Fournier, On a problem of S. Ulam, Proc. Amer. Math. Soc. 29 (1971), 622. Mauldin writes (in 1981):

However, it is open whether there is an affirmative solution to (b) in the case that $A$ and $B$ are complete metric spaces. In fact, part (b) is open in the case where $A$ and $B$ are assumed to be compact.

The first counterexample for part (c) was given by B. Jónsson, On direct decomposition and torsion-free abelian groups, Math. Scand. 5 (1957), 230-235.
P.S. The positive result in the finite case, proved by counting homomorphisms, is due to László Lovász; it applies to arbitrary finite structures, and it solved a problem of Tarski called the Unique Square Root Problem.
