TITLE: If consecutive elements commute each other, does it mean that all of them commutes with each other?
QUESTION [5 upvotes]: Let $x_1,x_2,...,x_k$ be $k$ different elements of a group $G$ and $k\geq4$.
If we know that $x_i$ commutes with $x_{i+1}$ and $x_k$ commutes with $x_1$, can we say that all $x_i$ commutes with each other ?

REPLY [2 votes]: Let $C$ denote the graph corresponding to a cycle of length four and let $G(C)$ be the associated right-angled Artin group. If your statement were true, $G(C)$ would be an abelian group, and more precisely a free abelian group of rank four. Such a group is also a right-angled Artin group, namely $G(K)$ where $K$ is the complete graph on four vertices. However, it is known that $G(C) \simeq G(K)$ is equivalent to $C \simeq K$, and the latter isomorphism is clearly false.