Let $A$ be a ring, and $Z(A)$ its center. Show that if $x^2-x \in Z(A)$ for every $x \in A$ then $A$ is commutative I tried it going directly saying that if I have a $y \in A$, then $(x^2-x)y=y(x^2-x)$, but couldn't reach anything.
Then I tried by the absurd, but reached even less.

Hint: Consider what you learn by applying this property with $x+y$ in place of $x$.
A full solution is hidden below.

 For any $x,y\in A$, we have $(x+y)^2-(x+y)=x^2+y^2+xy+yx-x-y\in Z(A)$.  Since $x^2-x,y^2-y\in Z(A)$ as well, this means $xy+yx\in Z(A)$.  In particular, we have $$(xy+yx)x=x(xy+yx)$$ and therefore $$yx^2=x^2y.$$  Also, since $x^2-x\in Z(A)$, we have $$y(x^2-x)=(x^2-x)y.$$  Cancelling $yx^2=x^2y$ from each side of this equation we get $-yx=-xy$ and so $yx=xy$ and $A$ is commutative.

