If $g^5 = h^7$ in a free group, then $g$ and $h$ are in a cyclic subgroup Let $F$ be a free group, $g,h \in F$ with $g^5 = h^7$. Then I want to show these are in a cyclic subgroup.
The strategy I'm trying and failing with is to show that $g$ and $h$ commute, then they are in an abelian subgroup which must be cyclic (only free abelian groups are $\mathbb{Z}$ or trivial).
There must be some clever manipulation of the relation $g^5 h^{-7}$ that will give us $ghg^{-1}h^{-1}$, right? I can't see it though.
Another idea is to use the fact that $F$ is residually finite. If $gh \neq hg$ then there is a $f : F \to G$ with $G$ finite and $f(gh) \neq f(hg)$. I can't see how this helps, although we are now in a finite group $G$, so maybe we can do some trick with finite orders (we couldn't do this before since all nontrivial elems of $F$ have infinite order).
 A: If $g=1$, the claim is clear. So assume $g\ne1$.
Let $I$ be the generators of $F$ and write $g,h$ as word over the alphabet $I\cup I^{-1}$. We may assume wlog that among all conjugates of $(g,h)$, our pair is one where the word for $g$ is of minimal length. Then $g$ cannot be of the form $x\alpha x^{-1}$ or $x^{-1}\alpha x$ as that would allow us to find a shorter conjugate. Therefore, in the multiplication of $g^5$, no cancellation occurs. Also, the first symbol of $h$ must be the first symbol of $g$ and similarly for the last symbols. We conclude that no cancellation occurs in the multiplication of $h^7$, either. Therefore, $g^5=h^7$ is a word that can be split into 5 equal parts as well as into 7 equal parts, in particular has a length divisible by $35$. Split it into $35$ parts $\alpha_1,\ldots,\alpha_{35}$ of equal length. Then
$$\alpha_1\alpha_2\alpha_3\alpha_4\alpha_5=\alpha_6\alpha_7\alpha_8\alpha_9\alpha_{10}=\ldots =\alpha_{31}\alpha_{32}\alpha_{33}\alpha_{34}\alpha_{35}=h$$
and we conclude $$\alpha_i=\alpha_j\qquad\text{if }i\equiv j\pmod 5.$$
The same way, we conclude from 
$$ \alpha_1\alpha_2\alpha_3\alpha_4\alpha_5\alpha_6\alpha_7=\ldots =g$$
that
$$\alpha_i=\alpha_j\qquad\text{if }i\equiv j\pmod 7.$$
Together, these imply 
$$ \alpha_i=\alpha_j,$$
$$ g=\alpha_1 7,\quad h=\alpha_1^5.$$
