Center of endomorphisms of finitely generated projective modules Let $R$ be a commutative ring with identity, and $S$ be a finitely generated projective $R$-module. Consider $\text{End}_R(S)$, the set of $R$-module endomorphisms of $S$. This is naturally an $R$-algebra, where the product is given by composition. My question is: is the center of $\text{End}_R(S)$ equal to $R$, where we see every element $r$ of $R$ as the endomorphism that maps $s\in S$ to $rs$?
My attempt: this is clearly true if $S$ is free of rank $n$, since $\text{End}_R(S)$ can be seen as the ring of matrices $n\times n$ with coefficients in $R$, and the center consists precisely of the scalar matrices. I tried to generalise this approach: since $S$ is finitely generated and projective, we may find a projective coordinate system: a set $\{s_i,f_i\}_{i=1}^n$, with $s_i\in S$, $f_i\in \text{Hom}_R(S,R)$ such that, for every $s\in S$, $$s=\sum_{i=1}^n f_i(s)s_i.$$ If $\gamma\in \text{End}_R(S)$, then we can associate to $\gamma$ a matrix: for every $j=1,\ldots, n$, write in columns the coefficients of $\gamma(s_j)=\sum_{i=1}^n f_i(\gamma(s_j))s_i$. We find a ring homomorphism from $\text{End}_R(S)$ to $\text{Mat}_{n\times n}(R)$. The problem here is that this homomorphism is not surjective, so we cannot conclude that the center of $\text{End}_R(S)$ corresponds to the scalar matrices...
 A: The trick is that the question is local, so you can reduce to the local case where $S$ is free.
You have exhibited a homomorphism $R\to Z(\operatorname{End}_R(S))$ and you are asking whether this homomorphism is surjective. Now a homomorphism of $R$-modules is surjective iff its localization at each prime ideal of $R$ is surjective.  I claim that if you localize $Z(\operatorname{End}_R(S))$ at a prime $p\subset R$, you just get $Z(\operatorname{End}_{R_p}(S_p))$.  First, if you localize $\operatorname{End}_R(S)$ at $p$, you get $\operatorname{End}_{R_p}(S_p)$ since $S$ is a finitely presented $R$-module.  This makes $Z(\operatorname{End}_R(S))_p$ naturally a central subring of $\operatorname{End}_{R_p}(S_p)$.  To see that this subring is actually the whole center, suppose an element $f\in\operatorname{End}_{R_p}(S_p)$ is central; we wish to show that $f$ is just a central element of $\operatorname{End}_R(S)$ divided by some element of $R\setminus p$.  Multiplying $f$ by an element of $R\setminus p$, we may assume we can lift $f$ to an element $\bar{f}\in\operatorname{End}_R(S)$.   Fix a finite set of generators $g_1,\dots,g_n$ for $\operatorname{End}_R(S)$ as an $R$-module.  Since $f$ is central, $\bar{f}$ commutes with each $g_i$ after multiplying by some element of $R\setminus p$.  Since we have only finitely many $g_i$, we can multiply $\bar{f}$ by a single element of $R\setminus p$ to assume that it commutes with every $g_i$.  That means $\bar{f}\in Z(\operatorname{End}_R(S))$, as desired.
So, localizing $Z(\operatorname{End}_R(S))$ at a prime $p$ just gives $Z(\operatorname{End}_{R_p}(S_p))$.  But $S_p$ is free over $R_p$, so the canonical homomorphism $R_p\to Z(\operatorname{End}_{R_p}(S_p))$ is surjective.  It follows that your homomorphism $R\to Z(\operatorname{End}_R(S))$ is surjective.
(Note that this does not mean that $Z(\operatorname{End}_R(S))$ "is" $R$, since the homomorphism may not be injective.  For instance, consider what happens if $S=0$.  In general, you can say that every central endomorphism of $S$ is given by multiplication by an element of $R$, but that element of $R$ may not be unique.)
