Let $FM_2=\langle a,b\rangle$ be the free monoid of rank 2. If we add a formal inverse to the word $aba$, we get the free group $F_2$ (because both $a$ and $b$ will have inverses).
Question: For which other words $w=w(a,b)$, adding a formal inverse to $w$ turns the free monoid into the free group?
I need a complete description, not just examples.
Update question: The same question for $FM_k$, the free monoid of rank $k\ge 3$.
Edit I moved my answer from here to the answer box below.