If $G$ is a group such that $x^2 = e$ for all elements $x$ in $G$, then show that $G$ is abelian.
I wanted to propose a method, that is based on properties of order $2$ elements, that I observed is useful in doing exercises on filling partially filled tables.
The property is:
If any element $a$ has order $2$, then get two sets of equations, where $\exists x,y\in G$ :
1. $ax = y$
2. $ay = x$
So, $aay = y \mid aax = x \implies a^2 = 1$
Similarly, for the set of equations:
3. $xa =y$
4. $ya =x$
I thought that this approach could be used to construct an intuitive explanation, but facing problems as shown below:
Let there be a group table for $G$: \begin{array}{|c|c|c|c|c|} \hline * & e & a & b & c & d \\ \hline e & e & a & b & c & d \\ \hline a & a & e & x & y & z \\ \hline b & b & x' & e & m & n \\ \hline c & c & y' & m' & e & p \\ \hline d & d & z' & n' & p' & e \\ \hline \end{array}
To show it is an abelian group, need diagonal elements as equal.
For $cb = m'$, need show $bc = m = m'$.
Want to use the property stated earlier for order $2$ elements, and for that the last statement means:
$cb = m'$,
$m'b = c$
There is only one choice for $m'=d$, so:
$cb = d$,
$db = c$
\begin{array}{|c|c|c|c|c|} \hline * & e & a & b & c & d \\ \hline e & e & a & b & c & d \\ \hline a & a & e & x & y & z \\ \hline b & b & x' & e & m & n \\ \hline c & c & y' & d & e & p \\ \hline d & d & z' & c & p' & e \\ \hline \end{array}
but this means that $ab =a\implies b =e$.
So, where lies the mistake?
The reason you can’t make it work is probably unknown to you at this stage. You are trying to construct a group with $5$ elements in which every element has order $1$ or $2$. However, no such group exists! As a consequence of Cauchy’s Theorem, in a finite group $G$, if a prime $p$ divides the order of the group $G$, then $G$ contains an element of order $p$. As a consequence of Lagrange’s Theorem, the order of any element of $G$ divides the order of $G$. And so if a finite group satisfies the condition that every element is of order $1$ or $2$, then the group must be of order $2^n$ for some $n\geq 0$. In particular, it cannot have order $5$.
But of course those two theorems are probably material you have not yet reached in your study.
It is also not the case that the answer boils down to the group having order a power of two, because there are finite groups of order a power of $2$ that are not abelian. For example, the multiplicative group of simple quaternions, $$ Q_8 = \{1, -1, i, -i, j, -j, k, -k\}$$ is a group of order $2^3=8$ under multiplication (with rules $i^2=j^2=k^2=ijk=-1$) is not abelian. Of course, it is also not the case that every element is of order $1$ or $2$, but the point is that you really need “every element is of order $1$ or $2$”, and you can’t just get away with “the order of the group is a power of $2$”.
There are many ways of proving that this condition suffices. Here is a slightly different one, using the weaker property that $(ab)^2 = a^2b^2$ for all $a,b\in G$ (if every element is of order $1$ or $2$ then this holds, but this may hold even if not every element is of order $1$ or $2$): given any $x,y\in G$, we have $$xyxy = (xy)^2 = x^2y^2 = xxyy.$$ Then multiplying by $x^{-1}$ on the left and $y^{-1}$ on the right, we obtain $yx=xy$. Thus, $G$ is abelian.