Endomorphisms of a projective (non-free) module I've confused myself about endomorphisms of a non-free module. Here's the 
situation:
Let $R$ be a non-commutative ring, let $M\subset R^2$ be a projective left $R$-module which has two generators over $R$, say $e_1,e_2\in R^2$. Then it seems that any $R$-linear endomorphism $\varphi:M\to M$ is determined by where we send these two generators, since all elements of $M$ are of the form $ae_1+be_2$, and we have that $\varphi(ae_1+be_2)=a\varphi(e_1)+b\varphi(e_2)$. Then any endomorphism is of the form $\varphi(e_1)=a_1e_1+a_3e_2$, and $\varphi(e_2)=a_2e_1+a_4e_2$, which we can write as a matrix if we want:
$$\begin{bmatrix}a_1&a_2\\a_3&a_4\end{bmatrix}\in M_2(R).$$
But then it seems that $\text{End}_R(M)\cong M_2(R)\cong \text{End}_R(R^2)$?  This seems strange to me, so perhaps I've made an error somewhere? As a semi-related question, is the determinant of such a matrix defined the same way for this non-commutative $R$, i.e. $a_1a_4-a_2a_3$?
 A: Take your favorite ring $A$ and consider $R=A\times A\times A$. As projective module take $M=A\times A\times\{0\}$, with generators $e_1=(1,0,0)$ and $e_2=(0,1,0)$.
There is no endomorphism of $M$ sending $e_1$ to $e_2$, for instance. Indeed, if $\varphi(e_1)=e_2$, we have $\varphi(e_1)=\varphi(e_1e_1)=e_1\varphi(e_1)=e_1e_2=0$, a contradiction.
Actually, the endomorphism ring of $M$ is $A^\mathrm{op}\times A^\mathrm{op}$, which is very different from $M_2(R^\mathrm{op})$.
The problem in your reasoning is that you can't arbitrarily choose $a_1,a_2,a_3,a_4$. This is possible if $M$ is free with basis $\{e_1,e_2\}$.
A: Every endomorphism can be expressed as a matrix in the way you say.  However, that hardly defines an isomorphism $\text{End}_R(M)\cong M_2(R)$.  Indeed, it doesn't even define a function $\text{End}_R(M)\to M_2(R)$ (or $M_2(R)\to\text{End}_R(M)$).  The representation of an endomorphism as a matrix is typically not unique, since the $a_1$ and $a_3$ such that $\varphi(e_1)=a_1e_1+a_3e_2$ are typically not unique (and similarly for $a_2$ and $a_4$).  Moreover, there is no reason to think that an arbitrary matrix actually gives a well-defined endomorphism of $M$.  At best, what you get is a surjective homomorphism from a subring of $M_2(R^{op})$ (those matrices that do give well-defined homomorphisms) to $\text{End}_R(M)$.  (Note also that I wrote $R^{op}$ because composition of endomorphisms corresponds to matrix multiplication where you use the ring structure on $R$ with multiplication in reversed order; see Noncommutative rings, matrices and homomorphisms of free modules for more on this.)
Usually determinants are not talked about at all for matrices over noncommutative rings as they tend to be poorly behaved.
