0:01

We have said before that the columns of a transformation matrix,

Â are the axes of the new basis vectors of the mapping in my coordinate system.

Â We're now going to spend a little while looking at how to transform

Â a vector from one set of basis vectors to another.

Â Let's now have two new basis vectors that describe the world of Panda Bear here,

Â and Panda's world is orange.

Â So Panda has got first a basis vector there,

Â and then another basis vector there say.

Â And let's say in my world,

Â Panda Bear's basis vectors are at

Â three, one and at one, one.

Â And my basis vectors here are e2 hat equals nought, one.

Â and and e1 hat is equal to one, nought.

Â So those are my basis vectors and the orange ones are Panda's basis vectors.

Â Now, and so Panda's basis vectors,

Â the first one for Panda, is his one, zero,

Â and the second one is zero, one

Â in Panda's world.

Â So Bear's basis vectors are

Â three, one and one, one in my blue frame.

Â That is, I can write down Bear's transformation matrix as three, one, one, one.

Â Now, let's take some vector I want to transform.

Â Let's say that vector is in Bear's world,

Â is the vector a half of three,one

Â in Bear's world.

Â So it's three over two, one over two.

Â So the instruction there is do three over two have of three,one

Â and then do one over two a half of one,one

Â in my frame if you like.

Â So in my world,

Â that's going to give me the answer of three times three over two,

Â plus one times one over two is nine, ten halves,

Â which is five, and one times three over two,

Â plus one times a half,

Â so that's a total of two.

Â So that's the vector five, two

Â in my world, five, two.

Â Those two are the same thing.

Â So this is Bear's vector,

Â and this is my vector.

Â So this transformation matrix here are

Â Bear's basis in my coordinates,

Â in my coordinate system.

Â So that transforms Bear's vectors into my world,

Â which is a bit of a problem.

Â Usually, I'd want to translate my world into Bear's world.

Â So we need to figure out how to go the way.

Â So my next question is,

Â how do I perform that reverse process?

Â Well, it's going to involve the inverse.

Â So if I call Bear's transformation matrix B,

Â I'm going to want B inverse,

Â B to the minus one.

Â And the inverse of this matrix well,

Â it's actually pretty easy.

Â We can write down the inverse of that matrix pretty easily.

Â It's going to be a half of one, three,

Â flip the elements of the leading diagonal and put a minus on the off diagonal terms.

Â And we can see the determinant of that's three minus one over two.

Â So we divide by the determinant, that's a half.

Â So that's going to be B to the minus one.

Â And that's my basis vectors in Bear's coordinates.

Â So that's my basis in

Â Bear's world.

Â So my one, zero is going to be a half of one minus one in Bear's system,

Â and my zero, one is going to be a half of minus one, three

Â in Bear's system.

Â And we can verify that this is true if we take this guy,

Â a half one minus one,

Â and compose it with Bear's vectors,

Â we've got one plus minus one of those is going

Â give me three plus one is three minus one is two,

Â one minus one is zero, so that's two, zero halve it, gives you one zero.

Â So that really does work.

Â If I take a half one minus one of Bear's vectors,

Â I'll get my unit vector.

Â Okay. So that really does do the reverse thing.

Â So then if I take my vector, which was five, two,

Â and then I do that sum,

Â I should get the world in Bear's basis.

Â So I've got five times a half minus a half using that guy,

Â plus two times minus one, three

Â and that will give me a half of three, two

Â when I multiply all out.

Â And if I do the same thing here I got five times one,

Â minus one times two gives me three over two,

Â gives me three over two,

Â it all works out if you do it that way,

Â or if you do it that way, you'll still get that answer.

Â So that's Bear's vector again,

Â which is the vector we started out with.

Â So that's how you do the reverse process.

Â If you want to take Bear's vector into my world,

Â you need Bear's basis in my coordinate frame,

Â and if you want to do the reverse process,

Â you want my basis in Bear's co-ordinate frame.

Â That's probably quite counter-intuitive.

Â So let's try another example where this time

Â Bear's world is going to be an orthonormal basis vector set.

Â So here's our basis vectors one, zero, zero, one

Â in my world in blue,

Â and Bear's world is in orange,

Â Bear's world has one, one times,

Â and I've made a unit length so it's one over root two,

Â a minus one, one again,

Â unit lengths of one over root two, so there are those two.

Â And those you could do a dot product to

Â verify that those two are at 90 degrees to each other,

Â and they're Bear's vectors

Â one, zero and zero, one.

Â So then I can write down Bear's transformation matrix that transforms a vector of Bear's.

Â Now, if I've got the vector in Bear's world, this two, one,

Â then I can write that down,

Â and I will therefore get the vector in my world.

Â So when I multiply that out,

Â what I get is I'll get one over root two,

Â times two minus one, which is one,

Â and then one times two,

Â plus one times one, gives me three.

Â So in my world of vector is as I've written down,

Â one over root two times one, three.

Â So if I want to do the reverse transformation,

Â I need B to the minus one,

Â B to the minus ones is actually quite easy because this is an orthonormal basis.

Â The determinant of this matrix is one,

Â so it all becomes quite easy.

Â So I just get one over root two, keep the leading terms the same,

Â flip the sign of the off diagonal terms because

Â it's a two by two matrix, that's really simple.

Â And if you go and put that in, if you say,

Â if I take one over root two times one minus one,

Â so I take one of those plus one of those,

Â multiply by root two, I do in fact,

Â get one, zero and the same for zero, one

Â it all works.

Â So then if I take the vector in my world,

Â which is one, three,

Â I multiply it out,

Â then what I get is the vector in Bear's world.

Â So that's one plus three, which is four, one,

Â minus one plus three is two,

Â and I've got one over root two times one over root two, so that's a half.

Â So in Bear's world, this vector is two,one

Â which is what we actually said so it really works.

Â Now, this was all prep really for the fun part, which is,

Â we said before in the vectors module that we could do this just by using projections,

Â if the new basis vectors were orthogonal, which these are.

Â So let's see how this works with projections.

Â So let's try it with projections.

Â What we said before was that if I take my version of the vector,

Â and dot it with Bear's axis,

Â so the first of Bear's axis is that in my world,

Â then I will get the answer of the vector in Bear's world.

Â So that gives me one over root two, times one over root two,

Â which is a half of one plus three, which is four.

Â So that gives me two.

Â And that's going to be the first component of

Â Bear's vector because it's the first of Bear's axis.

Â And I can do it again with the other of Bear's axes.

Â So that's one over root two, one, three,

Â that's the vector in my world with the other of Bear's axis,

Â which is one over root two, times minus one, one.

Â And when I do that dot product,

Â what I'll get of one over root two is we'll multiply to give me a half again,

Â and I've got one times minus one,

Â plus three times one,

Â is a total of two,

Â which is one, and that's Bear's vector notice two, one.

Â So I've used projections here to translate

Â my vector to Bear's vector just using the dot product.

Â Now remember, with the vector product,

Â what I'd have to do is I'd have to remember to

Â normalize when I did the multiplication by Bear's vectors,

Â I'd have to normalize by their lengths.

Â But in this case, their lengths are all one.

Â So it's actually really easy.

Â So we don't have to do the complicated matrix maths,

Â we can just use the dot product if Bear's vectors are orthogonal.

Â Now, there is one last thing.

Â If you try this with the example we did before with Bear's vectors of

Â three, one and one, one.

Â So before we had those being Bear's vectors.

Â If you try the dot product with those because

Â they're not orthogonal to each other, it won't work.

Â Give it a go for yourself and verify that that it really won't work,

Â that they need to be orthogonal for this to work.

Â If you have them not being orthogonal,

Â you can still do it with the matrix transformation,

Â you just can't do it with a dot product.

Â