Main content
Linear algebra
Course: Linear algebra > Unit 1
Lesson 4: Subspaces and the basis for a subspaceLinear subspaces
Introduction to linear subspaces of Rn. Created by Sal Khan.
Want to join the conversation?
- Why do we define linear subspaces? What are they used for? And why are they closed under addition and scalar multiplication specifically (as opposed to only being closed under addition, for example)?(76 votes)
- There are I believe twelve axioms or so of a 'field'; but in the case of a vectorial subspace ("linear subspace", as referred to here), these three axioms (closure for addition, scalar multiplication and containing the zero vector) all the other axioms derive from it.(1 vote)
- What is the difference between subset and subspace?(39 votes)
- A subset is a term from set theory. If B is a subset of a set C then every member of B is also a member of C. The elements (members) of these sets may not be vectors, or even of the same type! For instance, set C could contain a blue teapot and a small horse.
A subspace is a term from linear algebra. Members of a subspace are all vectors, and they all have the same dimensions. For instance, a subspace of R^3 could be a plane which would be defined by two independent 3D vectors. These vectors need to follow certain rules. In essence, a combination of the vectors from the subspace must be in the subspace too.(61 votes)
- what does closure mean exactly?(12 votes)
- Closure means belongs to the same set. For instance, consider the set of integers. They are closed under addition. Adding an integer to another integer gives you an integer. Adding a vector in a subspace to another vector in a subspace gives you a vector which is also in the subspace, so subspaces are closed under addition too.
For an example of something which isn't closed, consider the division of integers. This is not always closed. In the case of 4 divided by 2, the result is 2. That's still an integer, but 4 divided by 5 is 4/5 which is not an integer. It is a rational number which doesn't belong to the set of integers. I'm rambling a bit, but hope it helps!(45 votes)
- Is a subspace of R2 always either zero-vector, or a line, or all of R2? Is there any other possible way to divide R2 that creates a subspace?
Is the overall point then that a point is a subspace of a line, a line is a subspace of a plane, a plane is a subspace of a 3-d space, a 3-d space is a subspace of an R4 "space", and so on, and there are no other valid subspaces?(34 votes)- Technically speaking, R^2 is a subspace unto itself!
This is refereed to as an "improper subspace".(7 votes)
- Sal is claiming that Span(v_1, v_2, v_3) will always be a subspace of R^3. But what if the vectors are linearly dependant in which case Span(v_1, v_2, v_3) = R^2? R^2 isn't a subspace of R^3 is it? What's going on here?(9 votes)
- If the vectors are linearly dependent (and live in R^3), then span(v1, v2, v3) = a 2D, 1D, or 0D subspace of R^3. Note that R^2 is not a subspace of R^3. R^2 is the set of all vectors with exactly 2 real number entries. R^3 is the set of all vectors with exactly 3 real number entries. Saying R^2 is a subspace of R^3 is false because that's like saying a vector with exactly 2 entries also has exactly 3 entries (that's obviously wrong because 2 doesn't equal 3).(13 votes)
- Does it mean that all subspaces must pass origin? For exemple in R3 a plane must go trough origin otherwise it is not a valid subspace?(7 votes)
- I think so. Otherwise it does not contain the zero vector.(8 votes)
- Do you guys know of any webpage where I can do linear algebra exercises?(6 votes)
- Normally I'd suggest Khan Academy, but there are definitely not as many exercises here as I would like.
Here's were I found some resources.
https://www.reddit.com/r/math/comments/1bhznf/suggestions_for_resources_to_selfstudy_linear/?st=jgqruxfc&sh=18b3d131
Almost wish I still had my college text book. Almost.(5 votes)
- In R2, does it mean that there are only 3 possible "forms"/"shape" for a span: a point (the set containing the zero vector only), a line, and a plane (the whole R2 itself) ?(4 votes)
- Yes, exactly. This is because the shape of the span depends on the number of linearly independent vectors in the set. The span of the empty set is the zero vector, the span of a set of one (non-zero) vector is a line containing the zero vector, and the span of a set of 2 LI vectors is a plane (in the case of R2 it's all of R2).(4 votes)
- So in R2, you can't have a subspace defined as,
V = (0,2) + t(1,2)
but you can have
V = t(1,2)
as a subspace of R2?(2 votes)- Yes, that's correct, since your first V isn't closed under addition and multiplication.
Say we have V(t) = [0,2] + t[1,2]
If V is a subspace, the following must be true: V(a+b) = V(a) + V(b)
V(a+b) = [0,2] + (a+b)[1,2]
V(a) + V(b)
= [0,2] + a[1,2] + [0,2] + b[1,2]
= [0,2] + (a+b)[1,2] + [0,2]
= V(a+b) + [0,2]
So V(a+b) =/= V(a) + V(b) and V isn't a subspace.(5 votes)
- Other than R2, what else would be considered a subspace of R2? Maybe a line. If you can multiply all vectors in V by some constant, I keep thinking this will explode throughout all of R2. The only vectors (that I can think of) that won't expand out would be co-linear vectors.(2 votes)
- Any line passing through the origin is a subspace of R2. Also, the zero vector (also known as the origin) is a subspace of R2.(5 votes)
Video transcript
We now have the tools, I think,
to understand the idea of a linear subspace of Rn. Let me write that down. I'll just always call
it a subspace of Rn. Everything we're doing
is linear. Subspace of Rn. I'm going to make a
definition here. I'm going to say that
a set of vectors V. So V is some subset of vectors,
some subset of Rn. So we already said Rn, when we
think about it, it's really just really an infinitely large
set of vectors, where each of those vectors
have n components. I'm going to not formally define
it, but this is just a set of vectors. I mean sometimes we visualize it
as multi-dimensional space and all that, but if we wanted
to be just as abstract about it as possible, it's
just all the set. It's the set of all of the --
you know we could call x1, x2, all the way to xn-- where each
of these, where each of the xi's are a member of the real
numbers for all of the i's. Right? That was our definition of Rn. It's just a huge
set of vectors. An infinitely large
set of vectors. V, I'm calling that, I'm going
to call that a subset of Rn, and which means it's just some
-- you know, it could be all of these vectors, and I'll talk
about that in a second. Or it could be some subset
of these vectors. Maybe it's all of them but
one particular vector. In order for this V to be a
subspace-- so I'm already saying it's a subset of Rn. Maybe this'll help you. If I draw all of Rn here
as this big blob. So these are all of the vectors
that are in Rn. V is some subset of it. It could be all of Rn. I'll show that a second. But let's just say
that this is V. V is a subset of vectors. Now in order for V to be a
subspace, and this is a definition, if V is a subspace,
or linear subspace of Rn, this means, this
is my definition, this means three things. This means that V contains
the 0 vector. I'll do it really, that's
the 0 vector. This is equal to 0 all the
way and you have n 0's. So V contains the 0 vector,
and this is a big V right there. If we have some vector x in V. So let me write this, if my
vector x is in V, if x is one of these vectors that's included
in my V, then when I multiply x times any member
of the reals. So if x is in V, then if V is a
subspace of Rn, then x times any scalar is also in V. This has to be the case. For those of you who are
familiar with the term, this term is called closure. If I have any element of a set,
this is closure under multiplication. Let me write that down--
in a new color. This is closure under scalar
multiplication. And that's just a fancy way of
saying, look, if I take some member of my set and I multiply
it by some scalar, I'm still going to
be in my set. If I multiplied it by some
scalar and I end up outside of my set, if I ended up with some
other vector that's not included in my subset, then this
wouldn't be a subspace. In order for it to be a
subspace, if I multiply any vector in my subset by a real
scalar, I'm defining this subspace over real numbers, if
I multiply it by any real number, I should also get
another member of this subset. So this is one of the
requirements. And then the other requirement
is if I take two vectors, let's say I have vector a,
it's in here, and I have vector b in here. So this is my other requirement for v being a subspace. If a is in a-- sorry-- if vector
a is in my set V, and vector b is in my set V, then if
V is a subspace of Rn, that tells me that a and b must
be in V as well. So this is closure
under addition. Let me write that down. Closure under addition. Once again, just a very fancy
way of saying, look, if you give me two elements that's in
my subset, and if I add them to each other -- these could be
any two arbitrary elements in my subset -- and I add them
to each other, I'm going to get another element
in my subset. That's what closure under
addition means. That when you add two vectors in
your set, you still end up with another vector
in your set. You don't somehow end up
with a vector that's outside of your set. If I have a subset of Rn, so
some subset of vectors of Rn, that contains the 0 vector,
and it's closed under multiplication and addition,
then I have a subspace. So subspace implies all of these
things, and all of these things imply a subspace. This is the definition
of a subspace. This might seem all abstract to
you right now, so let's do a couple of examples. And I don't know if these
examples will make it any more concrete, but I think if we do
it enough, you'll kind of get the intuitive sense of
what a space implies. Let me just do some examples. Because I want to
stay relatively mathematically formal. Let's just say I have the almost
trivially basic set. Let's say my set of vectors, I
only have one vector in it and I have the 0 vector. So I'll just do a really
bold 0 there. Or I could write it like this,
the only vector in my set is the 0 vector. Now Let's say? We're talking about R3. So let's say my 0 vector
in R3 looks like that. What I want to know is, is my
set V a subspace of R3? Well, in order for it to be a
subspace, three conditions. It has to contain
the 0 vector. Well the only thing it does
contain is the 0 vector. So it definitely contains
the 0 vector. So 0 vector, check. Now, is it closed under
multiplication? So that means, if I take any
member of the set, there's only one of them, and I multiply
it by any scalar, I should get another member
of the set. Or I should get maybe itself. So let's see, there's only
one member of the set. So the one member of the
set is the 0 vector. If I multiply it times
any scalar, what am I going to get? I'm going to get c times 0 which
is 0, c times 0, which is 0, and c times 0. I'm going to get its
only member. But it is closed. So it is closed under
multiplication. You can multiply this one vector
times any scalar, and you're just going to get
this vector again. So you're going to end up being
in your 0 vector set. That's a check. Is it closed under addition? Well, clearly if I add any
member of this set to itself, I mean, there's only one
member, to another member of the set. There's only one option here. If I just add that to
that, what do I get? I just get that. I just get it again. So it definitely is closed
under addition. Check. So it does turn out that this
trivially basic subset of r3, that just contains the 0 vector,
it is a subspace. Maybe a trivially simple
subspace, but it satisfies our constraints of a subspace. You can't do anything with the
vectors in it, they'll somehow get you out of that subspace. Or at least if you're
dealing with scalar multiplication or addition. Let me do one that maybe the
idea will be a little clearer if I show you an example
of something that is not a subspace. Let me get my coordinate
axes is over here. Let's say I were to find some
subspace, some subset. I don't know whether
it's a subspace. Let me call it my set S. And it equals all the vectors
x1, x2 that are a member of R2 such that, I'm going to make a
little constraint here, such that x1 is greater than
or equal to 0. It contains all of the vectors
in R2 that are at least is 0 or greater for the first term. So if we were to graph that
here, what do you get? We can get anything. We can move up or down
in any direction. Right? We can go up and down in any
direction, but we're constraining ourselves. These are all going to
be 0 or greater. So all of these first
coordinates are going to be 0 or greater. And this one, we can go up
and down arbitrarily. So we're essentially, this
subset of R2, R2 is my entire Cartesian plane. But this subset of R2 will
include the vertical axis, often referred to
as the y-axis. It will include the vertical
axis, and essentially the first and fourth quadrants. If you remember your
quadrant labelling. So that's the first
quadrant and that's the fourth quadrant. So my question to you is,
is S a subspace of R2. So the first question, does
it contain the 0 vector? So in the case of R2, does
it contain 0, 0? Well, sure. It includes 0, 0 right there. We said x is greater than or
equal to 0, so this could be 0 and obviously, there's no
constraint on this, so definitely the 0, 0 vector
is definitely contained in our set S. So that is a check. Let's try another one. If I add any two vectors in this
set, is that also going to show up in my set? Let me just do a couple
of examples. Maybe this isn't a proof. If I add that vector to
that vector, what am I going to get? If I put this up here, I'm
going to get that vector. If I add that vector to
that vector, what am I going to get? I could put this one heads to
tails, I would get a vector that looks like that. And if I did it formally, if I
add -- let's say that I have two vectors that are a
member of our set. Let's say the first one is
a, b and I add it to c, d, what do I get? I get a plus c over -- this
was a d -- over b plus d. So this thing is going
to be greater than 0. This thing is also going
to be greater than 0. That was my requirement
for being in the set. So if both of these are greater
than 0 and we add them to each other, this thing
is also going to be greater than 0. And we don't care what these,
these can be anything, I didn't put any constraints
on the second component of my vector. So it does seem like it is
closed under addition. Now what about scalar
multiplication? Let's take a particular
case here. Let's take my a, b again. I have my vector a, b. Now I can pick any
real scalar. So any real scalar. What if I just multiply
it by minus 1? So minus 1. So if I multiply it by minus
1, I get minus a, minus b. If I were to draw it visually,
if this is-- let's say a, b was the vector 2, 4. So it's like this. When I multiply it by minus
1, what do I get? I get minus a, minus b. I get this vector. Which you can be visually
clearly see falls out of, if we view these as kind of
position vectors, it falls out of our subspace. Or if you just view it not even
visually, if you just do it mathematically, clearly if
this is positive then this is going to-- and let's say if we
assume this is positive, and definitely not 0. So it's definitely a
positive number. So this is definitely going
to be a negative number. So when we multiply it by
negative 1, for really any element of this that doesn't
have a 0 there, you're going to end up with something that
falls out of it, right? This is not a member of this
set, because to be a member of the set, your first component
had to be greater than 0. This first component
is less than 0. So this subset that I drew out
here, the subset of R2, is not a subspace, Because? It's not closed under
multiplication or scalar multiplication. This is not a sub space of R2. Now I'll ask you one interesting
question. What if I ask you just the span
of some set of vectors? Let's say I want to know the
span of, I don't know, let's sat I have vector
v1, v2, and v3. I'm not even going to tell you
how many elements each of these vectors have. Is this
a valid subspace of Rn? Where n is the number of
elements that each of these have. Let's pick one of
the elements. Let me define, let me just call
u to be the set-- the set of all linear combinations
of this is the span. So let me just define
u to be the span. So I want to know, is
u a valid subspace? So let's think about
it this way. Let me just pick out a
random element of u. Actually, does this contain
the 0 vector? Well, sure. If we just multiply all of these
times 0, if we just say 0 times v1, plus 0 times v2,
these are all the vectors, I didn't write them bold, plus
0 times v3, we get the 0 vector, right? We did everything
just zeroed out. So it definitely contains
the 0 vector. This is a linear combination
of those three vectors, so it's included in the span. Now let me just pick some
arbitrary member of this span. So in order to be a member of
this set, it just means that you can be represented-- let me
just call it the vector x-- it means that you can be
represented as a linear combination of these vectors. So some combination, c1 times
v1 plus c2 times v2 plus c3 times v3. Right? I'm just representing this
vector x, it's a member of this, so it can be represented
as a linear combination of those three vectors. Is this set closed under
multiplication? Well let's just multiply this
times some arbitrary constant. What is c times x? Let me scroll down
a little bit. What does c times x equal? Let me do a different
constant actually. Let me multiply it times some
arbitrary constant a. What is a times x? What's a times c1 times v1--
I'm just multiplying both sides equation times a--
a times c2 times v2 plus a times c3, v3. Right? If this was an arbitrary
constant, you could just write this as another arbitrary
constant. This is another arbitrary
constant. This is another arbitrary
constant. I want to be clear. All I did is I just multiplied
both sides of the equation times a scalar. But clearly, this expression
right here, I mean I could write this, I could rewrite this
as c4 times v1 plus c5 times v2, where this
is c5, this is c4. Plus c6 times v3. This is clearly another
linear combination of these three vectors. So, the span is the set of all
of the linear combinations of these three vectors. So clearly this is one of the
linear combinations, so it's also included in the span. So this is also in u. It's also in the span of
those three vectors. So it is closed under
multiplication. Now we just have to show that
it's closed under addition, and then we know that the span
of -- and I did three, here but you can extend an arbitrary
n number of vectors if the span of any set of
vectors is a valid subspace. Let me prove that. We already defined one x here. Let me define another vector
that's in u, or that's in the span of these vectors. And it equals, I don't know,
let's say it equals d1 times v1 plus d2 times v2
plus d3 times v3. Now what is x plus y? If I add these two vectors,
what does it equal to? Well, I could just add. x plus y means all of this stuff
plus all of this stuff. So what does that equal? It means if you just add these
together you get c1 plus d1 times v1 plus c2 plus d2 times
v2 plus c3 plus d3 times v3. Right? You had a v3 here, you had a
v3 there, you just add up their coefficients. Clearly this is just another
linear combination. These are just constants
again. That's an arbitrary constant,
that's an arbitrary constant, that's an arbitrary constant. So this thing is just a linear
combination of v1, v2, and v3. So it must be, by definition, in
the span of v1, v2, and v3. So we are definitely closed
under addition. Now, you might say, hey, Sal,
you're saying that the span of any vector is a valid subspace,
but let me show you an example that clearly, if I
just took the span of one vector, let me just define u
to be equal to the span of just the vector, let me just
do a really simple one. Just the vector 1, 1. Clearly this can't be
a valid subspace. Let's think about
this visually. What does vector
1, 1 look like? Vector 1, 1 looks like this. Right? And the span of vector 1, 1--
this is in its standard position -- the span of vector
1, 1 is all of the linear combinations of this vector. Well, there's nothing else to
add it to, so it's really just going to be all of the
scaled up and scaled down versions of this. So if you scale it up
you get things that look more like that. If you scale it down, you get
things that look more like that if you go into the
negative domain. So just by multiplying this
vector times different values, and if you're going to put
them all into a standard position, you'd essentially
get a line that looks like that. You say, gee, that doesn't look
like a whole subspace. But a couple of things. Clearly, it contains
the 0 vector. We can just scale it by 0. The span is just all of the
different scales of this. And if there are other vectors,
you would add it to those as well. But this is clearly going
to be the 0 vector. So it contains the 0 vector. Is it closed under
multiplication? Well, the span is the set of all
the vectors, where, if you take all of the real numbers
for c and you multiply it times 1, 1, that is the span. Clearly, you multiply this times
anything it's going to equal another thing that's
definitely in your span. The last thing, is it closed
under addition? So any two vectors in the span
could, let's say that I have one vector a that's
in my span. I can represent it as c1 some
scalar times my vector there. And then I have another vector
b, and I could represent it with c2 times my one vector
in my set right there. And so what is this going
to be equal to? This is going to be equal to,
this is essentially going to be equal to c-- well, get a
little more space-- this is going to be equal to c1 plus
c2 times my vector. This is almost trivially
obvious. But clearly this
is in the span. It's just a scaled up
version of this. This is in the span, it's in a
scaled up version of this. And this is also going to be
in the span of this vector, because this is just
another scalar. We could call that c3. If you just do it visually, if I
take this vector right there and I were to add it to this
vector, if you put them head to tails, you would end
up with this vector. Right there in green. I don't know if you
can see it. I'll do it in red right there. You end up with that vector. And you could do that any vector
plus any other vector on this line is going to equal
another vector on this line. Any vector on this line
multiplied by some scalar is just going to be another
vector on this line. So you're closed under
multiplication. Your closed under addition. And you include the 0 vector. So even this trivially simple
span is a valid subspace. And that just backs up the
idea that we showed here. That, in general, I could
have just made this a set of n vectors. I picked three vectors right
here, but it could've been n vectors and I could have used
the same argument that the span of n vectors is a
valid subspace of Rn. And I showed it right there.