Let $G=\{0,1,2\}$ define $*$ on $G$ such that $a*b=|a-b|$. Check if $G$ is a group.
Edit : As @egreg correctly pointed out if you draw the Cayley table then one can directly see it is not a group, I was making a mistake in drawing up Cayley table.
My solution : I can prove that $G$ is closed, has an identity ($0$), has an inverse (each element is inverse of itself).
What I am not sure is whether the group is associative under this binary operation, at the face of it $|a-|b-c||\neq||a-b|-c||$ but if we check all possibilities then both do come out to be equal if $a,b,c \in G$.
Any hint/help will be appreciated
The Cayley table (that also shows closure, identity and inverses) is \begin{array}{c|ccc} * & 0 & 1 & 2 \\ \hline 0 & 0 & 1 & 2 \\ 1 & 1 & 0 & 1\\ 2 & 2 & 1 & 0 \end{array} Since in the second row the element $1$ appears twice, the set is not a group.
In a group, from $xy=xz$ one deduces $y=z$; here, instead, $1*0=1*2$, but $0\ne2$.