TITLE: Obtain a basis of invertible matrices for $M_n(D)$, where $D$ is an integral domain
QUESTION [7 upvotes]: Let $D$ be an integral domain. Prove that $M_n(D)$ has a basis consisting of $n^2$ invertible matrices.

Consider $M_n(D)$ as a $D$-module. Define invertible elements $V_{nn}=I_n$, $V_{n-1,n-1} = V_{nn} - E_{nn} + E_{n-1,n} + E_{n,n-1}$, $V_{ii}$ considered as permutation $(n,n-1,\dots,i+2,i+1)$ for $i=1,2,\dots,n-2$, and $V_{ij}=I_n+E_{ij}$ for $i\ne j$. I don't know how to prove they are linearly independent.

REPLY [2 votes]: I assume that by $E_{i,j}$ you mean the matrix in $M_n(D)$ with $1$ at the place $i,j$ and $0$ otherwise. Then we have the following:

$V_{n,n}=I_n=\sum_{k=1}^nE_{k,k}\,;$
$V_{n-1,n-1}=\sum_{k=1}^{n-1}E_{k,k}+E_{n-1,n}+E_{n,n-1}\,;$
$V_{i,i}=\sum_{k=1}^iE_{k,k}+\sum_{k=i+2}^nE_{k,k-1}+E_{i+1,n}\,,\ \style{font-family:inherit;}{\text{for}}\ i=1,\dots,n-2\,;$
$V_{i,j}=\sum_{k=1}^nE_{k,k}+E_{i,j}\,,\ \style{font-family:inherit;}{\text{for}}\ i\ne j\,.$

Other than $V_{n-1,n-1}$, all the matrices $V_{i,j}$ are clearly invertible (they are permutation matrices if $i=j\ne n-1$ and triangular with $1$s at the diagonal if $i\ne j$), and $V_{n-1,n-1}$ is the block matrix $I_{n-2}\oplus\binom{1\ 1}{1\ 0}$, so it is invertible as well.
Let $a_{p,q}\in D$ be such that $\sum_{p=1}^n\sum_{q=1}^na_{p,q}V_{p,q}=0$. We want to show that $a_{p,q}=0$ for each $p,q$. Using the equalities above we can rewrite this equality as
$$\begin{align*}0=&\,\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}V_{p,q}+\sum_{i=1}^{n-2}a_{i,i}V_{i,i}+a_{n-1,n-1}V_{n-1,n-1}+a_{n,n}V_{n,n}\\
=&\,\quad\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\biggl(\,\sum_{k=1}^nE_{k,k}+E_{p,q}\,\biggr)\\
&\,\ +\ \sum_{i=1}^{n-2}a_{i,i}\biggl(\,\sum_{k=1}^iE_{k,k}+\sum_{k=i+2}^nE_{k,k-1}+E_{i+1,n}\,\biggr)\\
&\,\ +\ a_{n-1,n-1}\biggl(\,\sum_{k=1}^{n-1}E_{k,k}+E_{n-1,n}+E_{n,n-1}\,\biggr)\\
&\,\ +\ a_{n,n}\sum_{k=1}^nE_{k,k}\,.\tag{$\boldsymbol{\ast}$}
\end{align*}$$
We know that the matrices $E_{i,j}$ are $D$-linearly independent, so our next task is to rewrite the sum above as a $D$-linear combination of the matrices $E_{i,j}$. Clearly the most tractable terms are those involving the matrices $E_{k,k}$. The total contribution of these terms is precisely
$$\begin{align*}
&\,\quad\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,\sum_{k=1}^nE_{k,k}\,+\,\sum_{i=1}^{n-2}a_{i,i}\,\sum_{k=1}^iE_{k,k}\\
&\,\ +\ a_{n-1,n-1}\,\sum_{k=1}^{n-1}E_{k,k}\,+\,a_{n,n}\sum_{k=1}^nE_{k,k}\\
=&\,\quad\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,\sum_{k=1}^nE_{k,k}\,+\,\sum_{i=1}^na_{i,i}\,\sum_{k=1}^iE_{k,k}\\
=&\,\quad\sum_{k=1}^n\Biggl(\,\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,\Biggr)\,E_{k,k}\,+\sum_{k=1}^n\Biggl(\,\sum_{i=k}^na_{i,i}\,\Biggr)\,E_{k,k}\\
=&\,\quad\sum_{k=1}^n\Biggl(\,\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,+\sum_{i=k}^na_{i,i}\,\Biggr)\,E_{k,k}\,.
\end{align*}$$
Since the matrices $E_{k,k}, k=1,\dots,n$ are $D$-linearly independent, it follows that
$$\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,+\sum_{i=k}^na_{i,i}=0,\ \style{font-family:inherit;}{\text{for}}\ k=1,\dots,n\,.$$
From this we conclude that for $r=1,\dots,n-1$ the coefficient $a_{r,r}=0$: just take $k=r$ and $k=r+1$ in the equality above and subtract. This in turn implies the equality
$$\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\,+a_{n,n}=0\,,\tag{$\boldsymbol{\ast\!\ast}$}$$
and even better, the original equation $(\boldsymbol{\ast})$ simplifies to
$$\begin{align*}
0=&\,\quad\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}\biggl(\,\sum_{k=1}^nE_{k,k}+E_{p,q}\,\biggr)\,\ +\ a_{n,n}\sum_{k=1}^nE_{k,k}\,,
\end{align*}$$
and thanks to this big simplification it is clear now that the contribution of the terms $E_{p,q}$ with $p\ne q$ is precisely
$$\sum_{\substack{1\leq p,q\leq n\\p\ne q}}a_{p,q}E_{p,q}\,,$$
from which we conclude that $a_{p,q}=0$ for all $p,q$ with $p\ne q$. Finally, applying this result on equality $(\boldsymbol{\ast\ast})$ above we conclude that the pending coefficient, namely $a_{n,n}$, is $0$ as well. This proves that the matrices $V_{i,j}$ are $D$-linearly independent, even if $D$ is not a domain.