Math 33A Week 6: Bases of Linear Subspaces

Linear subspaces

A linear subspace VV of Rn\R^n is a non-empty collection of vectors in Rn\R^n such that

  1. if x⃗,y⃗\vec{x},\vec{y} are in VV, then x⃗+y⃗\vec{x}+\vec{y} is in VV
  2. if x⃗\vec{x} is in VV, then kx⃗k\vec{x} is in VV for any scalar kk.

So in linear subspaces we can do vector addition and scalar multiplication.

Examples of linear subspaces
  1. A plane passing through the origin in R3\R^3.
  2. A line passing through the origin in R2\R^2.
  3. All of Rn\R^n
  4. Image of a linear transformation.
  5. Kernel of a linear transformation
Non-examples of linear subspaces
  1. The unit circle in R2\R^2. This is not closed under scalar multiplication or vector addition
  2. The xx- and yy-axis of R2\R^2. This is closed under scalar multiplication, but not vector additiion.

For the first three examples, we have some intuitive idea of dimension or size. For example, a plane in R3\R^3 is 2-dimensional and a line in R2\R^2 is 1-dimensional. All of Rn\R^n is nn-dimensional.

Linear subspaces contain the zero vector

Because of the second property, every linear subspace contains 0⃗\vec{0}. Thus a plane not passing through the origin is not a linear subspace.

It turns out there is a nice way of talking about the dimension of an arbitrary linear subspace using:

Basis of a linear subspace

A set B={v⃗1,…,v⃗m}\mathcal{B}=\{\vec{v}_1,\dots, \vec{v}_m\} contained in a linear subspace VV is a basis of VV if

  1. B\mathcal{B} spans VV; which is to say that if v⃗\vec{v} is in VV, then we can express v⃗\vec{v} in terms of B\mathcal{B}:v⃗=c1v⃗1+⋯+cmv⃗m\vec{v} = c_1\vec{v}_1 +\cdots + c_m \vec{v}_mfor some scalars c1,…,cmc_1,\dots, c_m.
  2. B\mathcal{B} is linearly independent; which is to say that if c1v⃗1+⋯+cmv⃗m=0⃗,c_1\vec{v}_1 +\cdots + c_m \vec{v}_m =\vec{0}, then cj=0c_j=0 for j=1,…,mj=1,\dots,m. In otherwords, the only way to express 0⃗\vec{0} in the span of B\mathcal{B} is the trivial way.
Exericse: Practice with linear independence

Let v⃗1,…,v⃗n\vec{v}_1,\dots, \vec{v}_n be nonzero vectors which are orthogonal. This means that if i≠ji\neq j, then v⃗j⋅v⃗i=0\vec{v}_j\cdot \vec{v}_i=0. Show that v⃗1,…,v⃗m\vec{v}_1,\dots, \vec{v}_m are linearly independent.
Solution: If c1v⃗1+⋯+cmv⃗m=0⃗c_1\vec{v}_1+\cdots + c_m\vec{v}_m=\vec{0}, then for any jj, we have(c1v⃗1+⋯+cmv⃗m)⋅v⃗j=0⃗⋅v⃗jcj(vj⃗⋅v⃗j)=0\begin{align*}(c_1\vec{v}_1+\cdots + c_m\vec{v}_m)\cdot \vec{v}_j &= \vec{0}\cdot\vec{v}_j\\ c_j(\vec{v_j}\cdot\vec{v}_j) &= 0\end{align*} Since v⃗j\vec{v}_j is nonzero, vj⃗⋅v⃗j≠0\vec{v_j}\cdot\vec{v}_j\neq 0, so cj=0c_j=0.

Exerise: Coordinates in a basis

Suppose {v⃗1,…v⃗m}\{\vec{v}_1,\dots \vec{v}_m\} is a basis for VV. Show that for each v⃗\vec{v} in VV, there exist unqiue coefficients c1,…,cmc_1,\dots, c_m such that v⃗=c1v⃗1+⋯+cmv⃗m.\vec{v}= c_1\vec{v}_1+\cdots + c_m\vec{v}_m. This tells us that each representation in a specific basis is unique. We call the coefficients c1,…,cmc_1,\dots, c_m the coordinates of v⃗\vec{v} in the basis {v⃗1,…v⃗m}\{\vec{v}_1,\dots \vec{v}_m\}.

Solution: We know that V=span⁡{v⃗1,…v⃗m}V=\operatorname{span}\{\vec{v}_1,\dots \vec{v}_m\}, so for v⃗\vec{v} in VV, there exist coefficients c1,…,cmc_1,\dots, c_m such that v⃗=c1v⃗1+⋯+cmv⃗m.\vec{v}= c_1\vec{v}_1+\cdots + c_m\vec{v}_m. If there were another set of coefficients c1′,…,cm′c'_1,\dots, c_m' such that v⃗=c1′v⃗1+⋯+cm′v⃗m,\vec{v}= c_1'\vec{v}_1+\cdots + c_m'\vec{v}_m, then subtracting the two relationships gives (c1−c1′)v⃗1+⋯+(cm−cm′)v⃗m=0⃗.(c_1-c_1')\vec{v}_1+\cdots+(c_m-c_m')\vec{v}_m= \vec{0}. Then, linear independence gives us that cj=cj′c_j= c_j' for all jj. So the coefficients are unique.

Exercise: Coordinates in an orthogonal basis

Suppose {v⃗1,…,v⃗m}\{\vec{v}_1,\dots, \vec{v}_m\} is an orthogonal basis for a linear subspace VV. Find a formula for the coordinates of some vector v⃗\vec{v} in VV.

Solution: If v⃗\vec{v} is in VV, then we may write v⃗=c1v⃗1+⋯+cmv⃗m\vec{v} = c_1 \vec{v}_1 + \cdots + c_m\vec{v}_m for some coefficients c1,…,cmc_1,\dots, c_m. Taking the dot product of both sides of this relationship with v⃗j\vec{v}_j gives us (by orthogonality):
v⃗j⋅v⃗=cj(v⃗j⋅v⃗j).\vec{v}_j\cdot \vec{v} = c_j (\vec{v}_j\cdot \vec{v}_j). Hence, we have that the coordinates of v⃗\vec{v} in this basis are given by cj=vj⃗⋅v⃗v⃗j⋅v⃗j.c_j = \frac{\vec{v_j}\cdot \vec{v}}{\vec{v}_j\cdot \vec{v}_j}. Note that this means that the representation of a vector in an orthogonal basis is the sum of the orthogonal projections of that vector onto each basis vector.

It turns out that there are some nice facts about bases of linear subspaces:

Every linear subspace has a basis
Every basis of a linear subspace has the same number of elements

Using these facts, we can define:

Dimension of a linear subspace

The dimension of a linear subspace VV, denoted dim⁡(V)\dim(V), is the number of vectors in any basis of VV.

Finding Bases for Image and Kernel of Linear Transformations

We know that the image and kernel of a linear transformation are linear subspaces of their respective spaces. Let's investigate how to find bases for them.

Let AA be an m×nm\times n matrix. Then we have
ker⁡(A)={x⃗ in Rn∣Ax⃗=0⃗}.\ker(A)= \{\vec{x} \text{ in } \R^n \mid A\vec{x} = \vec{0}\}. To find such vectors, it is equivalent to solve rref⁡(A)x⃗=0⃗\operatorname{rref}(A)\vec{x}=\vec{0}. Suppose for example that the last two variables, xn−1x_{n-1} and xnx_n, are the only free variables. Then solutions will look something like:
x⃗=(c1,n−1xn−1+c1,nxn⋮cn−2,n−1xn−1+cn−2,nxnxn−1xn)=xn−1(c1,n−1⋮cn−2,n−110)+xn(c1,n⋮cn−2,n01).\vec{x} = \begin{pmatrix} c_{1,n-1}x_{n-1}+c_{1,n} x_n \\ \vdots \\ c_{n-2,n-1}x_{n-1}+c_{n-2,n}x_n\\ x_{n-1}\\ x_n\end{pmatrix} = x_{n-1}\begin{pmatrix}c_{1,n-1}\\ \vdots \\ c_{n-2,n-1}\\ 1 \\ 0\end{pmatrix} + x_n \begin{pmatrix}c_{1,n}\\ \vdots \\ c_{n-2,n}\\ 0 \\ 1\end{pmatrix}.
From this, we know that span⁡{(c1,n−1⋮cn−2,n−110),(c1,n⋮cn−2,n01)}=ker⁡(A).\operatorname{span}\left\{\begin{pmatrix}c_{1,n-1}\\ \vdots \\ c_{n-2,n-1}\\ 1 \\ 0\end{pmatrix} ,\begin{pmatrix}c_{1,n}\\ \vdots \\ c_{n-2,n}\\ 0 \\ 1\end{pmatrix}\right\}= \ker(A). Moreover, it is easy to see that these two vectors are linearly independent by looking at the last two entries (the only way to represent the zero vector is to scale each vector by 0). Hence, we have a basis for the kernel.

More generally, we have:

Basis for kernel

A basis for the ker⁡(A)\ker(A) can be found by expanding solutions to Ax⃗=0⃗A\vec{x}=\vec{0} in terms of the free variables. The vectors used to express the solutions (the ones scaled by the free variables) form a basis for the kernel.

Finding a basis for the image is a little bit easier. We know by definition of matrix-vector mulitplication that the columns A⃗1,…,A⃗n\vec{A}_1,\dots, \vec{A}_n of AA span the image:
span⁡{A⃗1,…,A⃗n}=Im⁡(A).\operatorname{span}\{\vec{A}_1,\dots, \vec{A}_n\}= \operatorname{Im}(A). Thus, to find a basis, we just need to find some subset of A⃗1,…,A⃗n\vec{A}_1,\dots, \vec{A}_n which still spans and is linearly independent.

If AA is in row-reduced echelon form, then this is an easy task: we just take the columns with a pivot. These are indeed linearly independent because the only way to linearly represent the zero vector is to scale each vector by 0. Moreover, they span the image because the other columns without pivots are trivially linear combinations of the pivot columns. Thus, removing the non-pivot columns doesn't effect the span.

Because the system Ax⃗=0⃗A\vec{x}=\vec{0} is equivalent to the system rref⁡(A)x⃗=0⃗\operatorname{rref}(A)\vec{x}=\vec{0}, the columns of AA which correspond to pivot columns in rref⁡(A)\operatorname{rref}(A) form a basis for the image. More specifically, we have c1A⃗1+⋯+cnA⃗n=0⃗c_1\vec{A}_1+\cdots+ c_n\vec{A}_n=\vec{0} if and only if c1B⃗1+⋯+cnB⃗n=0⃗c_1\vec{B}_1+ \cdots +c_n\vec{B}_n=\vec{0} where B⃗1,…,B⃗n\vec{B}_1,\dots, \vec{B}_n are the columns of rref⁡(A)\operatorname{rref}(A). Hence the columns of AA which correspond to pivot columns are immediately linearly independent via the pivot columns of rref⁡(A)\operatorname{rref}(A). Moreover, a column A⃗j\vec{A}_j is the the span of the previous columns if and only if we can write c1A⃗1+⋯+cj−1A⃗j−1+A⃗j=0⃗.c_1\vec{A}_1+ \cdots + c_{j-1}\vec{A}_{j-1}+\vec{A}_j=\vec{0}. Thus it follows that the columns of AA corresponding to non-pivot columns of rref⁡(A)\operatorname{rref}(A) are in the span of the columns of AA corresponding to pivots. Therefore, the columns of AA which correspond to pivots indeed span the image.

Ignoring the details, we have

Basis for image

The columns of AA which correspond to a pivot column of rref⁡(A)\operatorname{rref}(A) form a basis for Im⁡(A)\operatorname{Im}(A).

Example 1

Find a basis for the image and kernel of
A=(113214)A=\begin{pmatrix}1 & 1 & 3 \\ 2 & 1 &4\end{pmatrix}
Solution: The RREF of this matrix is rref⁡(A)=(101012).\operatorname{rref}(A)=\begin{pmatrix}1 & 0 & 1 \\ 0 & 1 & 2\end{pmatrix}. A basis for the image is thus {(12),(11)}.\left\{\begin{pmatrix}1 \\ 2\end{pmatrix},\begin{pmatrix}1 \\ 1\end{pmatrix}\right\}. Moreover, we have
ker⁡(A)={(−s−2ss):s in R}={s(−1−21):s in R}=span⁡{(−1−21)}.\ker(A) =\left\{\begin{pmatrix}-s \\ -2s \\ s\end{pmatrix} :s \text{ in }\R \right\}=\left\{s \begin{pmatrix}-1 \\ -2 \\ 1\end{pmatrix}: s \text{ in }\R\right\}=\operatorname{span}\left\{\begin{pmatrix}-1\\-2\\1\end{pmatrix}\right\}. Thus {(−1−21)}\left\{\begin{pmatrix}-1\\-2\\1\end{pmatrix}\right\} forms a basis for the kernel because it spans and it is linearly independent (a single nonzero vector is trivially independent).

Example 2

Find a basis for the image and kernel of
A=(10530014200000100000)A=\begin{pmatrix}1 &0 & 5 & 3 & 0 \\ 0 & 1 & 4 & 2 & 0 \\ 0 &0&0&0&1\\0&0&0&0&0\end{pmatrix}
Solution: A basis for the image is
{(1000),(0100),(0010)}.\left\{\begin{pmatrix}1 \\0\\0\\0\end{pmatrix},\begin{pmatrix}0 \\1\\0\\0\end{pmatrix},\begin{pmatrix}0 \\0\\1\\0\end{pmatrix}\right\}. In particular, for this example, it is easy to see that the non-pivot columns are in the span of the pivot columns.

The 3rd and 4th columns have no pivots, so solutions to Ax⃗=0⃗A\vec{x}=\vec{0} will be of the form
(−5x3−3x4−4x3−2x4x3x40)=x3(−5−4100)+x4(−3−2010).\begin{pmatrix}-5x_3 - 3x_4\\ -4x_3 -2x_4 \\ x_3\\ x_4\\0 \end{pmatrix}= x_3\begin{pmatrix}-5 \\ -4 \\ 1 \\0 \\0\end{pmatrix}+ x_4 \begin{pmatrix}-3 \\ -2 \\ 0 \\1\\0\end{pmatrix}. So a basis for the kernel is
{(−5−5100),(−3−20110)}\left\{\begin{pmatrix} -5 \\-5 \\ 1 \\ 0 \\ 0\end{pmatrix}, \begin{pmatrix}-3\\-2\\0\\1\\10\end{pmatrix}\right\} because its span is the kernel and is linearly independent by looking at the coordinates corresponding to the free variables.

Finding linearly independent subset of arbitrary set while preserving the span.

This method we used to find a basis for the image of a matrix can be used generally to find a linearly independent subset of an arbitrary set of vectors while preserving the span.

More specifically, if we have a set of vectors {v⃗1,…,v⃗m}\{\vec{v}_1,\dots, \vec{v}_m\}, we can put them in a matrix A=[v⃗1⋯v⃗m].A=\begin{bmatrix}\vec{v}_1 & \cdots &\vec{v}_m\end{bmatrix}. Then a basis for Im⁡(A)\operatorname{Im}(A) will be a linearly independent subset of {v⃗1,…,v⃗m}\{\vec{v}_1,\dots, \vec{v}_m\} with the same span.

This also gives us a way to get a basis from a collection of vectors which we already know spans a linear subspace.

One thing to notice is that our method to find a basis for the kernel and image shows that
dim⁡(ker⁡(A))=# of free variables\dim (\ker(A)) = \# \text{ of free variables}and
dim⁡(Im⁡(A))=# of pivots=rank⁡(A).\dim (\operatorname{Im}(A)) = \# \text{ of pivots} = \operatorname{rank}(A). We also know that the number of free variables plus the number of pivots always equals the number of columns. More generally, we have the following theorem:

Rank-Nullity Theorem

If T:Rn→RmT:\R^n\to \R^m is a linear transformation, then we have
dim⁡(ker⁡(T))+dim⁡(Im⁡(T))=n.\dim(\ker(T)) + \dim(\operatorname{Im}(T))=n.

Exercise

True or false: there exists a 3×33\times 3 matrix such that dim⁡(ker⁡(A))=dim⁡(Im⁡(A))\dim(\ker(A))= \dim(\operatorname{Im}(A)).

Solution: By rank-nullity, we have dim⁡(ker⁡(A))+dim⁡(Im⁡(A))=3,\dim(\ker(A))+\dim(\operatorname{Im}(A))=3, so it is impossible for the dimensions to match.

Exercise

Find a basis of the subspace in R3\R^3 described by solutions to 2x1+3x1+x3=0.2x_1+3x_1+x_3=0. This is a plane in R3\R^3.

Solution: We have that plane is exactly ker⁡([231])\ker(\begin{bmatrix}2& 3 &1\end{bmatrix}). The matrix in row-reduced echelon form is [13212]\begin{bmatrix}1 &\frac{3}{2} & \frac{1}{2}\end{bmatrix} so vectors in the kernel are of the form (−32s−12tst),\begin{pmatrix}-\frac{3}{2}s - \frac{1}{2}t \\ s \\ t \end{pmatrix}, so a basis for the kernel is {(−3210),(−1201)}.\left\{\begin{pmatrix}-\frac{3}{2} \\ 1 \\ 0\end{pmatrix}, \begin{pmatrix}-\frac{1}{2} \\ 0 \\ 1\end{pmatrix}\right\}.

Exercise

Find a basis of the subspace of R4\R^4 defined by all vectors orthogonal to (10−11),(0123)\begin{pmatrix}1 \\0\\-1\\1\end{pmatrix},\begin{pmatrix}0\\1\\2\\3\end{pmatrix}

Invertibility

Using Rank-Nullity and otherwise, we have a few more equivalent definitions of invertibility:

Invertibility of a matrix AA

The following are more equivalent definitions of a n×nn\times n matrix AA being invertible:

  1. Columns of AA are linearly independent
  2. Columns of AA are a spanning set of Rn\R^n
  3. Columns of AA form a basis for Rn\R^n.