If $\forall x \in R, x^2-x \in Z(G)$, than $R$ is commutative [duplicate]
One possible hint: Working on $$(x+y)^2-(x+y).$$ to show that $xy+yx\in Z(R)$ could pave our way to solution. Indeed, when $xy+yx\in Z(R)$ then $$(xy+yx)y=y(xy+yx)\to xy^2=y^2x.$$ Now since $y^2-y\in Z(R)$ so $$y^2x-yx=xy^2-xy$$
Suppose that $R$ has $1$.
Then, for any $x \in R$,
$(1+x)^2-(1+x) \in Z(R)$, which shows: $(1+x^2+2x)-(1+x) \in Z(R)$, which implies that $x^2+x$ is in $Z(R)$ for all $x \in R$. So, $(x^2+x)-(x^2-x) \in Z(R)$ which implies $2x \in R$ for all $x \in R$. This easily implies $R$ is commutative.