The existence of a nontrivial summand of a free module of rank $2$ I've been reading Atiyah's paper "The unity of mathematics". In section 5, he mentions "having a nontrivial summand of a free $R$-module of rank $2$ is equivalent to having a matrix $T\in M_2(R)$ such that $T^2=T$ but with $T$ not conjugate to the standard idempotent matrix, i.e., $T$ cannot be put in the form
$$
T=Q\begin{pmatrix}
1 & 0 \\
0 & 0  
\end{pmatrix}Q^{-1}
$$ with $Q, Q^{-1}\in M_2(R).$
I am unable to prove this statement. I cannot find the correspondence between them, i.e. given such $T$, how to produce a nontrivial direct summand of $R^2$? Or, conversely, given a nontrivial direct summand, how to construct $T$ (for example, Atiyah gives an example as follow, which is a case that a free $R$-module of rank $2$ has nontrivial summand).

Now let us consider the ring $\mathbb{Z} \left [ \sqrt{-5} \right ]$ and the ideal $p = \left (3, 2 - \sqrt{-5} \right )$ as before. Computing its inverse we find
$$p^{-1} = p^{-2} \cdot p = \frac{1}{2 - \sqrt{-5}} \left (3, 2- \sqrt{-5} \right ) = \left ( 1, \  \frac{1 - \sqrt{-5}}{3} \right ).$$
Since the determinant of the matrix
$$ \begin{pmatrix} 1 & \frac{1 - \sqrt{-5}}{3} \\ 3 & 2 - \sqrt{-5} \end{pmatrix} $$
is equal to $1$ it follows that the module $p \oplus p^{-1}$ is free of rank $2$ (over $\mathbb{Z} \left [ \sqrt{-5} \right ]$), while $p$ is not free of rank $1$ (not being principal).


Note  As @Enkidu mentioned below, one can find the diagram
$\require{AMScd}$
\begin{CD}
\mathbb{Z}[\sqrt{-5}]\oplus \mathbb{Z}[\sqrt{-5}] @>{f}>> p\oplus p^{-1} \\
@V{T}VV @V{proj}VV\\
 \mathbb{Z}[\sqrt{-5}]\oplus \mathbb{Z}[\sqrt{-5}] @>{f}>> p\oplus p^{-1} 
\end{CD} where $f=\begin{pmatrix}
1 & \frac{1-\sqrt{-5}}{3} \\
3 & 2-\sqrt{-5}  
\end{pmatrix},$ proj=$\begin{pmatrix}
1 & 0 \\
0 & 0 
\end{pmatrix}$ induces
$$
T= \begin{pmatrix}
2-\sqrt{-5}  & -1-\sqrt{-5} \\
-3 & -1+\sqrt{-5}
\end{pmatrix}.
$$
 A: I think the example is a little bit confusing you, as it is essentially just a statement that these thingies actually exist and I think your issue is more with, why can I identify a direct Summand with an idempotent matrix. The thingy with not being isomorphic to the standard projection should be clear then, as those are the trivial direct summands by construction (will still include a short explanation of it though). Also, throughout this I will just talk about morphisms $M \to N$ for modules over a ring. As in linear algebra, matrices are isomorphic to morphisms from $R^n \to R^m$ with the standard "basis", but using morphisms we can actually work more general.
First of all, observe that having a direct summand $A\subset M$ of modules over a ring means that you can consider the projection onto said summand followed by the inclusion of it in order to induce such a morphism ($T:M\xrightarrow{\sim} A \otimes B\twoheadrightarrow A \hookrightarrow A \otimes B \xrightarrow{\sim}M$).
Now assume that we have such a $T:M \to M$ such that $T^2=T$. We want to prove that this gives rise to a direct summand.
Consider the morphism $K=\mathrm(id)-T$ then we have that $K^2=K$, $K+T=\mathrm{id}$ and $T\circ K =0 = K \circ T$ (K is the projection onto the kernel of T). In particular we get that $\mathrm{im}\left(K\right)\cap \mathrm{im}\left(T\right)=0$ and so the canonical morphism from $\mathrm{im}\left(K\right)\oplus \mathrm{im}\left(T\right) \to \mathrm{im}\left(K\right)+ \mathrm{im}\left(T\right)\subset M$ is an isomorphism and we also have, as $K+T=\mathrm{id}$ that $ \mathrm{im}\left(K\right)+ \mathrm{im}\left(T\right)=M$. So we just exhibited an isomorphism from $M\cong  \mathrm{im}\left(K\right)\oplus \mathrm{im}\left(T\right)$ and so $\mathrm{im}\left(T\right)$ is a direct summand.
The trivial summands being the "standard" $T$ that do that follows from the fact that if you run them through these procedures you immediately get a summand $R^m \subset R^n$ with $m \le n$ in the standard way. as the $Q$ just reorders the $R^n$.
