Free products of cyclic groups Given $G$, $H$, $G'$, and $H'$ are cyclic groups of orders $m$, $n$, $m'$, and $n'$ respectively. 
If $G*H$ is isomorphic to $G'* H'$, I would like to show that either $m = m'$ and $n = n'$ or else $m = n'$ and $n = m'$ holds. Where * denotes the free product.
My approach:
$G*H$ has an element of order $n$, thus $G' * H'$ has one too.
But already the next step is not clear to me, should I show that there is an element of length $> 1$ which has infinite order or what would be the right approach here?
Thank you.
 A: It is a theorem of Schreier that any element of $G*H$ that has finite order must be conjugate to an element of $G$ or an element of $H$. (This is what Steve D notes in his comment). 
To see this in the special case where $G$ is cyclic of order $n$ and $H$ cyclic of order $m$, let $G=\langle g\rangle$ and $H=\langle h\rangle$. Let $w$ be a reduced word in $G*H$ and assume that it is of finite order. Without loss of generality, let's say that it starts with $g$. Then we have
$$w = g^{a_1} h^{b_1} \cdots g^{a_k}h^{b_k}$$
where $0\lt a_i\lt n$ for each $i$, and $0\lt b_i\lt m$ for $i=1,\dots,k-1$, with $0\leq b_i\lt m$. 
If $b_k\gt 0$, then the length of $w^r$ is $2rk$, as there are no cancellations; so $w$ cannot be of finite order. Thus, $b_k=0$, and we have
$$w = g^{a_1}h^{b_1}\cdots h^{b_{k-1}}g^{a_k}.$$
We can then conjugate $w$ appropriately so that either $a_i=0$ or $a_k=0$ (or both). Repeating the argument, we see that we must actually have $a_1+a_k = n$, so that $w$ is conjugate to $h^{b_1}g^{a_2}\cdots g^{a_{k-1}}h^{b_{k-1}}$. Now repeat the argument conjugating; eventually, we will end up with $g^{a_i}$ or $h^{b_j}$, so $w$ is conjugate to an element of $H$ or to an element of $G$.
So assume that $G*H\cong G'*H'$. Without loss of generality say $m\leq n$ and $m',n\leq n'$. If $n\lt n'$ we have a contradiction, since $G'*H'$ has an element of order $n'$, but every element of finite order in $G*H$ has order dividing $n$ or $m$. So $n=n'$, as desired. 
Now we need to show that $m=m'$. We may assume $m\leq m'$. 
The universal property of the coproduct tells us that the identity map $G\to G$ and the trivial map $H\to G$ induce a homomorphism $G*H\to G$ which restricts to the identity on $G$ and to the zero map on $H$. The kernel is then exactly the normal closure of $H$ of $G*H$, $K$; in particular, the normal closure of $H$ intersects $G$ trivially.  Symmetrically, the normal closure of $G$ in $G*H$ intersects $H$ trivially.
The isomorphism $G'*H'\to G*H$ maps the generator of $H'$ to a conjugate of an element of $H$ or of $G$; and maps the generator of $G'$ to a conjugate of an element of $H$ or of $G$. But they cannot both map to conjugates of elements of $H$, or both to conjugates of elements of $G$: because then the map $G*H\to G$ (respectively, the map $G*H\to H$) would be a nonzero map, but when composed with the isomorphism $G'*H'\to G*H$ we would get the zero map, which is impossible. So if the generator of $H'$ maps to a conjugate of an element (in fact, a generator) of $H$, then the generator of $G'$ must map to a conjugate of an element of $G$, which proves that $|G'|\leq |G|$. This proves equality, since $m\leq m'$. If the generator of $H'$ maps to a conjugate of an element of $G$ then $n'\leq m\leq n=n'$, so we must have $n=m=n'=m'$.
A: Let me give you an alternative argument for the claim $m=m'$ in Arturo Magidin's answer. 
Take the abelianizations of the groups $G*H$ and $G'*H'$, since $G,G,H,H'$ are abelian, their abelianizations are $G\oplus H$ and $G'\oplus H'$ respectively. Then you get $G\oplus H\cong G'\oplus H'$ and in particular, their orders $mn=m'n'$ are equal. Since we already had $n=n'$, we conclude that $m=m'$.
