Q:

Is there an idempotent element in a finite semigroup?

Let $(G,\cdot)$ be a finite semigroup. Is there any $a\in G$ such that:
$$a^2=a$$
It seems to be true in view of theorem 2.2.1 page 97 of this book (I'm not sure).  But is there an elementary proof?

Theorem 2.2.1. [R. Ellis] Let $S$ be a compact right topological semigroup. Then there exists an idempotent in it.

This theorem is also known as Ellis–Numakura lemma.

A:

Note first that it suffices to prove that $a^k = a$ for some $k \geq 2$. If $k = 2$ we are done. Otherwise $k > 2$ and multiplying both sides by $a^{k-2}$ gives $(a^{k-1})^2 = a^{k-1}$.
Fix $x \in G$ and consider the sequence 
$$x, x^2, x^4, x^8, x^{16}, \ldots$$
Since $G$ is finite, there is repetition in this sequence. That is, $x^{2^t} = x^{2^s}$ for some integers $t > s \geq 1$. Thus $x^{2^t} = (x^{2^s})^{2^{t-s}} = x^{2^s}$, so choosing $a = x^{2^{s}}$ and $k = 2^{t-s}$ gives $a^k = a$. Note that $k \geq 2$ since $t > s$.

A:

Pick an arbitrary element and start iterating $x\mapsto x^2$. Since the semigroup is finite you will eventually hit a cycle. This gives you a $b$ such that $b^k=b$ for some $k\ge 2$. Now set $a=b^{k-1}$.

A:

When I first saw the question, I remembered there was a proof on MO using Ramsey theory, but couldn't remember how the argument went, so I came up with the following, that I first posted as a comment:

A cute proof using Schur's theorem: Fix $a$ in your semigroup $S$, and color $n$ and $m$ with the same color whenever $a^n=a^m$. By Schur's theorem (and the fact that the semigroup is finite) there are $n\le m$ such that $n$, $m$, and $n+m$ have the same color. That is, $a^n=a^m=a^{n+m}=(a^n)^2$.

(Today I finally found the thread on MO with the Ramsey theory proof, using Ramsey's theorem directly rather than Schur's theorem.)   

