Chapter 2.5 was a detour into the geometric world of lines, planes, and hyperplanes. In this section, we’ll revisit the key ideas of span and linear independence that we introduced in Chapter 2.4 but from a more abstract and rigorous perspective.
You might be wondering what the point of all of this is – spans, linear independence, vector spaces, etc. What does any of this have to do with machine learning, or more specifically, that problem of predicting commute times given departure times from Chapter 1?
Remember, what we’re working towards is being able to build hypothesis functions that use multiple features to make predictions.
predicted commute timei=h(departure houri,day of monthi,day of weeki,gas left in tanki,...)
As we’ll see in Chapter 3, such a hypothesis function involves computing a linear combination of the features. To find the best possible model, we’ll need to find the best possible linear combination of the features, and to do so, we’ll need to think about the space of all possible linear combinations of the features – or the span of those features.
At times, what I’m discussing will sound abstract, pedantic, and disconnected from our overarching focus on machine learning. But bear with me – I promise it’ll all come together soon.
When we first introduced vectors back in Chapter 2.1, I mentioned that they support two key operations: addition and scalar multiplication. These two operations combine through linear combinations, as we’ve seen repeatedly throughout Chapter 2.
So far, we’ve mostly dealt with Euclidean vectors, which are the vectors that we’ve treated as ordered lists of numbers in Rn. (The term “Euclidean” refers to the fact that the vectors have some geometric meaning; we have thought of a vector as an arrow from the origin to a point in space. The term Euclidean is named after the Greek mathematician Euclid, who was one of the pioneers of the study of geometry.)
However, it’s sometimes useful to consider vectors in a more abstract setting. Euclidean vectors are not the only mathematica objects that support addition and scalar multiplication!
Together, the two properties above tell us that any linear combination of vectors in V is also a vector in V.
u,v∈V,c,d∈R⟹cu+dv∈V
R2 is a vector space: if you take any two vectors in R2 and add them together, you will still have a vector in R2. Multiply a vector in R2 by a scalar, and you’ll still have a vector in R2.
two vectors in R2u=[34],v=[−12]
also a vector in R2!2u−3v=[92]
The same holds for R3, R4, and more generally, Rn. These are all examples of vector spaces.
What might be a vector space that isn’t made up of our regular Euclidean vectors? One possible vector space is the set of all polynomials with a degree less than or equal to 3 (i.e. degree “at most 3”). This vector space, denoted by P3, is the set of all polynomials of the form
p(x)=a0+a1x+a2x2+a3x3
where a3,a2,a1,a0 are real numbers (potentially equal to 0).
u(x)=2x3−16x2+7x−1
v(x)=3x3−4x2+2x+5
w(x)=x+4
u(x), v(x), and w(x) are all elements of P3; think of each of these polynomials as a vector in P3.
Why is P3 a vector space? If you add any two polynomials with a degree of at most 3 together, you will still have a polynomial with degree at most 3. Likewise, if you multiply a polynomial with degree at most 3 by a scalar, you will still have a polynomial with degree at most 3.
Activity 1
Why are the set of polynomials of degree exactly 3 not a vector space?
Solution
It’s possible to add two polynomials with degree exactly 3 together, and get a polynomial with degree 2, which would mean that the result is not in the set of polynomials with degree exactly 3.
u(x)=x3+x2−15
v(x)=−x3+4
Here, u(x)+v(x)=x2+11, which is not a polynomial with degree exactly 3.
There are other examples of abstract vector spaces, too, like the set of all matrices with real entries, or the set of all continuous functions from R to R. In the definition of a vector space, I mentioned that the objects in the space should support addition and scalar multiplication. We know how these operations work for our traditional definition of vectors, but what do these operations look like for generic mathematical objects?
Technically, we could be even more abstract and not restrict the scalars to be real numbers, and instead allow them to be complex numbers. Such a vector space is called a complex vector space. But, we’ll stick with real vector spaces in this class, where the scalars involved in scalar multiplication are real numbers.
And even more practically, we’ll stick to focusing on the vector space Rn. Still, I wanted to provide you with some context for how to generalize these ideas.
Activity 2
Suppose we try to create a new vector space in which vector addition is defined in the following way:
[u1u2]+[v1v2]=[u1+v2u2+v1]
So for example [12]+[34]=[1+42+3]=[55].
Suppose we stick with the usual definition of scalar multiplication. Which of the 8 conditions above are not satisfied?
Suppose we consider the set of vectors with two components, where scalar multiplication is defined as
k[v1v2]=[kv1v2]
Suppose we stick with the usual definition of vector addition. Which of the 8 conditions above are not satisfied?
As I emphasized above, we’ll stick to working with vector spaces of the form Rn, made up of Euclidean vectors.
A theme that we’ve studied over the past few sections is that of a subspace: a subset of a vector space.
The span of one vector in R2 is a line through the origin, which is a 1-dimensional subspace of R2.
The span of two non-collinear vectors in R3 is a plane through the origin, which is a 2-dimensional subspace of R3.
Let me be a bit more precise with what a subspace is, given our new framing of vector spaces.
The simpler way of thinking of Properties 2 and 3 above is that if you take any two vectors u,v∈S, then any linear combination cu+dv must also be in S. If you combine elements in a subspace, they can’t “escape” the subspace.
Properties 2 and 3 above sound familiar, since they were the defining properties of a vector space. Indeed, a subspace is a vector space on its own, it’s just that it’s also a subset of a larger vector space, meaning all of its elements are also in V. The “sub” in “subspace” means “under” or “within”. A subspace can also just be the entire vector space itself – R2 is a subspace of R2, for example – which is why I’ll usually phrase definitions and theorems in terms of subspaces, rather than vector spaces.
Sometimes, other math texts will use set notation to denote subspaces, like S⊆V, but I’ll try and avoid unnecessary notation like that here.
Many years ago, one of the great math teachers I had used the following example to explain what the term closure meant:
If you put two elephants in a cage, and one day a third animal comes out, that third animal must still be an elephant. - J. Bruce White, 1938-2025
The point is not just that elephants are animals, but that if you take any two elephants and add them together, you’ll still have an elephant.
Let’s look at several possible subspaces of larger vector spaces, and see if they are subspaces (and if not, why not).
Is the set of all vectors in R2 whose first component is 1 a subspace of R2? (Notice that when I ask whether a set is a subspace, I have to specify the vector space it’s possibly a subspace of.)
In set notation, I could write this set as
{[1y]∣y∈R}
When I’m presented with a set like this, I like to think of some example vectors in the set, and see if those examples satisfy the properties of a subspace. If those examples satisfy the properties, then I’ll try and prove that the properties hold for any two vectors in the set.
This set contains vectors like [12] and [1−5]. Remember, for this set to be a subspace, it must be closed under addition and scalar multiplication. But, if I add these two example vectors together, I get
[12]+[1−5]=[2−3]
which is not a vector in the set, since its first component is not 1. So, this set is not closed under addition, and so it is not a subspace of R2. I don’t need to prove anything in a more general form here, since I’ve found a counterexample.
Also, this set doesn’t contain the zero vector [00], which it needs to in order to be a subspace.
Is the set of all vectors in R2 whose first component is 0 a subspace of R2? This is the set
{[0y]∣y∈R}
This set does contain the zero vector [00], which is a good start.
Some example vectors in this set are [02] and [0−5]. Adding these vectors together gives [0−3], which is also in the set.
That’s a good start – but can we verify that any linear combination of vectors in the set is another vector in the set?
To do so, let’s pick two arbitrary vectors in the set, u=[0x] and v=[0y]. A linear combination of these two vectors is cu+dv, or
c[0x]+d[0y]=[0cx+dy]
No matter what scalars c and d we pick, and no matter what the values of scalars x and y are, the sum cu+dv is always a vector in R2 with a first component of 0 and a second component of cx+dy. In other words, any linear combination of vectors in the set is also a vector in the set. So, this set is closed under addition and scalar multiplication, and so it is a subspace of R2.
Is the set of all unit vectors in R5 a subspace of R5? (There’s nothing special about R5; I just wanted to move away from examples in R2.) This is the set
{v∈R5∣∥v∥=1}
This is not a subspace of R5, which we can identify quickly by realizing it doesn’t contain the zero vector ⎣⎡00000⎦⎤.
If we instead changed the set to be all vectors in R5 with a norm of less than or equal to 1, i.e.
{v∈R5∣∥v∥≤1}
the resulting set would contain the zero vector in R5, but still wouldn’t be a subspace, since it’s not closed under addition or scalar multiplication. ⎣⎡10000⎦⎤ is in the set, but if we multiply it by 2, we get ⎣⎡20000⎦⎤, which is not in the set.
Is the set of all vectors in R2 with non-negative coordinates a subspace of R2? This is the set
{[xy]∣x≥0,y≥0}
Graphically, this set represents the top-right quadrant (also known as the first quadrant) of the xy-plane. If we add two vectors in this set, the third vector will also be in the set, since the sum of two non-negative numbers is non-negative. However, if we multiply a vector in this set by a negative scalar, the resulting vector will not be in the set.
from utils import plot_vectors
import plotly.express as px
import plotly.graph_objects as go
fig = plot_vectors([((2, 1), "orange", r"$$\vec u$$"), ((-4, -2), "gray", r"$$-2\vec v$$")], vdeltay=0.3)
fig.update_xaxes(
range=[-5, 5],
showgrid=False,
gridcolor="#f0f0f0",
zeroline=True,
zerolinecolor="#444",
zerolinewidth=2,
showline=False,
)
fig.update_yaxes(
range=[-5, 5],
showgrid=False,
gridcolor="#f0f0f0",
zeroline=True,
zerolinecolor="#444",
zerolinewidth=2,
showline=False,
)
fig.update_layout(
plot_bgcolor="white",
paper_bgcolor="white",
font_family="Palatino",
margin=dict(l=20, r=20, t=20, b=20),
xaxis_title="x",
yaxis_title="y",
xaxis=dict(
scaleanchor="y",
scaleratio=1,
),
width=500,
height=500
)
fig.add_shape(
type="rect",
x0=0, y0=0, x1=5, y1=5,
fillcolor="#3d81f6",
opacity=0.3,
layer="below",
line_width=0,
)
fig.add_annotation(
x=2.5,
y=2.5,
text="For this set to be a subspace,<br>any linear combination<br>must remain in the shaded area",
showarrow=False,
font=dict(
family="Palatino",
size=12,
),
align="center",
# bgcolor="#3d81f6",
# bordercolor="#3d81f6",
# borderwidth=2,
# borderpad=4,
)
fig.show(renderer='png', scale=3)
Consider the set of all vectors in R3 that lie on the line spanned by ⎣⎡1−32⎦⎤. Is this a set a subspace of R3? This is the set
{⎣⎡1−32⎦⎤∣t∈R}
Visually, this line looks like
from utils import plot_vectors
import numpy as np
import plotly.graph_objects as go
v = (1, -3, 2)
# Create the line spanned by v (all scalar multiples)
t = np.linspace(-2, 2, 100)
line_x = t * v[0]
line_y = t * v[1]
line_z = t * v[2]
fig = plot_vectors([((0, 0, 0), "#3d81f6", r"")], show_axis_labels=True, vdeltax=0.1)
# Add the line spanned by v to the 3D plot
fig.add_trace(
go.Scatter3d(
x=line_x,
y=line_y,
z=line_z,
mode="lines",
line=dict(color="rgba(0,77,64,0.6)", width=5),
showlegend=False,
hoverinfo="skip"
)
)
# Draw small points at (0, 0, 0) and the tip of v
fig.add_trace(
go.Scatter3d(
x=[0, v[0]],
y=[0, v[1]],
z=[0, v[2]],
mode="markers",
marker=dict(size=4, color=["#222", "#222"]),
showlegend=False,
hoverinfo="skip"
)
)
# Add annotations next to the two points: (0,0,0) and (2,-1,3)
fig.add_trace(
go.Scatter3d(
x=[0],
y=[0],
z=[0],
mode="text",
text=["(0, 0, 0)"],
textposition="top right",
showlegend=False,
hoverinfo="skip"
)
)
fig.add_trace(
go.Scatter3d(
x=[v[0]],
y=[v[1]],
z=[v[2]],
mode="text",
text=[f"({v[0]}, {v[1]}, {v[2]})"],
textposition="top center",
showlegend=False,
hoverinfo="skip"
)
)
# Add f0f0f0 lines at x=0, y=0, z=0 (non-removable)
axis_range = np.array([[-6, 6], [-6, 6], [-6, 6]])
# x-axis line (y=0, z=0)
fig.add_trace(
go.Scatter3d(
x=axis_range[0],
y=[0, 0],
z=[0, 0],
mode="lines",
line=dict(color="#aaa", width=1),
showlegend=False,
hoverinfo="skip"
)
)
# y-axis line (x=0, z=0)
fig.add_trace(
go.Scatter3d(
x=[0, 0],
y=axis_range[1],
z=[0, 0],
mode="lines",
line=dict(color="#aaa", width=1),
showlegend=False,
hoverinfo="skip"
)
)
# z-axis line (x=0, y=0)
fig.add_trace(
go.Scatter3d(
x=[0, 0],
y=[0, 0],
z=axis_range[2],
mode="lines",
line=dict(color="#aaa", width=1),
showlegend=False,
hoverinfo="skip"
)
)
fig.update_layout(
scene_camera=dict(
eye=dict(x=-1.2, y=2, z=1.2)
),
scene=dict(
xaxis=dict(range=[-4, 4]),
yaxis=dict(range=[-4, 4]),
zaxis=dict(range=[-6, 6]),
aspectmode="cube"
),
)
fig.show()
Loading...
If we pick any two vectors on this line, any of their linear combinations will also lie on this line. Any vector on this line is a scalar multiple of ⎣⎡1−32⎦⎤, so two arbitrary vectors on this line might look like
The last example we walked through above, {⎣⎡1−32⎦⎤∣t∈R}, is a subspace of R3. It is also the span of the vector ⎣⎡1−32⎦⎤. It turns out that this correspondence between spans and subspaces is true in general.
This is true essentially by the definition of a span. The span of a collection of vectors is defined to be the set of all of their possible linear combinations. If you pick any two vectors in the span, they’re both made of the same building blocks (spanning vectors), so if you make a linear combination of these two new vectors, that’ll still be made up of the same building blocks.
span({u,v}) contains all vectors of the form cu+dv. Let’s pick two such vectors, say
x=2u+3v,y=4u−2v
Both x and y are in span({u,v}). Now, let’s take a linear combination of these two new vectors, say, 5x−21y, and check if that’s also in span({u,v}). This linear combination is
5x−21y=5(2u+3v)−21(4u−2v)
But, simplifying this expression shows us that it’s equivalent to
5x−21y=10u+15v−2u+v=8u+16v
which clearly shows that a linear combination of x and y is really just a linear combination of u and v.
All of this is to say, if you pick any two vectors in span({u,v}), their linear combinations will also be in span({u,v}), so span({u,v}) is closed under addition and scalar multiplication. It also contains the zero vector (since you could take 0u+0v=0), so this span is a subspace of R3.
Let’s not forget that the span of two non-collinear vectors in R3 is a plane. So, since span({u,v}) is a subspace, the corresponding plane is also a subspace of R3 (because it’s the same thing as the span of the vectors).
import numpy as np
import plotly.graph_objects as go
from utils import plot_vectors
# Define the two spanning vectors
u = np.array([2, 6, -3]) # orange
v = np.array([1, 5, 0]) # blue
# To plot the plane spanned by u and v, create a grid of linear combinations
plane_extent = 5
num_points = 20
s_range = np.linspace(-plane_extent, plane_extent, num_points)
t_range = np.linspace(-plane_extent, plane_extent, num_points)
S, T = np.meshgrid(s_range, t_range)
# Compute all points s*u + t*v
X = S * u[0] + T * v[0]
Y = S * u[1] + T * v[1]
Z = S * u[2] + T * v[2]
fig = plot_vectors([
(tuple(u), "orange", "u"),
(tuple(v), "#3d81f6", "v"),
], vdeltax=3
, vdeltay=2)
# Plot the plane
fig.add_trace(go.Surface(
x=X,
y=Y,
z=Z,
opacity=0.4,
colorscale=[[0, 'rgba(61,129,246,0.8)'], [1, 'rgba(61,129,246,0.8)']],
showscale=False,
))
# Add faint lines at x=0, y=0, z=0
line_range = [-5, 5]
fig.add_trace(go.Scatter3d(
x=[0, 0], y=line_range, z=[0, 0],
mode='lines',
line=dict(color='#f0f0f0', width=2),
showlegend=False,
hoverinfo='skip'
))
fig.add_trace(go.Scatter3d(
x=line_range, y=[0, 0], z=[0, 0],
mode='lines',
line=dict(color='#f0f0f0', width=2),
showlegend=False,
hoverinfo='skip'
))
fig.add_trace(go.Scatter3d(
x=[0, 0], y=[0, 0], z=line_range,
mode='lines',
line=dict(color='#f0f0f0', width=2),
showlegend=False,
hoverinfo='skip'
))
# # Draw the two spanning vectors from the origin
# vectors = [
# dict(x=u[0], y=u[1], z=u[2], color='orange'),
# dict(x=v[0], y=v[1], z=v[2], color='#3d81f6')
# ]
# for vtx in vectors:
# fig.add_trace(go.Scatter3d(
# x=[0, vtx['x']],
# y=[0, vtx['y']],
# z=[0, vtx['z']],
# mode='lines+markers',
# line=dict(color=vtx['color'], width=8),
# marker=dict(size=4, color=vtx['color']),
# showlegend=False
# ))
fig.update_layout(
scene=dict(
xaxis=dict(
range=[-10, 10],
title='x',
backgroundcolor='white',
gridcolor='#f0f0f0',
zerolinecolor='#f0f0f0',
showbackground=True,
),
yaxis=dict(
range=[-10, 10],
title='y',
backgroundcolor='white',
gridcolor='#f0f0f0',
zerolinecolor='#f0f0f0',
showbackground=True,
),
zaxis=dict(
range=[-12, 12],
title='z',
backgroundcolor='white',
gridcolor='#f0f0f0',
zerolinecolor='#f0f0f0',
showbackground=True,
),
aspectmode='cube',
),
width=600,
height=600,
scene_camera=dict(
eye=dict(x=1.2, y=2, z=1.2)
),
font=dict(family='Palatino'),
paper_bgcolor='white',
plot_bgcolor='white'
)
fig.show()
Loading...
Chapter 2.5 shows us how to find the equation of a plane in standard form (ax+by+cz+d=0) given two non-collinear vectors in the plane. That specific equation in this case happens to be 15x−3y+4z=0, which means the set of vectors ⎣⎡xyz⎦⎤ that satisfy this equation form a subspace of R3.
What if we’re instead given a plane, rather than the span of a collection of vectors?
It turns out that not only is every span a subspace, but every subspace can be spanned by some collection of vectors. The plane x+y+z=0is a subspace of R3. Can we write it as the span of a collection of vectors? Sure we can. We know that it only takes two non-collinear vectors to span a plane, so all we need to do is pick two vectors that lie in x+y+z=0.
Arbitrarily, let’s pick the vectors ⎣⎡1−10⎦⎤ and ⎣⎡21−3⎦⎤. These vectors aren’t collinear (as a reminder, this means that one is not a scalar multiple of the other), so they span a plane.
So, the plane x+y+z=0 is the span of the vectors ⎣⎡1−10⎦⎤ and ⎣⎡21−3⎦⎤, and so it’s a subspace of R3. These are not the only two vectors that span this plane; there are infinitely many pairs of vectors that can be said to span this plane. I just picked a pair that happens to have nice numbers.
I’ve plotted the plane below, without the vectors ⎣⎡1−10⎦⎤ and ⎣⎡21−3⎦⎤, to emphasize that you should think of planes through the origin as subspaces in their own right.
Remember, subspaces must contain the zero vector, but the vector ⎣⎡000⎦⎤ doesn’t satisfy x+y+z=5. So, the plane x+y+z=5 is not a subspace of R3.
Equivalently, you know that the span of any set of vectors must also always contain the zero vector, since you’re always able to create the zero vector by taking 0 of each of the spanning vectors, 0v1+0v2+⋯+0vd=0. So, if a set does not contain the zero vector, it can’t be the span of any set of vectors, but as we just saw, all subspaces must be spanned by some set of vectors. If it can’t be a span, it can’t be a subspace, and so the plane x+y+z=5is not a subspace of R3.
In Chapter 2.4, we looked at how to find linearly independent subsets with the same span as a given set of vectors. We like the vectors we’re dealing with to be linearly independent, so that any of their linear combinations are unique and can only be created in one way. (This was proved in Chapter 2.4.)
And, through the algorithm introduced at the bottom of that section, we found that the vectors v1,v2,v5 alone have the same span as the original set of 5 vectors, but are also linearly independent.
span({v1,v2,v5})=span({v1,v2,v3,v4,v5})
The vectors v3 and v4 can be written as linear combinations of v1,v2,v5, so they are not needed to describe the span of the original set of 5 vectors. In particular,
v3=−v1+2v2,v4=2v1−3v2
There is a special name for a set of vectors that are both linearly independent and span a subspace, like v1,v2,v5 above.
In the example above, the vectors v1,v2,v5 are a basis for the span of the original set of 5 vectors, or equivalently, a basis for the subspace of R3 containing all of the vectors that can be written as linear combinations of the original 5 vectors.
Think of a basis as the minimum set of vectors you need to describe every vector in a subspace:
If you remove a vector from a basis, you’ll no longer be able to reach every vector in the subspace.
If you add an extra vector to a basis, the new set will no longer be linearly independent.
Again, continuing with the example above, since we’ve found a basis containing 3 vectors for the span of the original set of 5 vectors, the dimension of the span of the original set of 5 vectors is 3 (not 5). So, I might say
dim(span({v1,v2,v3,v4,v5}))=3
A basis for a subspace is not unique. Sure, v1,v2,v5 is a basis for the span of the original set of 5 vectors, but so is v3,v4,v5, another collection of 3 vectors.
And, since both of these bases (v1,v2,v5 and v3,v4,v5) involve 3 linearly independent vectors in R3, they span all of R3. What’s another set of linearly independent vectors in R3 that span R3? There’s the easy choice, of ⎣⎡100⎦⎤,⎣⎡010⎦⎤,⎣⎡001⎦⎤.
We say the standard basis for Rn is the set of vectors ⎣⎡100⋮0⎦⎤,⎣⎡010⋮0⎦⎤,…,⎣⎡000⋮1⎦⎤. Sometimes these vectors are written as e1,e2,…,en. In addition to being a basis for Rn, they’re also unit vectors, and orthogonal.
Since the standard basis for Rn is, well, a basis, and any basis for a subspace has the same number of elements, we know that Rn is n-dimensional.
In R2, the standard basis consists of e1=[10] and e2=[01]. e1 and e2 are linearly independent (neither is a scalar multiple of the other), and they span all of R2, which means that any other vector in R2 can be written as a linear combination of them.
Pick your favorite vector with two components, say [5−12], and you’ll be able to write it as a linear combination of the standard basis.
[5−12]=5[10]−12[01]=linear combination of standard basis5v1−12v2
Let’s look at a few more examples of possible bases for given subspaces.
They’re linearly independent, but don’t span all of R3, since no linear combination of them can equal ⎣⎡001⎦⎤ (or any other vector with a nonzero third component).
⎣⎡100⎦⎤,⎣⎡010⎦⎤,⎣⎡345⎦⎤
R3
Yes
They’re linearly independent, and span all of R3. They’re not the standard basis, but they’re still a basis.
⎣⎡100⎦⎤,⎣⎡010⎦⎤,⎣⎡001⎦⎤,⎣⎡345⎦⎤
R3
No
They span all of R3 but they’re not linearly independent. R3 has dimension 3, so a basis for R3 must have 3 vectors.
Often, we’ll need to find a basis for a given subspace. If the subspace in question is the span of a set of vectors, we can use the algorithm from the bottom of Chapter 2.4 to find a basis.
given v_1, v_2, ..., v_d
initialize linearly independent set S = {v_1}
for i = 2 to d:
if v_i is not a linear combination of S:
add v_i to S
All this algorithm does is remove linearly dependent vectors from left to right, so that the remaining vectors are linearly independent.
For example, if
v1=⎣⎡111⎦⎤,v2=⎣⎡1−2−3⎦⎤,v3=⎣⎡−301⎦⎤
A basis for span({v1,v2,v3}) is {v1,v2}, since these two vectors are linearly independent and span the same subspace as the original three vectors; v3 is a linear combination of v1 and v2, specifically v3=−2v1−v2.
Equivalently, {v1,v3} is also a basis for the same subspace, since we can equivalently say v2=−2v1−v3. Either way, dim(span({v1,v2,v3}))=2.
See the bottom of Chapter 2.4 for another worked example.
What about subspaces that aren’t expressed explicitly as a span – how do we find a basis for them? For instance, consider the subspace of R3 containing vectors ⎣⎡xyz⎦⎤ such that 2x−3y+4z=0. This is a plane through the origin, and so we know it’s spanned by two non-collinear vectors in R3.
Some subspaces aren’t explicitly expressed as a span, but we can still find a basis for them. We looked at an example of this earlier in this section, before we knew what a basis was. Specifically, we saw the plane of points ⎣⎡xyz⎦⎤ such that x+y+z=0 is spanned by ⎣⎡1−10⎦⎤ and ⎣⎡21−3⎦⎤. Since these two vectors are linearly independent, they form a basis for the subspace (a basis of dimension 2).
Activity 3
For each of the following subspaces, find two possible bases and state the dimension.
The subspace of R3 containing vectors ⎣⎡xyz⎦⎤ such that 2x−3y+4z=0.
The subspace of R6 containing vectors in which the third and fourth coordinates are 0.