TITLE: Is any closed set with two elements a group?
QUESTION [7 upvotes]: Suppose you have a set $S = \{a,b\}$  that is closed under an associative operation $ * $, is S necessarily a group? I am having great difficulty trying to prove to myself that there exists a unique identity element. 
As S is closed by $*$, $ a*a=a$ or exclusively $a*a=b$. So far, my approach is to show that $a*a=a$ is equivalent to $b*b=a$, however I cannot seem to manipulate the equations to force that implication. Would anyone be able to shed some light? Many Thanks.

REPLY [16 votes]: For the general question of $(\{a,b\},*)$ being a group, the answer is no: consider the operation $\max$ on the set $\{0,1\}$. It induces a monoid structure - associative and $0$ is the neutral element - but $1$ has no inverse.
Moreover, any set $S$ with a constant map $c:S\times S\to S$ is certainly a semigroup.
There is a last semigroup operation: $$a*b=b$$
This is neither abelian nor a monoid, and it completes, together with $(\Bbb Z/2\Bbb Z,+)$, $\max$, and the constant, the list of the possible isomorphism classes of semigroups of two elements.