I am told that finite groups have unique factorization under direct product. That is, call a nontrivial group "indivisible" if it is not isomorphic to a direct product of nontrivial groups. Then every finite group can be "factored" (by direct product) into a unique collection of indivisible groups.


In particular, if $G$ and $H$ are finite groups so that $G\times G\cong H\times H$, then $G\cong H$.


Can anyone provide a reference to a proof of these results? What is known in the infinite case? Thanks.



Unique factorization of finite groups under direct sum?
About the first fact see [this](https://groupprops.subwiki.org/wiki/Direct_product_is_cancellative_for_finite_groups) page (the Krull–Remak–Schmidt theorem). For infinite (even finitely generated) groups the situation is different because there exists an infinite f.g. group isomorphic to its [direct square.](https://groupprops.subwiki.org/wiki/Group_isomorphic_to_its_square)


**Update.** [Hirshon](https://doi.org/10.1007/BF01229716 "Hirshon, R. The cancellation of an infinite cyclic group in direct products. Arch. Math 26, 134–138 (1975). zbMATH review at https://zbmath.org/?q=an:0303.20022"), found two non-isomorphic finitely generated nilpotent (infinite) groups $G,H$ such that $G\times G\cong H\times H$.


