Given a finite alphabet Σ and a language
L ⊆ ∑+,
the centralizer of L is defined as the maximal language commuting with it.
We prove that if the primitive root of the smallest word of L (with respect to a lexicographic order) is prefix distinguishable in L then the centralizer of L
is as simple as possible, that is, the submonoid
L*.
This lets us obtain a simple proof of a known result concerning the centralizer of nonperiodic three-word languages.