End(M) for cyclic R-module M is a commutative ring where R is a PID. 
Show that End(M) for cyclic R-module M is a commutative ring where R is a PID.

So I know the module M is an abelian group so by a previous result, End(M) is a ring under pointwise addition and function composition. 
What remains to show is that the function composition is commutative. To that end, let $\phi, \alpha \in End(M)$. We want to show the ring End(M) is commutative so we must show $\phi(\alpha(m)) = \alpha(\phi(m)), \forall m \in M$.
We are given M is a cyclic R-module (R is a PID) so $M = Rx$ for some $x \in M$. Then for any $m \in M$ we have that $ m = rx$ for some $r \in R$.
Then, $\phi(\alpha(m)) = \phi(\alpha(rx)) = \phi(r\alpha(x)) = r\phi(\alpha(x))$
Likewise, $\alpha(\phi(m)) = r\alpha(\phi(x))$
So, we just need to show $\alpha(\phi(x)) = \phi(\alpha(x))$ but I'm not sure what to do from here? Any hints?
 A: Since $M$ is cyclic, there exists a surjective homomorphism of $R$-modules $\psi:R\rightarrow M$.
The kernel of $\psi$ is an ideal of $R$, call it $I$.
We then have $M \simeq R/I$ as $R$-modules. Hence $\operatorname{End}_R(M)$ is isomorphic to $\operatorname{End}_R(R/I)$.
However, an $R$-linear endomorphism of $R/I$ is the same as an $R/I$-linear endomorphism of $R/I$, hence we have $\operatorname{End}_R(R/I) = \operatorname{End}_{R/I}(R/I)$.
But for any commutative ring $S$, the endomorphism ring $\operatorname{End}_S(S)$ is canonically isomorphic to $S$ itself: we have maps $u:\operatorname{End}_S(S)\rightarrow S$ sending any $\phi$ to $\phi(1)$, and $v:S\rightarrow \operatorname{End}_S(S)$ sending any $s$ to the endomorphism $x\mapsto sx$.
In particular, $\operatorname{End}_{R/I}(R/I) \simeq R/I$ is a commutative ring.

The condition "$R$ is PID" is not needed.
A: Notice $\phi(x)=r_\phi x$ for some $r_\phi\in R$, since $\phi(x)\in M=Rx$; similarly $\alpha(x)=r_\alpha x$ for some $r_\alpha\in R$. Then we can calculate
$$\alpha(\phi(x))=\alpha(r_\phi x)=r_\phi\,\alpha(x)=r_\phi(r_\alpha x)=r_\alpha(r_\phi x)=r_\alpha\,\phi(x)=\phi(r_\alpha x)=\phi(\alpha(x))$$
