I have seen the following problem in chapter 9 of Abstract Algebra by Dan Saracino:
Let $G$ be a group and for $a,b \in G$ let $a\ R\ b$ mean that $ab=ba$. Must $R$ be an equivalence relation on $G$? If so , prove it; if not, indicate for which groups $R$ is an equivalence relation.
$R$ is not an equivalence relation in general. However, it is an equivalence relation iff all commutant (centralizer) subgroups of $G$ are abelian.
This is because in every group $a\ R\ b$ implies $b\ R\ a$, and always $a\ R\ a$ holds. So we need to see when $a\ R\ b$ and $b\ R\ c$ imply $a\ R\ c$.
Let's say $\bar b= \{ g \in G |\ bg=gb \}$ is the commutant group of b. Now, for every $a$ and $c$, we have $a\ R\ b$ and $b\ R\ c$ iff $a, c \in \bar b$. Therefore, $a\ R\ c$ iff $\bar b$ is abelian.
Now, we can define $R$ as an equivalence relation iff all commutant subgroups of $G$ are abelian.
One special case of these groups is when all proper subgroups are abelian. Now my questions are:
When are all the proper subgroups abelian?
More generally:
When are all commutant subgroups abelian?
When $G$ is abelian the relation is an equivalence relation.
When $G$ is not abelian the relation is not an equivalence relation. If it was, note the identity element commutes with all others, so the class of the identity would contain all group elements.