If $F$ is a free group then $g^2=h^2$ implies $g=h$ for $h,g\in F$.
I've been trying to prove this given the definition of a free group $F$: given group $F$ and subset $X\subseteq F$, $F$ is free over $X$ if for any group $G$ and function $\theta: X \to G$, there exists a unique homomorphism $\alpha:F\to G$ such that $\alpha(x)=\theta(x)$ for all $x\in X$.
The definition doesn't leave me much to work with: I've attempted to define a function $\theta:X\to F$ and then use the definition to take the given $\alpha$ and somehow arrive at $h=g$ but I've been unsuccessful.
You can use the following fact: If $F$ is a free group, $x\in F$ and $x\neq e$, then $C_F(x)$ is infinite cyclic group.
Note that $g^2=h^2=e$ implies $g=h=e$, since there is no non-trivial element of finite order in free group. Hence, assume that $g^2=h^2\neq e$, and let $C_F(g^2)= \langle u\rangle$. Trivially, $g,h\in C_G(g^2)= C_F(h^2)$, hence $g=u^p$ and $h= u^q$. Then $u^{2p}= g^2=h^2= u^{2q}$, so $2p=2q$ since $\langle u\rangle$ is infinite. Therefore, $p=q$ and $g= u^p= u^q= h$.