TITLE: If an ideal $I$ contains a non-zero-divisor then $\mathrm{End}_R(I)$ is commutative
QUESTION [6 upvotes]: How can I prove that if $I$ is an ideal of a commutative ring $R$ that contains a non-zero-divisor then $\mathrm{End}_R(I)$ is commutative?

REPLY [3 votes]: Let the non-zerodivisor be $x$. 
First we claim $End_R(xR)$ is commutative. Clearly each $f,g\in End_R(xR)$ is determined by its image of $x$. So, say, let $f(x)=xr$ and $g(x)=xs$. Then $f(g(xt))=xtsr=xtrs=g(f(xt))$, and so $fg=gf$ for all $f,g\in End_R(xR)$.
Now suppose, $F,G\in End_R(I)$. If $FG\neq GF$, there exists a $z$ such that $FG(z)-GF(z)\neq 0$. Multiplying on the right with $x$, $FG(zx)-GF(zx)\neq 0$. However, this is impossible since $F$ and $G$ must commute when restricted to $xR$!
So, $End_R(I)$ is commutative.