# Linear Algebra over a Ring/Modules over Bézout domains

Proposition (extending a single element of a free, finite-dimensional module over a Bézout domain to a basis):
Let $R$ be a Bézout domain, and let $R^{n}$ be the $n$-dimensional free module over $R$. Let $v=(v_{1},\ldots ,v_{n})\in R^{n}$ be such that $\gcd(v_{1},\ldots ,v_{n})=1$. Then there exist elements $w_{2},\ldots ,w_{n}\in R^{n}$ such that $v,w_{2},\ldots ,w_{n}$ is a basis of $R^{n}$.
Proof: We proceed by induction on $n$. If $n=1$, the statement becomes trivial, so that the induction base is handled. Let now a general $n$ be given; we reduce the claim to the same statement for $n-1$.
Indeed, if $v=(v_{1},\ldots ,v_{n})$ is given, we may set
    $d:=\gcd(v_{2},\ldots ,v_{n})$,
and then $\gcd(v_{1},d)=\gcd(v_{1},\ldots ,v_{n})=1$. Hence, there are elements $r,s\in R$ such that
    $rv_{1}+sd=1$.
We define
    $w:=(s,-rv_{2}/d,\ldots ,-rv_{n}/d)$,
so that
    $rv+dw=e_{1}$ and $sv-v_{1}w=(0,v_{2}/d,\ldots ,v_{n}/d)$,
where for $j\in \mathbb {N}$, as usual, $e_{j}$ denotes the vector whose every component is zero except the one in the $j$-th place, which is one. From these equations it is evident that
    $\langle v,w\rangle =\langle e_{1},(0,v_{2}/d,\ldots ,v_{n}/d)\rangle$.
Also, $v$ and $w$ are linearly independent, because if there existed $b,c\in R$ such that $bv+cw=0$, then $b(0,v_{2}/d,\ldots ,v_{n}/d)=(v_{1}-sc)w$ and in particular $0=(v_{1}-sc)s$, so that either $s=0$ and $v$ and $w$ are linearly independent (almost) by definition, or $v_{1}=sc$, so that $b=1$ whenever $v_{1}\neq 0$ (once again, if $v_{1}=0$, then the vectors are automatically linearly independent). But this implies that $c|v_{j}$ for all $j\in \{1,\ldots ,n\}$, so that contrary to the assumption $\gcd(v_{1},\ldots ,v_{n})\neq 1$.
It now suffices to note that
    $R^{n}/\langle v,w\rangle =R^{n}/\langle e_{1},(0,v_{2}/d,\ldots ,v_{n}/d)\rangle \cong R^{n-1}/\langle (v_{2}/d,\ldots ,v_{n}/d)\rangle$
by the first Noether isomorphism theorem applied to the homomorphism that forgets the first component, which reduces the dimension of the problem by one as we have $\gcd(v_{2}/d,\ldots ,v_{n}/d)=1$. $\Box$
Theorem (a minimum cardinality generating set of a finitely generated torsion-free module over a Bézout domain is a basis):
Let $R$ be a Bézout domain, and let $M$ be a finitely generated torsion-free module over $R$. Then every generating set of $M$ whose cardinality is minimal is a basis of $M$.
Proof: We proceed by induction on $n$, where $n$ is the cardinality of a minimum cardinality generating set of $M$. Let $x_{1},\ldots ,x_{n}$ be a minimum cardinality generating set of $M$. Then we have a homomorphism
    $\varphi :R^{n}\to M$
such that $\varphi (e_{k})=x_{k}$ for $k\in \{1,\ldots ,n\}$, where $e_{k}$ is the element of $R^{n}$ whose every entry is zero, except for the $k$-th entry, which is one. Since $\varphi$ is surjective, the first isomorphism theorem implies that
    $M\cong R^{n}/K$,
where $K=\ker \varphi$. If $K=\{0\}$, then the claim is demonstrated. We lead $K\neq \{0\}$ to a contradiction. Indeed, in this case there is a nonzero vector $0\neq v\in K$. We denote $v:=(v_{1},\ldots ,v_{n})$ and set $d:=\gcd(v_{1},\ldots ,v_{n})$. Then $v/d\in K$, for otherwise the image of $v/d$ in $R^{n}/K$ via the canonical projection would be a torsion element. Since we have $\gcd(v_{1}/d,\ldots ,v_{n}/d)=1$, we may extend $v$ to a basis $\{v,w_{2},\ldots ,w_{n}\}$ of $R^{n}$, and then $R^{n}/K$ is generated by the images of $w_{2},\ldots ,w_{n}$ via the canonical projection. Yet this contradicts the minimality of $n$. $\Box$
Theorem (Dedekind's theorem):
Let $R$ be a Bézout domain, and let $M$ be a torsion-free module over $R$. Then every finitely generated submodule $N\leq M$ is free.
Proof: If $M$ is torsion-free, then every submodule of $M$ is torsion-free as well. Hence, $N$ as in the theorem's statement is torsion-free and finitely generated. Hence, there exists a basis of $N$. $\Box$
Proposition (basis extension over Bézout domains):
Let $R$ be a Bézout domain, and let $M$ be a torsion-free module over $R$. If $v_{1},\ldots ,v_{k}$ are linearly independent vectors in $M$ such that $M/\langle v_{1},\ldots ,v_{k}\rangle$ is torsion-free and finitely generated, then we find an $n\in \mathbb {N}$ and vectors $v_{k+1},\ldots ,v_{n}\in M$ such that the vectors $v_{1},\ldots ,v_{k},v_{k+1},\ldots ,v_{n}$ constitute a basis of $M$.
Proof: Since $M/\langle v_{1},\ldots ,v_{k}\rangle$ is torsion-free and finitely generated, upon choosing a generating set of minimal cardinality we obtain a basis of that module. We shall denote this basis by $g_{1},\ldots ,g_{m}$. If moreover
    $\pi :M\to M/\langle v_{1},\ldots ,v_{k}\rangle$
is the canonical projection, we choose a $w_{j}\in \pi ^{-1}(g_{j})$ for each $j\in \{1,\ldots ,m\}$. We claim that $\{v_{1},\ldots ,v_{k},w_{1},\ldots ,w_{m}\}$ is a basis. First, we prove that these vectors are linearly independent. Indeed, suppose that $a_{1},\ldots ,a_{m},b_{1},\ldots ,b_{k}\in R$ are such that
    $0=a_{1}w_{1}+\cdots +a_{m}w_{m}+b_{1}v_{1}+\cdots +b_{k}v_{k}$.
Since $\pi$ is a homomorphism,
    $0=\pi (0)=\pi (a_{1}w_{1}+\cdots +a_{m}w_{m}+b_{1}v_{1}+\cdots +b_{k}v_{k})=a_{1}g_{1}+\cdots +a_{m}g_{m}$,
so that $a_{1}=a_{2}=\cdots =a_{m}=0$. Thus
    $b_{1}v_{1}+\cdots +b_{k}v_{k}=0$,
which by virtue of the linear independence of $v_{1},\ldots ,v_{k}$ implies $b_{1}=b_{2}=\cdots =b_{k}=0$.
It remains to show that $\{v_{1},\ldots ,v_{k},w_{1},\ldots ,w_{m}\}$ is a generating set of $M$. In order to do so, suppose that $u\in M$ is arbitrary. We choose $a_{1},\ldots ,a_{m}\in R$ such that
    $\pi (u)=a_{1}g_{1}+\cdots +a_{m}g_{m}$.
We further define $u':=u-a_{1}w_{1}-\cdots -a_{m}w_{m}$, so that $\pi (u')=0$. But by the definition of $\pi$, this means that $u'\in \langle v_{1},\ldots ,v_{k}\rangle$, so that there are $b_{1},\ldots ,b_{k}\in R$ such that
    $u'=b_{1}v_{1}+\cdots +b_{k}v_{k}$, hence $u=u'+a_{1}w_{1}+\cdots +a_{m}w_{m}=b_{1}v_{1}+\cdots +b_{k}v_{k}+a_{1}w_{1}+\cdots +a_{m}w_{m}$,
which shows that $\{v_{1},\ldots ,v_{k},w_{1},\ldots ,w_{m}\}$ is a generating set of $M$ since $u$ was arbitrary. $\Box$
Theorem (dimension formula):