TITLE: Does an injective endomorphism of a finitely-generated free R-module have nonzero determinant?
QUESTION [20 upvotes]: Alternately, let $M$ be an $n \times n$ matrix with entries in a commutative ring $R$. If $M$ has trivial kernel, is it true that $\det(M) \neq 0$?  
This math.SE question deals with the case that $R$ is a polynomial ring over a field. There it was observed that there is a straightforward proof when $R$ is an integral domain by passing to the fraction field.
In the general case I have neither a proof nor a counterexample. Here are three general observations about properties that a counterexample $M$ (trivial kernel but zero determinant) must satisfy. First, recall that the adjugate $\text{adj}(M)$ of a matrix $M$ is a matrix whose entries are integer polynomials in those of $M$ and which satisfies 
$$M \text{adj}(M) = \det(M).$$
If $\det(M) = 0$ and $\text{adj}(M) \neq 0$, then some column of $\text{adj}(M)$ lies in the kernel of $M$. Thus:

If $M$ is a counterexample, then $\text{adj}(M) = 0$.

When $n = 2$, we have $\text{adj}(M) = 0 \Rightarrow M = 0$, so this settles the $2 \times 2$ case. 
Second observation: recall that by Cayley-Hamilton $p(M) = 0$ where $p$ is the characteristic polynomial of $M$. Write this as
$$M^k q(M) = 0$$
where $q$ has nonzero constant term. If $q(M) \neq 0$, then there exists some $v \in R^n$ such that $w = q(M) v \neq 0$, hence $M^k w = 0$ and one of the vectors $w, Mw, M^2 w,\dots, M^{k-1} w$ necessarily lies in the kernel of $M$. Thus if $M$ is a counterexample we must have $q(M) = 0$ where $q$ has nonzero constant term.
Now for every prime ideal $P$ of $R$, consider the induced action of $M$ on $F^n$, where $F = \overline{ \text{Frac}(R/P) }$. Then $q(\lambda) = 0$ for every eigenvalue $\lambda$ of $M$. Since $\det(M) = 0$, one of these eigenvalues over $F$ is $0$, hence it follows that $q(0) \in P$. Since this is true for all prime ideals, $q(0)$ lies in the intersection of all the prime ideals of $R$, hence

If $M$ is a counterexample and $q$ is defined as above, then $q(0)$ is nilpotent. 

This settles the question for reduced rings. Now, $\text{det}(M) = 0$ implies that the constant term of $p$ is equal to zero, and $\text{adj}(M) = 0$ implies that the linear term of $p$ is equal to zero. It follows that if $M$ is a counterexample, then $M^2 \mid p(M)$. When $n = 3$, this implies that
$$q(M) = M - \lambda$$
where $\lambda$ is nilpotent, so $M$ is nilpotent and thus must have nontrivial kernel. So this settles the $3 \times 3$ case. 
Third observation: if $M$ is a counterexample, then it is a counterexample over the subring of $R$ generated by the entries of $M$, so

We may assume WLOG that $R$ is finitely-generated over $\mathbb{Z}$.

REPLY [3 votes]: Here is an elementary proof of the fact that if the determinant $D$ of an $n \times n$ matrix M is a zero-divisor, then there is a nonzero vector $X$ such that $MX = 0$.
Let $a$ be a nonzero scalar such that $aD = 0$. Let $M'$ be a square submatrix of $M$ of maximum size $r$ such that $a \det M' \ne 0$. (If there is no such submatrix, let $r = 0$.) We have $r < n$ by the definition of $a$. After permuting the rows and columns of $M$ if necessary, we may assume that $M'$ is located in the top left corner of $M$. 
Let $M''$ be the $r \times (r + 1)$ matrix in the top left corner of $M$, and let $d_j$, for $j = 1, \dots, r+1$, be the minor of $M''$ obtained by deleting its $j$th column.
Now define $X = aX_0$, where
$$X_0 = (d_1, -d_2, \dots, (-1)^r d_{r+1}, 0, \dots, 0).$$
We have $ad_{r+1} = a\det M' \ne 0$, so $X \ne 0$. 
I claim that $MX = 0$. If $i > r$, then the $i$th coordinate of $MX_0$ is, up to sign, the minor of $M$ obtained from its first $r + 1$ columns and rows $1, 2, \dots, r, i$. By the definition of $r$, this minor becomes zero upon multiplication by $a$. When $i \leq r$, the the $i$th coordinate of $MX_0$ is zero because it is, up to sign, the determinant obtained by extending $M''$ with its own $i$th row. This proves the claim.