# Vector space/Finitely generated/Dimension theory/Introduction/Section

A finitely generated vector space has many quite different bases. For example, if a system of homogeneous linear equations in $n$ variables is given, then its solution space is, due to fact, a linear subspace of $K^{n}$, and a basis of the solution space can be found by constructing an equivalent system in echelon form. However, in the process of elimination, there are several choices possible, and different choices yield different bases of the solution space. It is not even clear whether the number of basic solutions is independent of the choices. In this section, we will show in general that the number of elements in a basis of a vector space is constant and depends only on the vector space. We will prove this important property after some technical preparations, and we will take it as the starting point for the definition of the dimension of a vector space.

## Lemma

Let $K$ denote a field, let $V$ denote a $K$-vector space, and let a basis $v_{1},\ldots ,v_{n}$ of $V$ be given. Let $w\in V$ be a vector with a representation
    $w=\sum _{i=1}^{n}s_{i}v_{i}\,,$
where $s_{k}\neq 0$ for some fixed $k$. Then also the family
    $v_{1},\ldots ,v_{k-1},w,v_{k+1},\ldots ,v_{n}$
$V$

### Proof

We show first that the new family is a generating system. Because of
    $w=\sum _{i=1}^{n}s_{i}v_{i}\,$
and $s_{k}\neq 0$, we can express the vector $v_{k}$ as
    $v_{k}={\frac {1}{s_{k}}}w-\sum _{i=1}^{k-1}{\frac {s_{i}}{s_{k}}}v_{i}-\sum _{i=k+1}^{n}{\frac {s_{i}}{s_{k}}}v_{i}\,.$
Let $u\in V$ be given. Then, we can write
    ${\begin{aligned}u&=\sum _{i=1}^{n}t_{i}v_{i}\\&=\sum _{i=1}^{k-1}t_{i}v_{i}+t_{k}v_{k}+\sum _{i=k+1}^{n}t_{i}v_{i}\\&=\sum _{i=1}^{k-1}t_{i}v_{i}+t_{k}{\left({\frac {1}{s_{k}}}w-\sum _{i=1}^{k-1}{\frac {s_{i}}{s_{k}}}v_{i}-\sum _{i=k+1}^{n}{\frac {s_{i}}{s_{k}}}v_{i}\right)}+\sum _{i=k+1}^{n}t_{i}v_{i}\\&=\sum _{i=1}^{k-1}{\left(t_{i}-t_{k}{\frac {s_{i}}{s_{k}}}\right)}v_{i}+{\frac {t_{k}}{s_{k}}}w+\sum _{i=k+1}^{n}{\left(t_{i}-t_{k}{\frac {s_{i}}{s_{k}}}\right)}v_{i}.\end{aligned}}$
To show the linear independence, we may assume $k=1$ to simplify the notation. Let
    $t_{1}w+\sum _{i=2}^{n}t_{i}v_{i}=0\,$
be a representation of $0$. Then
    $0=t_{1}w+\sum _{i=2}^{n}t_{i}v_{i}=t_{1}{\left(\sum _{i=1}^{n}s_{i}v_{i}\right)}+\sum _{i=2}^{n}t_{i}v_{i}=t_{1}s_{1}v_{1}+\sum _{i=2}^{n}{\left(t_{1}s_{i}+t_{i}\right)}v_{i}\,.$
From the linear independence of the original family, we deduce $t_{1}s_{1}=0$. Because of $s_{1}\neq 0$, we get $t_{1}=0$. Therefore, $\sum _{i=2}^{n}t_{i}v_{i}=0$, and hence $t_{i}=0$ for all $i$.
$\Box$
The preceding statement is called the basis exchange lemma; the following statement is called the basis exchange theorem.

## Theorem

Let $K$ denote a field, let $V$ denote a $K$-vector space, and let a basis $b_{1},\ldots ,b_{n}$ of $V$ be given. Let
    $u_{1},\ldots ,u_{k}$
denote a family of linearly independent vectors in $V$. Then there exists a subset
    $J=\{i_{1},i_{2},\ldots ,i_{k}\}\subseteq \{1,\ldots ,n\}=I\,$
such that the family
    $u_{1},\ldots ,u_{k},b_{i},i\in I\setminus J,$
is a basis of $V$. In particular,
$k\leq n$

### Proof

We do induction over $k$, the number of the vectors in the family. For $k=0$, there is nothing to show. Suppose now that the statement is already proven for $k$, and let $k+1$ linearly independent vectors
    $u_{1},\ldots ,u_{k},u_{k+1}$
be given. By the induction hypothesis, applied to the vectors (which are also linearly independent)
    $u_{1},\ldots ,u_{k},$
there exists a subset $J=\{i_{1},i_{2},\ldots ,i_{k}\}\subseteq \{1,\ldots ,n\}$ such that the family
    $u_{1},\ldots ,u_{k},b_{i},i\in I\setminus J,$
is a basis of $V$. We want to apply the basis exchange lemma to this basis. As it is a basis, we can write
    $u_{k+1}=\sum _{j=1}^{k}c_{j}u_{j}+\sum _{i\in I\setminus J}d_{i}b_{i}\,.$
Suppose that all coefficients $d_{i}=0$. Then we get a contradiction to the linear independence of $u_{j}$, $j=1,\ldots ,k+1$. Hence, there exists some $i\in I\setminus J$ with $d_{i}\neq 0$. We put $i_{k+1}:=i$. Then $J'=\{i_{1},i_{2},\ldots ,i_{k},i_{k+1}\}$ is a subset of $\{1,\ldots ,n\}$ with $k+1$ elements. By the basis exchange lemma, we can replace the basis vector $b_{i_{k+1}}$ by $u_{k+1}$, and we obtain the new basis
    $u_{1},\ldots ,u_{k},u_{k+1},b_{i},i\in I\setminus J'.$
$k$
$n$
$\Box$

## Example

We consider the standard basis $e_{1},e_{2},e_{3}$ of $K^{3}$ and the two linearly independent vectors $u_{1}={\begin{pmatrix}3\\2\\1\end{pmatrix}}$ and $u_{2}={\begin{pmatrix}5\\4\\2\end{pmatrix}}$. We want to extend this family to a basis, using the standard basis and according to the inductive method described in the proof of the basis exchange theorem. We first consider
    $u_{1}=3e_{1}+2e_{2}+e_{3}\,.$
Since no coefficient is $0$, we can extend $u_{1}$ with any two standard vectors to obtain a basis. We work with the new basis
    $u_{1},e_{1},e_{2}.$
In a second step, we would like to include $u_{2}$. We have
    $u_{2}={\begin{pmatrix}5\\4\\2\end{pmatrix}}=2{\begin{pmatrix}3\\2\\1\end{pmatrix}}-e_{1}=2u_{1}-e_{1}+0e_{2}\,.$
According to the proof, we have to get rid of $e_{1}$, as its coefficient is $\neq 0$ in this equation (we can not get rid of $e_{2}$). The new basis is, therefore,
    $u_{1},u_{2},e_{2}.$

## Theorem

Let $K$ be a field, and let $V$ be a $K$-vector space with a finite generating system. Then any two bases
$V$

### Proof

Let ${\mathfrak {b}}=b_{1},\ldots ,b_{n}$ and ${\mathfrak {u}}=u_{1},\ldots ,u_{k}$ denote two bases of $V$. According to the basis exchange theorem, applied to the basis ${\mathfrak {b}}$ and the linearly independent family ${\mathfrak {u}}$, we obtain $k\leq n$. When we apply the theorem with roles reversed, we get $n\leq k$, thus $n=k$.
$\Box$
This theorem enables the following definition.

## Definition

Let $K$ be a field, and let $V$ be a $K$-vector space with a finite generating system. Then the number of vectors in any basis of $V$ is called the dimension of $V$, written
    $\dim _{K}{\left(V\right)}.$
If a vector space is not finitely generated, then one puts $\dim _{K}{\left(V\right)}=\infty$. The null space $0$ has dimension $0$. A one-dimensional vector space is called a line, a two-dimensional vector space a plane, and a three-dimensional vector space a space (in the strict sense), but every vector space is called a space.

## Corollary

Let $K$ be a field, and $n\in \mathbb {N}$. Then the standard space $K^{n}$ has the
$n$

### Proof

The standard basis $e_{i}$, $i=1,\ldots ,n$, consists of $n$ vectors, hence the dimension is $n$.
$\Box$

## Example

The complex numbers form a two-dimensional real vector space, a basis is $1$ and ${\mathrm {i} }$.

## Example

The polynomial ring $R=K[X]$ over a field $K$ is not a finite-dimensional vector space. To see this, we have to show that there is no finite generating system for the polynomial ring. Consider $n$ polynomials $P_{1},\ldots ,P_{n}$. Let $d$ be the maximum of the degrees of these polynomials. Then every $K$-linear combination $\sum _{i=1}^{n}a_{i}P_{i}$ has at most degree $d$. In particular, polynomials of larger degree can not be presented by $P_{1},\ldots ,P_{n}$, so these do not form a generating system for all polynomials.
The preceding statement follows also from the fact that, as shown in example, the powers $X^{n}$ form an infinite basis of the polynomial ring. Hence, it can not have a finite basis, see exercise (the proof of fact only shows that two finite bases have the same length).

## Corollary

Let $V$ denote a finite-dimensional vector space over a field $K$. Let $U\subseteq V$ denote a linear subspace. Then $U$ is also finite-dimensional, and the estimate
    $\dim _{K}{\left(U\right)}\leq \dim _{K}{\left(V\right)}\,$

### Proof

Set $n=\dim _{K}{\left(V\right)}$. Every linearly independent family in $U$ is also linearly independent in $V$. Therefore, due to the basis exchange theorem, every linearly independent family in $U$ has a length $\leq n$. Suppose that $k\leq n$ has the property that there exists a linearly independent family with $k$ vectors in $U$, but no such family with $k+1$ vectors. Let ${\mathfrak {u}}=u_{1},\ldots ,u_{k}$ be such a family. This is then a maximal linearly independent family in $U$. Therefore, due to fact, it is a basis of $U$.
$\Box$
The difference
    $\dim _{K}{\left(V\right)}-\dim _{K}{\left(U\right)}$
is also called the codimension of $U$ in $V$.

## Example

Let $K$ be a field. It is easy to get an overview over the linear subspaces of $K^{n}$, as the dimension of a linear subspace equals $k$ with $0\leq k\leq n$, due to fact. For $n=0$, there is only the null space itself, for $n=1$ there is the null space and $K$ itself. For $n=2$, there is the null space, the whole plane $K^{2}$, and the one-dimensional lines through the origin. Every line $G$ has the form
    $G=Kv={\left\{sv\mid s\in K\right\}}\,,$
with a vector $v\neq 0$. Two vectors different from $0$ define the same line if and only if they are linearly dependent. For $n=3$, there is the null space, the whole space $K^{3}$, the one-dimensional lines through the origin, and the two-dimensional planes through the origin.

## Corollary

Let $K$ be a field, and let $V$ be a $K$-vector space with finite dimension $n=\dim _{K}{\left(V\right)}$. Let $n$ vectors $v_{1},\ldots ,v_{n}$ in $V$ be given. Then the following properties are equivalent.
* $v_{1},\ldots ,v_{n}$ form a basis of $V$.
* $v_{1},\ldots ,v_{n}$ form a generating system of $V$.
* $v_{1},\ldots ,v_{n}$ are linearly independent.

### Proof

$\Box$

## Theorem

Let $V$ denote a finite-dimensional vector space over a field $K$. Let
    $u_{1},\ldots ,u_{k}$
denote linearly independent vectors in $V$. Then there exist vectors
    $u_{k+1},\ldots ,u_{n}$
such that
    $u_{1},\ldots ,u_{k},u_{k+1},\ldots ,u_{n}$
form a basis
$V$

### Proof

Let $b_{1},\ldots ,b_{n}$ be a basis of $V$. Due to the basis exchange theorem, there are $n-k$ vectors from the basis ${\mathfrak {b}}$ that together with the given vectors $u_{1},\ldots ,u_{k}$ form a basis of $V$.
$\Box$
In particular, every basis of a linear subspace $U\subseteq V$ can be extended to a basis of $V$.