StatLect
Index > Matrix algebra

Dimension of a linear space

The dimension of a linear space is defined as the cardinality (i.e., the number of elements) of its bases.

For the definition of dimension to be rigorous, we need two things:

Remember that in these lecture notes we are concentrating on linear spaces whose elements are finite-dimensional vectors or matrices.

Table of Contents

Dimension theorem

We now prove that all the bases of a given linear space have the same cardinality.

Proposition (Dimension theorem) Let $S$ be a linear space. Let [eq1] and [eq2] be two bases of $S$. Then, $n=m$.

Proof

The proof is by contradiction. Suppose that $n
eq m$. Then, we can assume without loss of generality that $n<m$ (you can always exchange the order of the two bases). Denote the first basis by[eq3]and the second basis by[eq4]Since $Y_{0}$ is a basis, there exist $m$ scalars $lpha _{1}$, ...,$lpha _{m}$ such that[eq5]At least one of the scalars must be different from zero because otherwise we would have $x_{1}=0$, in contradiction with our hypothesis that $x_{1} $is linearly independent from the other elements of X. Without loss of generality, we can assume that $lpha _{1}
eq 0$ (if it is not, we can re-number the vectors in the basis). By the basis replacement theorem (see the lecture entitled Basis of a linear space, and in particular the proof of the theorem), we have that[eq6]is also a basis. Because $Y_{1}$ is a basis, there exist $m$ scalars $eta _{1}$, ...,$eta _{m}$ such that[eq7]At least one of the scalars must be different from zero because otherwise we would have $x_{2}=0$. Furthermore, one of [eq8] must be different from zero because otherwise we would have [eq9]which contradicts the hypothesis that $x_{1}$ and $x_{2}$ are linearly independent. We can assume without loss of generality that[eq10]so that we can apply the basis replacement theorem and form a new basis[eq11]We can proceed in this way until we get the basis[eq12]But we now have a contradiction: $Y_{n}$ cannot be a basis because $y_{n+1}$ can be written as a linear combination of [eq13] and, as a consequence, the vectors of $Y_{n}$ are linearly dependent. Therefore, it must be that $m=n$.

Existence of a basis

The following proposition holds.

Proposition Let $S$ be a linear space. Then, $S$ possesses at least one basis.

Proof

Suppose first that the elements of $S$ are all the K-dimensional vectors, that is, all the vectors having K entries. Denote by $e_{k}$ a vector such that its k-th entry is 1 and all the other entries are 0. Then [eq14]is a basis for $S$ because 1) any vector $sin S$ can be written as[eq15]where $s_{k}$ is the k-th entry of $s$, and 2) no element of $B$ can be written as a linear combination of the others (they are linearly independent). Thus, if $S$ contains all the K-dimensional vectors, then it has at least one basis: the basis $B$ shown above. Now, suppose that $S$ does not contain all the K-dimensional vectors, but just a subset of them. Take any vector $s_{1}in S$. Define [eq16]If the span of $B_{1}$ coincides with $S$, then $B_{1}$ is a basis of $S$. If it does not, then take a vector $s_{2}$ that does not belong to the span of $B_{1}$ and define[eq17]which is a set of linearly independent vectors (because of the way in which we have selected $s_{2}$). If $B_{2}$ spans $S$, then it is a basis of $S$. Otherwise, take a vector $s_{3}$ that does not belong to the span of $B_{2}$ and set [eq18]Continue in this manner until you find a basis. You will find one in less than K steps because 1) $S$ is included in the set of all K-dimensional vectors; 2) we have proved that $B$ is a basis for $S$ and has cardinality $K $; 3) by the Dimension Theorem no other basis can have cardinality larger than K (a fortiori for $S$ which is a subset of the set of all K-dimensional vectors). A matrix can be written as a vector by stacking its columns vertically. Thus, the result just proved for vectors can be applied also to matrices.

Definition of dimension

Having established that a linear space always possesses a basis and all its bases have the same cardinality, we are now ready to define the concept of dimension of a linear space.

Definition Let $S$ be a linear space. Let n be the cardinality (i.e., the number of elements) of any one of its bases. Then, n is called the dimension of $S$.

The following example shows that the definition of dimension agrees with our intuition: the dimension of the space of all K-dimensional real vectors (i.e., having K real entries) is K.

Example Let $S$ be the linear space of all vectors having K real entries. From the proof of the existence of a basis, we know that [eq19]is a basis for $S$, where $e_{k}$ is a vector such that its k-th entry is 1 and all the other entries are 0. Thus, $B$ has K elements and the dimension of the space $S$ is K.

Note that the dimension of a linear space of vectors having K entries can be less than K, as shown by the following example.

Example Consider the linear space of $3$-dimensional vectors[eq20]such that their first two entries can be any scalars $lpha _{1}$ and $lpha _{2}$, and their third entry is equal to 0. Such a space is spanned by the basis[eq21]whose cardinality is equal to $2$. Therefore, the dimension of the space is equal to $2$.

Solved exercises

Below you can find some exercises with explained solutions.

Exercise 1

Read the last example and show that $B$ is indeed a basis.

Solution

Denote the two elements of the basis by[eq22]The two vectors are linearly independent because neither of them is a multiple of the other one. Furthermore, all the vectors of the space can be written as[eq23]that is, as a linear combination of the two vectors belonging to the basis.

Exercise 2

Find the dimension of the linear space $S$ spanned by the two vectors[eq24]

Solution

The linear span of $s_{1}$ and $s_{2}$ is the space $S$ of all vectors that can be written as linear combinations of $s_{1}$ and $s_{2}$. In other words, any $sin S$ can be written as[eq25]where $lpha _{1}$ and $lpha _{2}$ are two scalars. However, the two vectors $s_{1}$ and $s_{2}$ are linearly dependent because[eq26]Therefore, any vector $sin S$ can be written as[eq27]that is, all vectors are multiples of $s_{1}$. Thus, [eq28]is a basis for $S$. Its cardinality is 1. Therefore, the dimension of $S$ is 1.

The book

Most of the learning materials found on this website are now available in a traditional textbook format.