The first question is already answered very nicely by Steven Landsburg. My answer adds references and further results while addressing, to some extent, your second and third questions (see the last two sections).
Some of the remarks below are very general, but each paragraph concludes with statements that are specific to affine algebras or affine domains, the setting of your post.
Most of the content of my answer has been extracted from three textbooks: [2, VIII.2] (Projective Modules over Affine Algebras) , the end of [1, 11.5] (Suslin's theorems on affine algebras) and some items of [3]. I elaborate on each excerpt, trying to address also some practical aspects.
Your first question asks about practical means to decide whether an element $e$ of the free module $A^n$, with $A$ an affine domain, can be completed in a basis of $A^n$. I will tackle this question first, and then consider the case of multiple rows.
Completing a single unimodular row into an invertible square matrix (1st question).
The more general question where $A$ is replaced by an arbitrary unital ring $R$ (I will assume throughout that $R$ is commutative for simplicity), has been investigated extensively in the context of the study of stably free modules, particularly in the resolution of Serre's problem on projective modules and its generalizations [9]. Let us make this connection explicit.
An $R$-module $P$ is said to be stably free of type $m$ ($0 \le m < \infty$) if $P \oplus R^m$ is free. The module $P$ is stably free if it is stably free of type $m$ for some $m$. We say that $e \in R^n$ is a unimodular row if the components of $e$ generate $R$ as an $R$-module. In other words, the row $e$ is a right-invertible matrix. We have the following
Proposition A [9, Corollary I.4.5].
The following are equivalent:
Any finitely generated stably free $R$-module is free;
Any finitely generated stably free $R$-module of type $1$ is free;
Any unimodular row over $R$-module can be completed to a square invertible matrix over $R$ (by adding a suitable number of rows).
Let us denote by $\text{Um}_n(R) \subset R^n$ the set of unimodular rows over $R$.
The following proposition highlights the link between completable unimodular rows and the action of $\text{GL}_n(R)$ on $\text{Um}_n(R)$ by matrix right-multiplication.
Proposition B [9, Proposition I.4.8]. The orbits of $\text{Um}_n(R)$ under the $\text{GL}_n(R)$-action are in $1$-$1$ correspondence with the isomorphism classes of $R$-modules $P$ for which $P \oplus R \simeq R^n$. Under this correspondence, the orbit of $(1, 0, \dots, 0)$ corresponds to the isomorphism classes of the free module $R^{n - 1}$. In particular $e \in \text{Um}_n(R)$ is completable if and only if $e \sim_{\text{GL}_n(R)} (1, 0, \dots, 0)$.
A ring which satisfies the equivalent properties of Proposition A is called a Hermit ring (T. Lam's terminology).
So, if $A$ is a Hermit ring, then it suffices for $e$ to be unimodular in order to be part of a basis of $A^n$.
Commutative semilocal rings, Dedekind rings and Bézout rings are Hermit rings [9, Examples I.4.7]. By the Quillen-Suslin Theorem [9, Theorem V.2.9] [6, Corollary 11.5.5], the ring $k[x_1, \dots, x_r]$ is a Hermit ring if $k$ is a field or a principal ideal domain. This theorem admits several generalizations which can be useful in the context of this post, see, e.g., [9, Theorems V.2.11, V.3.3] and [6, Theorem 11.5.6] = [3]. For instance, it follows from the latter theorem that $A[x_1 x_1^{-1},x_2, x_2^{-1} \dots, x_t, x_t^{-1}, x_{t + 1}, \dots, x_r]$ is a Hermit ring if $A$ is any commutative Noetherian ring of Krull dimension at most $1$. In addition, it follows from a theorem of Murthy and Swan [2], that an affine algebra $A$ over an algebraically closed ground field $k$ is a Hermit ring if its Krull dimension is $2$ ($A$ is an affine surface).
With Hermit rings, we are of course asking for too much: we want unimodular rows of any size to be completable. Let us consider individual sizes.
First, there is a trivial, but effective observation: for any commutative unital ring $R$, any unimodular row of size $2$ is completable in a matrix of $\text{SL}_2(R)$. Focusing now on size-specific statements, we are led to the following definitions.
Definition [9, I.$(4.5)_d$]. Let $d$ be a non-negative integer.
A commutative unital ring $R$ is a $d$-Hermit ring if it satisfies any of the following equivalent properties.
Any finitely generated stably free $R$-module of rank $> d$ is free.
Any unimodular row over $R$-module of size $\ge d + 2$ can be completed to a (square) invertible matrix over $R$.
For $n \ge d + 2$, $\text{GL}_n(R)$ acts transitively on $\text{Um}_n(R)$.
Definition [6, 11.1.14]. The general linear rank $\text{glr}(R)$ of $R$ is the least integer $n \ge 1$ such that $\text{GL}_{n + 1}(R)$ acts transitively on $\text{Um}_{n + 1}(R)$.
A $d$-Hermit ring $R$ in the sense of T. Lam is thus a ring $R$ which satisfies $\text{glr}(R) \le d + 1$. As already observed by Steven Landsburg, a Noetherian ring $R$ of Krull dimension $d$ is a $d$-Hermit ring. This follows from Bass's Stable Range Theorem [9, Theorem II.7.3] [6, Theorem 11.3.7] [11, Section 1.1]. This result can be strengthen for affine algebras over algebraically closed fields and also for few other classes of ground fields, see [9, Section VIII.2]. More specifically, an affine algebra $A$ over an algebraically closed field is a $(d - 1)$-Hermit ring if its Krull dimension is $d$ (this follows from [3]). By the main result of [5], such an $A$ is even a $(d - 2)$-Hermit ring if we assume moreover that $A$ is of the form $R[x]$ with $R$ regular.
We have just seen that the $d$-Hermit property for a ring $R$ ensures that every unimodular row of $R$ with size $\ge d + 2$ is completable in a matrix of $\text{GL}_{d +2}(R)$. There are also criteria that apply to an individual row of a given size. Suslin's $n!$ Theorem [9, Theorem III.4.1] has already been mentioned in Steven Landburg's answer. Section III of [9] contains several other interesting criteria of the same flavor, e.g., Corollaries III.5.5 and III.5.8.
Completing a matrix with multiple rows into an invertible square matrix (2nd question).
The $d$-Hermit property, or equivalently the property $\text{glr}(R) \le d + 1$ is also relevant in the case of multiple rows over $R$ of the same size. Indeed, it follows from [9, Proposition I.4.3 and I.$(4.5)_d$] that an $m$-by-$d$ matrix $M$ over $R$ $(m \le d + 2)$ is completable in a matrix of $\text{GL}_{d +2}(R)$ if and only if $M$ is right-invertible. Thus, if $R$ is $d$-Hermit, then there is a practical means to determine whether such a matrix $M$ can be completed: it is necessary and sufficient that the $m$-by-$m$ minors of $M$ are unimodular, i.e., the ideal generated by the $m$-by-$m$ minors of $M$ is $R$ [8, Theorem 3.7].
Identifying rows of invertible matrices (3rd question).
This section is dedicated to the third question. Let $R$ be a commutative and unital ring. Let $\Gamma_n(R)$ be the graph whose vertex set is $\text{Um}_n(R)$ and for which an edge connects two distinct vertices if the corresponding unimodular rows are the rows of a same matrix in $\text{GL}_n(R)$. Note that no unimodular row is isolated in $\Gamma_n(R)$ if $n = 2$ or if $R$ is a $(n - 2)$-Hermit ring.
Third question. Is $\Gamma_n(R)$ connected? If not, what are the connected components?
Let $H_n(R)$ denote the Hilson graph of $R$ [7], that is, the graph whose vertex set is $\text{Um}_n(R)$ and for which an edge connects two vertices (possibly the same) if the corresponding unimodular row $\alpha$ and $\beta$ satisfy $\alpha \beta^t = 1$ (i.e., the dot product is the identity element of $R$). Let $\text{E}_n(R)$ be the subgroup of $\text{GL}_n(R)$ generated by the elementary matrices, i.e., the matrices which differ from the identity by a single off-diagonal element.
We will prove the following
Claim. The following are equivalent.
- $(i)$ $\Gamma_2(R)$ is connected.
- $(ii)$ $H_2(R)$ is connected.
- $(iii)$ $R$ is a $GE_2$-ring in the sense of P. Cohn [1], i.e., $\text{SL}_2(R) = \text{E}_2(R)$.
Combining the above claim with [1, Proposition 7.3], we obtain for instance that $\Gamma_2(k[x_1, \dots, x_r])$, with $k$ a field, is connected if and only if $r \le 1$.
In general, Lemma 2 below shows that $\Gamma_n(R)$ is connected only if $H_n(R)$ is. In addition, the following theorem of Hinson shows that the number of connected components of $\Gamma_n(R)$ is not less that the cardinality of the orbit space $W_n(R) \Doteq \text{Um}_n(R)/ \text{E}_n(R)$.
Theorem [9, Theorem III.6.4]. Let $n \ge 3$.
Two vertices $\alpha$ and $\beta$ of $H_n(R)$ are connected by an edge path of even length if and only if $\alpha = \beta E$ for some $E \in \text{E}_n(R)$.
The orbit space $W_n(R)$ turns to be a group under some conditions on the spectrum of $R$ and its Krull dimension. The orbit space $W_n(R)$ is the subject of a series of papers by L. Vaserstein, A. Suslin, W. van der Kallen, M. Roitman, R. Rao and J. Fasel. A thorough account on this work is given in [9, VIII.5]. Two recent contributions to this topic are [10] and [12]; both contain results specific to affine algebras.
The proof of the claim relies on the next two lemmas.
Lemma 1 [9, Proposition III.6.6]. Let $n \ge 2$.
Let $e_1$ be the first the vector of the canonical basis of $R^n$. Then $e_1\text{E}_n(R)$ coincides with the connected component of $e_1$ in $H_n(R)$.
Lemma 2. The two following hold.
- $(1)$ If two vertices belong to the same connected component of $\Gamma_n(R)$, then they are connected by an edge path of even length in $H_n(R)$.
- $(2)$ If two vertices are connected by an edge path of even length in $H_2(R)$, then they belong to the same connected component of $\Gamma_2(R)$.
Proof of Lemma 2. We shall prove that if two unimodular rows $\alpha, \beta \in \text{Um}_n(R)$ are connected by an edge in $\Gamma_n(R)$ then they are connected by an edge path of length two in $H_n(R)$, which establishes $(1)$. Indeed, consider a matrix $M \in \text{GL}_n(R)$ whose first two rows are $\alpha$ and $\beta$. Set $\gamma \Doteq (M^{-1}(e_1 + e_2))^t$, then we have $\alpha \gamma^t = \beta \gamma^t = 1$. Assume now that $n = 2$ and let $\alpha, \beta, \gamma \in \text{Um}_n(R)$ be such that $\alpha \gamma^t = \beta \gamma^t = 1$.
Write $\gamma = (\gamma_1, \gamma_2)$ and set $\gamma' = (-\gamma_2, \gamma_1)$. As the $2$-by-$2$ matrices
$\begin{pmatrix} \alpha \\ \gamma'
\end{pmatrix}$ and $\begin{pmatrix} \beta \\ \gamma'
\end{pmatrix}$ have determinant $1$, the rows $\alpha$ and $\beta$ are connected by an edge path of length two in $\Gamma_2(R)$. Assertion $(2)$ follows immediately.
We are now in position to prove the claim.
Proof of the claim. The equivalence $(i) \Leftrightarrow (ii)$ is essentially given by Lemma 2. For the implication $(i) \Leftarrow (ii)$, we use Lemma 1 and observes that, since there is an edge looping on $e_1$ ($e_1 e_1^t = 1$), any two vertices can be connected by an edge path of even length in $H_2(R)$. The equivalence $(ii) \Leftrightarrow (iii)$ is given by Lemma 1.
[1] P. Cohn, "On the structure of the $\text{GL}_2$ of a ring", 1966.
[2] M. Murthy and R. Swan, "Vector bundles over affine surfaces", 1976.
[3] A. Suslin, "On the structure of the special linear group over polynomial rings", 1977.
[4] A. Suslin, "A cancellation theorem for projective modules over algebras", 1977.
[5] H. Lindel, "On the Bass-Quillen conjecture concerning projective modules over polynomial rings", 1981.
[6] J. McConnell, J. Robson, "Noncommutative Noetherian Rings", 1987.
[7] E. Hinson, "Path of unimodular vectors", 1989.
[8] K. Rao, "Theory of Generalized Inverses Over Commutative Rings", 2002.
[9] T. Lam, "Serre's Problem on Projective Modules", 2006.
[10] J. Fasel, "Some remarks on orbit sets of unimodular rows", 2011.
[11] C. Weibel, "The K-book: An introduction to algebraic K-theory", 2013.
[12] A. Gupta, A. Garge, R. Rao, "A nice group structure on the orbit space of unimodular rows - II", 2013.