TITLE: necessary and sufficient condition for trivial kernel of a matrix over a commutative ring
QUESTION [34 upvotes]: In answering Do these matrix rings have non-zero elements that are neither units nor zero divisors? I was surprised how hard it was to find anything on the Web about the generalization of the following fact to commutative rings:

A square matrix over a field has trivial kernel if and only if its determinant is non-zero.

As Bill demonstrated in the above question, a related fact about fields generalizes directly to commutative rings:

A square matrix over a commutative ring is invertible if and only if its
  determinant is invertible.

However, the kernel being trivial and the matrix being invertible are not equivalent for general rings, so the question arises what the proper generalization of the first fact is. Since it took me quite a lot of searching to find the answer to this rather basic question, and it's excplicitly encouraged to write a question and answer it to document something that might be useful to others, I thought I'd write this up here in an accessible form.
So my questions are: What is the relationship between the determinant of a square matrix over a commutative ring and the triviality of its kernel? Can the simple relationship that holds for fields be generalized? And (generalizing with a view to the answer) what is a necessary and sufficient condition for a (not necessarily square) matrix over a commutative ring to have trivial kernel?

REPLY [10 votes]: See Section III.8.7, entitled Application to Linear Equations, of Algebra, by Nicolas Bourbaki.
EDIT 1. Let $R$ be a commutative ring, let $m$ and $n$ be positive integers, let $M$ be an $R$-module, and let $A:R^n\to M$ be $R$-linear. 
Identify the $n$ th exterior power $\Lambda^n(R^n)$ of $R^n$ to $R$ in the obvious way, so that $\Lambda^n(A)$ is a map from $R$ to $\Lambda^n(M)$. 
Put $v_i:=Ae_i$, where $e_i$ is the $i$ th vector of the canonical basis of $R^n$. In particular we have 
$$
Ax=\sum_{i=1}^n\ x_i\ v_i,\quad\Lambda^n(A)\ r=r\ v_1\wedge\cdots\wedge v_n.
$$ 
(where $x_i$ is the $i$-th coordinate of $x$, and $r$ denotes any element of $\Lambda^n\left(R^n\right) \cong R$).

If $\Lambda^n(A)$ is injective, so is $A$. 

In other words: 

If the $v_i$ are linearly dependent, then $r\ v_1\wedge\cdots\wedge v_n=0$ for some nonzero $r$ in $R$. 

Indeed, for $x$ in $\ker A$ we have 
$$
\Lambda^n(A)\ x_1=x_1\ v_1\wedge v_2\wedge\cdots\wedge v_n=
-\sum_{i=2}^n\ x_i\ v_i\wedge v_2\wedge\cdots\wedge v_n=0, 
$$ 
and, similarly, $\Lambda^n(A)\ x_i=0$ for all $i$. 
[Edit: Old version (before Georges's comment): Assume now that $M$ embeds into $R^m$.] 
Assume now that there is an $R$-linear injection $B:M\to R^m$ such that 
$$
\Lambda^n(B):\Lambda^n(M)\to\Lambda^n(R^m) 
$$ 
is injective. This is always the case (for a suitable $m$) if $M$ is projective and finitely generated. 

If $A$ is injective, so is $\Lambda^n(A)$. 

In other words: 

If $r\ v_1\wedge\cdots\wedge v_n=0$ for some nonzero $r$ in $R$, then the $v_i$ are linearly dependent. 

The proof is given in joriki's nice answer. 
This is also proved as Proposition 12 in Bourbaki's Algebra III.7.9 p. 519. Unfortunately, I don't understand Bourbaki's argument. I'd be most grateful to whoever would be kind and patient enough to explain it to me. 
EDIT 2. According to the indications given by Tsit-Yuen Lam on page 150 of his book Exercises in modules and rings, the theorem is due to N. H. McCoy, and appeared first, as Theorem 1 page 288, in 

N. H. McCoy, Remarks on Divisors of Zero, The American Mathematical Monthly Vol. 49, No. 5 (May, 1942), pp. 286-295, JSTOR. 

Lam also says that 

N. H. McCoy, Rings and ideals, The Carus Mathematical Monographs, no. 8, The Mathematical Association of America, 1948, 

is an "excellent exposition" of the subject. See Theorem 51 page 159. 
McCoy's Theorem is also stated and proved in the following texts: 

Ex. 5.23.A(3) on page 149 of Lam's Exercises in modules and rings. 
Theorem 2.2 page 3 in Anton Gerashenko's notes from Lam's Course: Math 274, Commutative Rings, Fall 2006: PDF file.
Theorem 1.6 in Chapter 13, entitled "Various topics", of The CRing Project. --- PDF file for Chapter 13. --- PDF file for the whole book. 
Blocki, Zbigniew, An elementary proof of the McCoy theorem, J. Univ. Iagel. Acta Math.; N 30; 1993; 215-218. 
Theorem 6.4.16. page 101, A Second Semester of Linear Algebra, Math 5718, by Stan Payne. PDF file.