Main content

## Precalculus

### Course: Precalculus > Unit 7

Lesson 9: Transforming 3D and 4D vectors with matrices# Using matrices to transform a 4D vector

4X4 matrices can define transformations of the 4D space. In this worked example, we see how to find the image of a given 4D vector under the transformation defined by a given matrix. Created by Sal Khan.

## Want to join the conversation?

- I don't get how to do this, I think I skipped a few lessons. What lesson should I start from to understand the basics?(3 votes)
- If you are already familiar with Matrix and Vector math, then this is probably a good starting point for taking on matrices as transformations:

https://www.khanacademy.org/math/precalculus/x9e81a4f98389efdf:matrices/x9e81a4f98389efdf:matrices-as-transformations/v/matrices-as-transformations-of-the-plane(3 votes)

## Video transcript

- [Trainer] We've already
thought a lot about two by two transformation
matrices as being able to map any point in the coordinate
plane to any other point or any two-dimensional vector to any other two-dimensional vector. What we're going to do in
this video is generalize a bit and realize that the same principles can be used for n dimensional spaces. Now I know that sounds a little bit fancy and it really is on some level, but it's really the same ideas. So for example, let's extend what we know about two dimensions, let's extend it to say four dimensions. So let's write a
four-dimensional vector here and it is hard to visualize
in four dimensions, so don't be hard on yourself
if you have trouble. Two dimensions not too hard,
three dimensions not too hard, four dimensions a little bit hard for us. Maybe we have to think about
time as the fourth dimension but in matrix world or in vector world, it's pretty easy to represent them as hard a it is to visualize. So a four-dimensional vector,
we'll just have four numbers. Negative one, let's see, negative three, I'm just making these up
randomly, negative five and one. This is a four-dimensional vector, and we could view it
as being a weighted sum of the unit vectors in
the different dimensions of four-dimensional space. I guess you could say it. You could say that this
is the same thing as, actually let me color code a little bit. This would be equal to
negative one times the one, zero, zero, zero vector
plus negative three, plus negative three times the
zero, one, zero, zero vector plus negative five, plus
negative five times the zero, zero, one, zero vector. I think you see where this is going. And then last but not least, plus one times the zero,
zero, zero, one vector. Now when I write it this way, you might immediately start realizing, "Oh I think I know how to
do transformations here." For example, if I were to give
you the transformation matrix and this would be a transformation matrix for four dimensions. This is gonna be a four-by-four matrix. So I'm gonna write some
random numbers here. One, zero, negative three,
negative one, two, zero, negative three, one, three,
two, zero, two, three, negative one, zero and three. So my question to you is,
what would be the mapping of this four-dimensional
vector if we were to apply this transformation to
four-dimensional space? What would be the result? Pause this video and think about it. Well, it's completely
analogous to what we did in the two-by-two world
in two-dimensional space. We thought about, all
right, instead of the one, zero, zero, zero vector, we're
now going to use this vector. Instead of the zero,
one, zero, zero vector, we're now going to use this vector. Instead of this one in
that blue-green color, we're now going to use this one. And last but not least instead of that, I guess we could say
same in colored vector, we're now going to be using this one. So another way to think about it is, the mapping of this vector,
let me write it this way. Let me make a little line here so we can separate things a little bit but we could write, all
right, a little bit smaller, hopefully you can see this. So this is our original
vector, negative five, one, but we wanna do the prime. What does it get mapped to
under this transformation? Well, this is going to be negative one, instead of this unit
vector right over here, it's gonna be negative one
of this one right over here. So it's negative one times
all of this business, one, two, three, and three. And then we could have just
instead of plus negative three I can just write in minus three
times all of this business, zero, zero, two, negative one. And then we have minus five
times all of this business, negative three, negative three and then we get zero, zero, and then, that definitely gets a little
bit more work involved, the more dimensions we have,
plus one times this business. So plus one times negative
one, one, two, three. And so what's this going to be equal to? So actually this could be a
good time to pause the video too and have a go at it. All right, so this is
going to be this first one, I just make all of these negatives. So negative one, negative
two, negative three, negative three, and to
that, I'm going to add, let's see if I multiply all
of those times negative three, I'm going to get zero, zero, negative six and positive three. And then if I multiply all
of these times negative five, I am going to get 15, 15, zero and zero. And then if I multiply
all of these times one, well, I just get those things again. So that's going to be negative
one, one, two, and three and we are in the home stretch. So now we can just add everything together the corresponding terms. And so this is going to
be negative one plus zero, plus 15, plus negative one. So that's gonna be the
same thing as 15 minus two which is going to be 13, then negative two plus
zero, plus 15, plus one, so that's gonna be 16
minus two which is 14, then we have negative
three plus negative six which is negative nine and
then we add two to that, so that is negative seven. And then negative three
plus three is zero, plus zero is zero, plus three
is three, and we are done. We have found the mapping of
this four-dimensional vector based on a four-by-four
transformation matrix. Very cool.