Can you determine from the minors if the presented module is free? Motivation (you can ignore this part): A problem in Hartshorne (II.5.8c) asks to show that if we have a coherent sheaf $\mathscr{F}$ on a reduced noetherian scheme $X$, and the function
$$\varphi(x)=\dim_{k(x)} \mathscr{F}_x \otimes_{\mathcal{O}_x} k(x)$$
is constant on $X$ (where $k(x)$ is the residue field), then in fact $\mathscr{F}$ is locally free. (This is a homework problem for me.) I think that if $X$ is affine (say $=\operatorname{Spec}A$), then $\mathscr{F}$ will actually be free, not just locally. It will certainly be true that $\mathscr{F}$ will be the sheaf associated with a finitely generated $A$-module $M$, so there will be an exact sequence
$$0\rightarrow K\rightarrow A^m \rightarrow M\rightarrow 0$$
for some $m\in\mathbb{N}$, and because $A$ is noetherian, $K$ will be finitely generated. Thus $M$ is a finitely presented module, say by the matrix
$$\begin{pmatrix}
g_{11}&\dots& g_{1r}\\
\vdots &\ddots &\vdots \\
g_{m1}&\dots& g_{mr}
\end{pmatrix}$$
Then if $x=\mathfrak{p}\triangleleft A$, $\mathscr{F}_x\otimes_{\mathcal{O}_x}k(x) = M_\mathfrak{p}\otimes_{A_\mathfrak{p}}k(\mathfrak{p}) = M\otimes_A k(\mathfrak{p})$ is precisely the module presented by this matrix except with the entries interpreted as elements of $k(\mathfrak{p})$. The condition that $\varphi(x)$ is constant means that the rank of this matrix (with entries interpreted in $k(\mathfrak{p})$) doesn't depend on $\mathfrak{p}$. (Say it always $=s$.) Then the original matrix (entries interpreted in $A$) has the property that no $\mathfrak{p}\triangleleft A$ contains every $s\times s$ minor; however, every $\mathfrak{p}$ contains every $(s+1)\times (s+1)$ minor. The former condition means that the $s\times s$ minors generate the unit ideal in $A$. Since $A$ is presumed to be a reduced ring, the latter condition means that every $(s+1)\times(s+1)$ minor is zero.
Now $\mathscr{F}$ is free iff $M$ is free. So if it's true that $X$ affine $\Rightarrow$ $\mathscr{F}$ is free (under the conditions of the question), then what I want to show is the plausible-to-me-seeming claim that if a matrix fulfills the conditions just described, then it presents a free module. It seems to me that if this is true it will not depend on the noetherian hypothesis on $A$, since all the relevant ideals and modules are already finitely generated. So -
My question: Let $A$ be a commutative ring with unity. Let $M$ be a finitely presented module over $A$. Say that $M$ is presented by an $m\times r$ matrix with the property that the $s\times s$ minors generate the unit ideal in $A$, but all the $(s+1)\times (s+1)$ minors are zero.

Is it true that in this case $M$ is free, of rank $m-s$?

If so, can you give me a hint toward a proof? (I have been having fun with this problem so far so I'd prefer less than a full solution.)
My work so far: I checked this "by hand" in the simplest nontrivial case, that the matrix presenting $M$ is $2\times 1$ and $s=1$: suppose $a,b\in A$ and $M$ is presented by $\begin{pmatrix} a\\b\end{pmatrix}$. The condition on the $s\times s$ minors means $(a,b)=1$, so $\exists f,g\in A$ with $fa+gb=1$. (The condition on the $(s+1)\times(s+1)$ minors doesn't tell us anything because it's already forced by the shape of the matrix.) Then the $A$-linear map
$$ r\mapsto \begin{pmatrix}gr\\-fr\end{pmatrix}$$
is an isomorphism of $A^1\rightarrow M$. It is injective because $gr=-fr=0$ implies that $r=r(fa+gb)=0+0=0$, and it is surjective because for arbitrary $\begin{pmatrix}x\\y\end{pmatrix}$ in $A^2$, take $r=bx-ay$, and then since $fa=1-gb$ and $gb=1-fa$, we have
$$\begin{pmatrix}x\\y\end{pmatrix} - \begin{pmatrix}gr\\-fr\end{pmatrix} = \begin{pmatrix} x-g(bx-ay)\\ y+f(bx-ay)\end{pmatrix}=\begin{pmatrix}(1-gb)x+gay\\ (1-fa)y+fbx\end{pmatrix}=(fx+gy)\begin{pmatrix}a\\b\end{pmatrix}$$
which represents zero in $M$.
I started to look at the next simplest case I could think of: I took $A=k[a,b,c,d]/(a+b+c+d-1,ad-bc)$ for $k$ some field, and was thinking about the module presented by the matrix $\begin{pmatrix}a&b\\c&d\end{pmatrix}$. I would like to show this matrix is isomorphic to $A^1$. I still haven't thought about minors bigger than $1\times 1$ generating the unit ideal, so I realized in the interest of time I should ask for help.
A last thought: Suddenly while writing this I realized that the result I want is strongly reminiscent of the Quillen-Suslin theorem, as described in Michael Artin's Algebra. This makes me suspicious that the result I want won't be true in full generality. Any thoughts on the relation of my question to the Quillen-Suslin theorem would be appreciated as well.
 A: Even for $A$ noetherian it's not true that $M$ is free.
Proposition 1.4.10 from Bruns and Herzog, Cohen-Macaulay Rings, says the following:

Let $A$ be a noetherian ring and $M$ a finitely generated $A$-module with a finite free presentation $F_1\stackrel{\varphi}\to F_0\to M\to 0$. TFAE:
(i) $I_s(\varphi)=R$ and $I_{s+1}(\varphi)=0$;
(ii) $M$ is projective and $\operatorname{rank}M=\operatorname{rank}F_0-s$. (Here $I_t(\varphi)$ denotes the ideal generated by the $t\times t$ minors of the matrix $\varphi$.)

This shows that in your case $M$ is projective of finite rank $m-s$.
A: No, it is not true that locally free implies free on an affine scheme. Here are some details.
Consider a noetherian ring $A$  and the corresponding affine scheme $X=\text {Spec(A)}$.
A finitely generated module $M$ over $A$ corresponds to a coherent sheaf $\tilde M=\mathcal F$ on $X$.
We have the equivalences $$M \;\text  {is projective}\iff \mathcal F \;\text  {is locally free}\quad (I)$$ and $$M \;\text  {is free}\iff \mathcal F \;\text  {is free} \quad (II)$$
However the conditions $(II)$ are much stronger than $(I)$:
If the rank of $M$ (or equivalently of $\mathcal F$) is one, for example, the corresponding projective modules constitute the Picard group $\text {Pic}(A)$, denoted $\text {Pic}(X)$ in the  geometric setting.
So every non-zero element of $\text {Pic}(A)$ yields a non-free locally free coherent sheaf of rank one.
But do there exist rings with $\text {Pic} (A)\neq 0$ ?
Sure: I could give you examples but I prefer to  impress you by stating Claborn's unbelievable (but true!) result:


Given an arbitrary abelian group $G$, there exists a Dedekind domain  $A$ with  $\text {Pic}(A)=G.$
Edit on your "last thought"
Indeed Quillen-Suslin is very relevant: they proved that on $\mathbb A^n_k$ ($k$ a field) ,  corresponding to $A=k[T_1,\ldots, t_n]$, $(I)$ and $(II)$ are equivalent: every locally free sheaf on affine space is free .
This is analogous  to the result that every topological vector bundle is trivial on $\mathbb R^n$, but much more difficult.
(And  as a parenthetical remark, it is a crying shame that Suslin, one of the greatest living algebraists/algebraic geometers never got a Fields medal.)
A: To continue with the ideas of the answer of a now deleted user, I suggest to look at this article by Eisebud and Buchsbaum, titled What makes a complex exact?. 
