Main content

## Linear algebra

### Unit 1: Lesson 1

Vectors- Vector intro for linear algebra
- Real coordinate spaces
- Adding vectors algebraically & graphically
- Multiplying a vector by a scalar
- Vector examples
- Scalar multiplication
- Unit vectors intro
- Unit vectors
- Add vectors
- Add vectors: magnitude & direction to component
- Parametric representations of lines

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Vector examples

Visually understanding basic vector operations. Created by Sal Khan.

## Want to join the conversation?

- In the above example, R1 is one dimensional, R2 is two dimensional, and both are represented by x and y axis; likewise, R3 is three dimensional; thus, they are forming x, y and z axis, respectively. But how to represent beyond that? E.g., R4, R5, etc., because if you're saying that we will consider axis till R infinite, then it kind of forms an imaginary sphere of axis surrounding the origin at (0,0,.. ); but even that representation is 3 dimensional, (as of those new R's are contained within the x, y, z axis, and are not increasing any dimensions). So how to plot beyond the three dimensions?(127 votes)
- Another way of imagining a 4D plot is to think of a three-dimensional space, where EVERY point in the space is filled with a color that represents the value of the 4th component of each 4-tuple. Or imagine temperatures instead of colors if that works better for you.

But generally speaking, yeah, it's basically impossible to directly represent spaces higher than R^3 in any kind of graph that is directly perceivable to our senses. That's one of the limitations of living in a three-spatial-dimension universe. You can sort of imagine them, using various tricks like imagining three-dimensional "slices" being "stacked up", imagining colors or temperatures to represent the fourth quantity, et cetera, but you'll never really imagine what 4D is like.(209 votes)

- why are vectors written in column form?(54 votes)
- because when you have to add or substract one vector from another its easier if you see both numbers you have to add or subtract next to each other. e.g. if you had a vector like this: v(2;4) and you have to add to v(-4;5). You have to look from one side to another watching clearly wath number you have to use. Instead if they are in columns you have the number right next to the other. Much easier.(129 votes)

- At5:09, shouldn't it be (x1-1, x2+2)?(72 votes)
- You are right. I did not notice that at first.(5 votes)

- He says that R^2 is a bigger space then R^1, how is this possible when they're both infinitely large?(34 votes)
- Good question,

There are many ways to compare how large two things are. In this case we might say that R^2 is larger than R^1 because R^1 fits inside R^2 but R^2 does not fit inside R^1.

This is comparable to saying plane is larger than a line you might draw on that plane. Both have an infinite number of points but one contains the other.

We compare numbers by their "value", we can compare polygons by their "area", and we can compare vector spaces by their "dimension". We can also compare these objects in other ways but these are the ones that are the most useful.(60 votes)

- since when you add and subtract vectors, it sometimes forms a triangle, can't we use some basic tric to manipulate other values of the "triangle" and/or redefine trig values in terms of vectors?

Also, I know that we usually assume vectors originate from the origin, eg. (0,0), but is it ever important to denote a vector that originates from another point in space and how would one denote that vector?(15 votes)- (I only know the answer to the first part of your question). Yes you can show a vector using trigonometry, you say < ||v|| , ∠θ > where the first one is how long the vector is, the second one is how far the vector is rotated counter-clockwise using the positive x-axis as 0. I don't know how (if there is a way) how to use that notation in 3 or higher dimensions.

As an example, let's say I have the vector < 2 , 3 >. That would be a triangle of base 2 and height 3 so the magnitude is the hypotenuse, √(13). Arctan(3/2) = ~56.31°, so the vector would be <√(13) , ∠56.31°>

http://www.wolframalpha.com/input/?i=vector+%282%2C3%29(3 votes)

- How are tuples, vectors and sets different from each other? Or what is the definition of each one and how do vary from each other? Thanks!(6 votes)
- An n-tuple is almost like slang for a list of length n, which looks like (x1, x2, ... , xn). So a 2-tuple could look like (x1, x2) which is a list of length 2, or an ordered pair.

If you can write a set of vectors in such a list then you may call it a tuple.

Here is a reasonable explaination if you need it :)

http://books.google.com.au/books?id=ovIYVIlithQC&lpg=PA4&pg=PA4#v=onepage&q&f=false

(Beginning of chapter 1 if it doesn't automatically scroll to it)(1 vote)

- Okay, R^n means that there is a n-tuple of real numbers. What about n-tumples with different kinds of numbers? For example: (x1, x2, x3, x4) where x1 is a real number, x2 is an integer, x3 is a natural number and x4 is a rational number. How to write that?(6 votes)
- The root of your question, "What about n-tuples with different kinds of numbers?" is more interesting than your example. It is in fact possible to have n-tuples with different "kinds" of numbers. Each element of the n-tuple vector may be assigned it's own unit. For example, you could define the first axis in terms of inches and the second in terms of miles.

The units of the elements don't even need to relate to each other. You might have the first axis defined in terms of temperature and the second in terms of length. It all depends on what you are trying to represent with your vector.(7 votes)

- what is the difference between linear dependence and in dependence?(6 votes)
- Maybe you were confused thinking he was saying two words "in dependence", although it's actually one word? This is discussed at length in the "Linear dependence and independence" video series here. But, the short answer is that dependence is the opposite of independence.(2 votes)

- At23:25, when applying to a vector in 4 dimensions, why does he use 4a - 2b? I thought he was simply finding the difference between the two ends of the vectors.(4 votes)
- He was just showing that you can do the same vector operations in R^4 also. By showing the scalar multiplication also, he's reinforcing that it applies in higher dimensions too. He wasn't intending to find the vector difference.(5 votes)

- I get that it's X-Y, but why is it then X+-1Y? How did it happen?(3 votes)
- Good question,

Sal is being fast with his algebra. A better way to write this might be X-Y=X+(-Y) or even X-Y=X+(-1)(Y). As we go farther along in math we might think of negative numbers as a positive number times -1. We also think of subtraction as adding a negative number. Doing both of these things at once we see that subtraction is just adding a positive number times -1.(5 votes)

## Video transcript

In the last video I was a little
formal in defining what Rn is, and what a vector is,
and what vector addition or scalar multiplication is. In this video I want to kind of
go back to basics and just give you a lot of examples. And give you a more tangible
sense for what vectors are and how we operate with them. So let me define a couple
of vectors here. And I'm going to do, most of my
vectors I'm going to do in this video are going
to be in R2. And that's because they're
easy to draw. Remember R2 is the set
of all 2-tuples. Ordered 2-tuples where each of
the numbers, so you know you could have x1, my 1 looks like a
comma, x1 and x2, where each of these are real numbers. So you each of them, x1 is a
member of the reals, and x2 is a member of the reals. And just to give you a sense
of what that means, if this right here is my coordinate
axes, and I wanted a plot all my x1's, x2's. You know you could view this
as the first coordinate. We always imagine that
as our x-axis. And then our second coordinate
we plotted on the vertical axis. That traditionally is our
y-axis, but we'll just call that the second number
axis, whatever. You could visually represent all
of R2 by literally every single point on this plane if
we were to continue off to infinity in every direction. That's what R2 is. R1 would just be points
just along one of these number lines. That would be R1. So you could immediately
see that R2 is kind of a bigger space. But anyway, I said that I
wouldn't be too abstract, that I would show you examples. So let's get some vectors
going in R2. So let me define my vector a. I'll make it nice and bold. My vector a is equal to,
I'll make some numbers up, negative 1, 2. And my vector b, make it nice
and bold, let me make that, I don't know, 3, 1. Those are my two vectors. Let's just add them up
and see what we get. Just based on my definition
of vector addition. I'll just stay in one color
for now so I don't have to keep switching back and forth. So a, nice deep a, plus bolded
b is equal to, I just add up each of those terms.
Negative 1 plus 3. And then 2 plus 1. That was my definition
of vector addition. So that is going to be
equal to 2 and 3. Fair enough that just
came out of my definition of vector addition. But how can we represent
this vector? So we already know that if we
have coordinates, you know, if I have the coordinate, and this
is just a convention. It's just the way
that we do it. The way we visualize things. If I wanted to plot the
point 1, 1, I go to my coordinate axes. The first point I go along
the horizontal, what we traditionally call our x-axis. And I go 1 in that direction. And then convention is, the
second point I go 1 in the vertical direction. So the point 1, 1. Oh, sorry, let me
be very clear. This is 2 and 2, so one
is right here, and one is right there. So the point 1, 1 would
be right there. That's just the standard
convention. Now our convention for
representing vectors are, you might be tempted to say, oh,
maybe I just represent this vector at the point
minus 1, 2. And on some level
you can do that. I'll show you in a second. But the convention for vectors
is that you can start at any point. Let's say we're dealing with
two dimensional vectors. You can start at any
point in R2. So let's say that you're
starting at the point x1, and x2. This could be any point in R2. To represent the vector, what
we do is we draw a line from that point to the point x1. And let me call this, let's say
that we wanted to draw a. So x1 minus 1. So this is, I'm representing
a. So this is, I want to represent
the vector a. x1 minus 1, and then
x1 plus 2. Now if that seems confusing to
you, when I draw it, it'll be very obvious. So let's say I just want to
start at the point, let's just say for quirky reasons, I just
pick a random point here. I just pick a point. That one right there. That's my starting point. So minus 4, 4. Now if I want to represent my
vector a, what I just said is that I add the first term
in vector a to my first coordinate. So x1 plus minus 1
or x1 minus 1. So my new one is going to be,
so this is my x1 minus 4. So now it's going to be, let's
see, I'm starting at the point minus 4 comma 4. If I want to represent a, what
I do is, I draw an arrow to minus 4 plus this first
term, minus 1. And then 4 plus the
second term. 4 plus 2. And so this is what? This is minus 5 comma 6. So I go to minus 5 comma 6. So I go to that point right
there and I just draw a line. So my vector will
look like this. I draw a line from
there to there. And I draw an arrow
at the end point. So that's one representation
of the vector minus 1, 2. Actually let me do it
a little bit better. Because minus 5 is actually
more, a little closer to right here. Minus 5 comma 6 Is right
there, so I draw my vector like that. But remember this point minus
4 comma 4 was an arbitrary place to draw my vector. I could have started
at this point here. I could have started at the
point 4 comma 6 and done the same thing. I could have gone minus 1 in
the horizontal direction, that's my movement in the
horizontal direction. And then plus 2 in the
vertical direction. So I could have drawn, so minus
1 in the horizontal and plus 2 in the vertical
gets me right there. So I could have just as easily
drawn my vector like that. These are both interpretations
of the same vector a. I should draw them in the
color of vector a. So vector a was this light
blue color right there. So this is vector a. This is vector a. Sometimes there'll
be a little arrow notation over the vector. But either of those vectors. I could draw an infinite
number of vector a's. I could draw vector a here. I could draw it like that. Vector a, it goes
back 1 and up 2. So vector a could
be right there. Similarly vector b. What does vector b do? I could pick some arbitrary
point for vector b. It goes to the right 3, so it
goes to the right 1, 2, 3 and then it goes up 1. So vector b, one representation
of vector b, looks like this. Another represention. I can start it right here. I could go to the right 3,
1, 2, 3, and then up 1. This would be another
representation of my vector b. There's an infinite number of
representations of them. But the convention is to often
put them in what's called the standard position. And that's to start
them off at 0, 0. So your initial point, let
me write this down. Standard position is just to
start the vectors at 0, 0 and then draw them. So vector a in standard
position, I'd start at 0, 0 like that and I would go
back 1 and then up 2. So this is vector a in standard
position right there. And then vector b in
standard position. Let me write that. That's a. And then vector b in standard
position is 3, go to the 3 right and then up 1. These are the vectors in
standard position, but any of these other things we drew
are just as valid. Now let's see if we can get
an interpretation of what happened when we
added a plus b. Well if I draw that vector in
standard position, I just calculated, it's 2, 3. So I go to the right
2 and I go up 3. So if I just draw it in
standard position it looks like this. This vector right there. And at first when you look at
it, this vector right here is the vector a plus b in
standard position. When you draw it like that,
it's not clear what the relationship is when
we added a and b. But to see the relationship what
you do is, you put a and b head to tails. What that means is, you put
the tail end of b to the front end of a. Because remember, all
of these are valid representations of b. All of the representations
of the vector b. They all have, they're all
parallel to each other, but they can start from anywhere. So another equally valid
representation of vector b is to start at this point right
here, kind of the end point of vector a in standard position,
and then draw vector b starting from there. So you go 3 to the right. So you go 1, 2, 3. And then you go up 1. So vector b could also be
drawn just like that. And then you should
see something interesting had happened. And remember, this vector b
representation is not in standard position, but it's just
an equally valid way to represent my vector. Now what do you see? When I add a, which is right
here, to b what do I get if I connect the starting point of
a with the end point of b? I get the addition. I have added the two vectors. And I could have done
that anywhere. I could have started
with a here. And then I could have
done the end point. I could have started b here and
gone 3 to the right, 1, 2, 3 and then up 1. And I could have drawn b
right there like that. And then if I were to add a plus
b, I go to the starting point of a, and then
the end point of b. And that should also
be the visual representation of a plus b. Just to make sure it confirms
with this number, what I did here was I went 2 to
the right, 1, 2 and then I went 3 up. 1, 2, 3 and I got a plus b. Now let's think about
what happens when we scale our vectors. When we multiply it times
some scalar factor. So let me pick new vectors. Those have gotten monotonous. Let me define vector v. v for vector. Let's say that it is
equal to 1, 2. So if I just wanted to draw
vector v in standard position, I would just go 1 to
the horizontal and then 2 to the vertical. That's it. That's the vector in
standard position. If I wanted to do it in a non
standard position, I could do it right here. 1 to the right up 2,
just like that. Equally valid way of
drawing vector v. Equally valid way of doing it. Now what happens if I
multiply vector v. What if I have, I don't know,
what if I have 2 times v? 2 times my vector v is now going
to be equal to 2 times each of these terms. So it's
going to be 2 times 1 which is 2, and then 2 times
2 which is 4. Now what does 2 times
vector v look like? Well let me just start from
an arbitrary position. Let me just start
right over here. So I'm going to go 2
to the right, 1, 2. And I go up 4. 1, 2, 3, 4. So this is what 2 times
vector v looks like. This is 2 times my vector v. And if you look at it, it's
pointing in the exact same direction but now it's
twice as long. And that makes sense because we
scaled it by a factor of 2. When you multiply it by a
scalar, or you're not changing its direction. Its direction is the exact same
thing as it was before. You're just scaling
it by that amount. And I could draw
this anywhere. I could have drawn
it right here. I could have drawn 2v
right on top of v. Then you would have seen it,
I don't want to cover it. You would have seen that it
goes, it's exactly, in this case when I draw it in standard position, it's colinear. It's along the same line,
it's just twice as far. it's just twice as long
but they have the exact same direction. Now what happens if I were
to multiply minus 4 times our vector v? Well then that will be equal
to minus 4 times 1, which is minus 4. And then minus 4 times
2, which is minus 8. So this is on my new vector. Minus 4, minus 8. This is minus 4 times
our vector v. So let's just start at
some arbitrary point. Let's just do it in
standard position. So you go to the right 4. Or you go to the left 4. So so you go to the left
4, 1, 2, 3, 4. And then down 8. Looks like that. So this new vector is going
to look like this. Let me try and draw a relatively
straight line. There you go. So this is minus 4 times
our vector v. I'll draw a little arrow
on it to make sure you know it's a vector. Now what happened? Well we're kind of in
the same direction. Actually we're in the exact
opposite direction. But we're still along the
same line, right? But we're just in the exact
opposite direction. And it's this negative right
there that flipped us around. If we just multiplied negative
1 times this, we would have just flipped around to
right there, right? But we multiplied it
by negative 4. So we scaled it by 4, so you
make it 4 times as long, and then it's negative, so
then it flips around. It flips backwards. So now that we have that notion,
we can kind of start understanding the idea of
subtracting vectors. Let me make up 2 new
vectors right now. Let's say my vector x, nice and
bold x, is equal to, and I'm doing everything in R2, but
in the last part of this video I'll make a few examples
in R3 or R4. Let's say my vector x
is equal to 2, 4. And let's say I have
a vector y. y, make it nice and bold. And then that is equal to
negative 1, minus 2. And I want to think about
the notion of what x minus y is equal to. Well we can say that this is the
same thing as x plus minus 1 times our vector y. Right? So x plus minus 1 times
our vector y. Now we can use our
definitions. We know how to multiply
by a scalar. So we'll say that this
is equal to, let me switch colors. I don't like this color. This is equal to our
x vector is 2, 4. And then what's minus
1 times y? So minus 1 times y is minus
1 times minus 1 is 1. And then minus 1 times
minus 2 is 2. So x minus y is going to be
these two vectors added to each other, right? I'm just adding the
minus of y. This is minus vector y. So this x minus y is going to
be equal to 3 and 3 and 6. So let's see what that looks
like when we visually represent them. Our vector x was 2, 4. So 2, 4 in standard position
it looks like this. That's my vector x. And then vector y in standard
position, let me do it in a different color, I'll
do y in green. Vector y is minus 1, minus 2. It looks just like this. And actually I ended up
inadvertently doing collinear vectors, but, hey, this
is interesting too. So this is vector y. So then what's their
difference? This is 3, 6. So it's the vector 3, 6. So it's this vector. Let me draw it someplace else. If I start here I go 1, 2, 3. And then I go up 6. So then up 6. It's a vector that
looks like this. That's the difference between
the two vectors. So at first you say,
this is x minus y. Hey, how is this the difference
of these two? Well if you overlay this. If you just shift this over
this, you could actually just start here and go straight up. And you'll see that it's really
the difference between the end points. You're kind of connecting
the end points. I actually didn't want to
draw collinear vectors. Let me do another example. Although that one's kind
of interesting. You often don't see that
one in a book. Let me to define vector x
in this case to be 2, 3. And let me define vector y
to be minus 4, minus 2. So what would be x in
standard position? It would be 2, 3. It'd look like that. That is our vector x if we
start at the origin. So this is x. And then what does vector
y look like? I'll do y in orange. Minus 4, minus 2. So vector y looks like this. Now what is x minus y? Well you know, we could
view this, 2 plus minus 1 times this. We could just say
2 minus minus 4. I think you get the idea now. But we just did it the first
way the last time because I wanted to go from my basic
definitions of scalar multiplication. So x minus y is just going to
be equal to 2 plus minus 1 times minus 4, or
2 minus minus 4. That's the same thing as
2 plus 4, so it's 6. And then it's 3 minus
minus 2, so it's 5. Right? So the difference between the
two is the vector 6, 5. So you could draw it
out here again. So you could go, add 6 to 4, go
up there, then to 5, you'd go like that. So the vector would look
something like this. It shouldn't curve like that,
so that's x minus y. But if we drew them between,
like in the last example, I showed that you could draw it
between their two heads. So if you do it here, what
does it look like? Well if you start at this point
right there and you go 6 to the right and then up 5,
you end up right there. So the difference between the
two vectors, let me make sure I get it, the difference
between the two vectors looks like that. It looks just like that. Which kind of should make
sense intuitively. x minus y. That's the difference between
the two vectors. You can view the difference as,
how do you get from one vector to another
vector, right? Like if, you know, let's go
back to our kind of second grade world of just scalars. If I say what 7 minus 5 is, and
you say it's equal to 2, well that just tells you that
5 plus 2 is equal to 7. Or the difference between
5 and 7 is 2. And here you're saying, look the
difference between x and y is this vector right there. It's equal to that vector
right there. Or you could say look, if I
take 5 and add 2 I get 7. Or you could say, look, if I
take vector y, and I add vector x minus y, then
I get vector x. Now let's do something else
that's interesting. Let's do what y minus
x is equal to. y minus x. What is that equal to? Do it in another color
right here. Well we'll take minus 4, minus
2 which is minus 6. And then you have minus
2, minus 3. It's minus 5. So y minus x is going to be,
let's see, if we start here we're going to go down 6. 1, 2, 3, 4, 5, 6. And then back 5. So back 2, 4, 5. So y minus x looks like this. It's really the exact
same vector. Remember, it doesn't matter
where we start. It's just pointing in the
opposite direction. So if we shifted it here. I could draw it right
on top of this. It would be the exact as x
minus y, but just in the opposite direction. Which is just a general
good thing to know. So you can kind of do them as
the negatives of each other. And actually let me make
that point very clear. You know we drew y. Actually let me draw x, x
we could draw as 2, 3. So you go to the right
2 and then up 3. I've done this before. This is x in non standard
position. That's x as well. What is negative x? Negative x is minus 2 minus 3. So if I were to start here,
I'd go to minus 2, then I'd go minus 3. So minus x would look
just like this. Minus x. It looks just like x. It's parallel. It has the same magnitude. It's just pointing in the exact
opposite direction. And this is just a good thing
to kind of really get seared into your brain is to have an
intuition for these things. Now just to kind of finish up
this kind of idea of adding and subtracting vectors. Everything I did so
far was in R2. But I want to show you that
we can generalize them. And we can even generalize them
to vector spaces that aren't normally intuitive for
us to actually visualize. So let me define a couple
of vectors. Let me define vector a to be
equal to 0, minus 1, 2, and 3. Let me define vector b to be
equal to 4, minus 2, 0, 5. We can do the same addition
and subtraction operations with them. It's just it'll be hard
to visualize. We can keep them in
just vector form. So that it's still useful to
think in four dimensions. So if I were to say 4 times a. This is the vector a
minus 2 times b. What is this going
to be equal to? This is a vector. What is this going
to be equal to? Well we could rewrite this as
4 times this whole column vector, 0, minus 1, 2, and 3. Minus 2 times b. Minus 2 times 4,
minus 2, 0, 5. And what is this going
to be equal to? This term right here, 4 times
this, you're going to get, the pen tablet seems to not work
well there, so I'm going to do it right here. 4 times this, you're going to
get 4 times 0, 0, minus 4, 8. 4 times 2 is 8. 4 times 3 is 12. And then minus, I'll do it in
yellow, minus 2 times 4 is 8. 2 times minus 2 is minus 4. 2 times 0 is 0. 2 times 5 is 10. This isn't a good part of my
board, so let me just. It doesn't write well
right over there. I haven't figured out the
problem, but if I were just right it over here,
what do we get? With 0 minus 8? Minus 8. Minus 4, minus 4. Minus negative 4. So that's minus 4 plus
4, so that's 0. 8 minus 0 is 8. 12 minus, what was this? I can't even read it,
what it says. Oh, this is a 10. Now you can see it again. Something is very bizarre. 2 times 5 is 10. So it's 12 minus
10, so it's 2. So when we take this vector
and multiply it by 4, and subtract 2 times this vector,
we just get this vector. And even though you can't
represent this in kind of an easy kind of graph-able format, this is a useful concept. And we're going to see this
later when we apply some of these vectors to
multi-dimensional spaces.