Show that the syntactic semigroup of $X$ is the smallest semigroup recognizing $X$ in the sense that, for every semigroup $S$ recognizing $X$, there exists a morphism from $S$ onto the syntactic semigroup of $X$.
Some background knowledge:
A semigroup $S$ is said to recognize a set $X$ if there exists a morphism $f:A^*\to S $ such that $X=f^{-1}(f(X))$.
(1) Let $X$ be a set of words. The set of contexts of a word $w$ is the set $$C(w)=\{(x,y)\in A^*\times A^*| xwy\in X\}\;.$$ (2) The syntactic equivalence of $X$ is defined by $u\equiv v$ if and only if $C(u)=C(v)$.
(3) The syntactic equivalence $\equiv$ is a congruence with concatenation of words and the quotient $A^*/\equiv$ is called the syntactic semigroup of $X$.
Actually I have known there exists a surjective map from $S$ to $A^*/\equiv$, since $\ker f\subset \equiv$. But I can't make sure the surjective map is a morphism.
For $u\in A^*$ let $[u]$ be the $\equiv$-equivalence class of $u$.
Suppose that $S$ recognizes $X$ via the surjective homomorphism $f:A^*\to S$. Suppose further that $u,v\in A^*$ and $u\not\equiv v$. Without loss of generality there is $\langle x,y\rangle\in C(u)\setminus C(v)$. Then $xuy\in X$, so $f(xuy)\in f[X]$, but $xvy\notin X=f^{-1}[f[X]]$, so $f(xvy)\notin f[X]$, and $f(xuy)\ne f(xvy)$. But then $f(x)f(u)f(y)\ne f(x)f(v)f(y)$, and therefore $f(u)\ne f(v)$. In other words, if $u,v\in A^*$ and $f(u)=f(v)$, then $u\equiv v$.
For each $u\in A^*$ let $[u]_f=\{v\in A^*:f(v)=f(u)\}$, the equivalence class of $u$ with respect to the congruence induced by $f$. We’ve just shown that for every $u\in A^*$, $[u]_f\subseteq [u]$. In other words, the partition induced by $f$ refines the partition induced by $\equiv$, and it follows at once that $A^*/\equiv$ is a homomorphic image of $S$. Specifically, define $h:S\to A^*/\equiv$ as follows: for $s\in S$ fix $u\in f^{-1}[\{s\}]$ arbitrarily, and let $h(s)=[u]$. It’s straightforward to check that $h$ is a homomorphism.
Added: Here’s a counterexample if $f$ is not surjective.
Let $A=\{a\}$, and let $X=\{x\in A^*:|x|\text{ is odd}\}$. The two $\equiv$-classes are $[a]$ and $[aa]$, and the syntactic semigroup $S_0$ is isomorphic to $\Bbb Z_2=\Bbb Z/2\Bbb Z$ under addition via the isomorphism $[a]\mapsto 1$ and $[aa]\mapsto 0$. Extend $S_0$ to a new semigroup $S=\{[a],[aa],z\}$, where $z$ is a zero element: $z[a]=[a]z=z[aa]=[aa]z=z^2=z$. The map $f:A^*\to S:u\mapsto[u]$ shows that $S$ recognizes $X$, but there is no homomorphism $h$ of $S$ onto $S_0$: if $h$ were such a homomorphism, for each $s\in S_0$ there would be $t\in S$ such that $h(t)=s$, but then $$h(z)=h(zt)=h(z)h(t)=h(z)s\;,$$ contradicting the fact that $S_0$ has no zero element.