Now, let's look at some special types of matrices that do

simple things and then we'll think about how to combine them to do complicated things.

First, let's think about a matrix that doesn't change anything.

A matrix is just composed of the basis vectors of the space,

so 1, 0, 0, 1.

So that, if I multiply by some vector x y,

that's not going to change x y.

If I multiply it out, I'm getting at one times x,

plus zero times y, zero times x plus one times y, x y.

So it doesn't change the vector x y.

The- is just composed of the basis vectors here,

and it doesn't change them.

And that's called therefore, the "Identity Matrix".

It's the matrix that does nothing and leaves everything preserved. And it's called "I".

Now, what if I have different numbers along the leading diagonal?

Something like 3, 0,

0, 2 for instance.

Well, that's going to scale the x axis here by a factor of three,

it's going to go to 3, 0,

when I multiply it out,

and the y axis is going to scale by a multiple of two.

It's going to go from 0, 1 to 0, 2.

So I've scaled space this way by a factor of three,

and that way, by a factor of two.

So my little unit square has gone to being a rectangle.

From being a square originally,

it's scaled up this way,

three times, and this way, two times.

And of course, if the scale factor here was a fraction,

if it was a third or something,

then other squished space that way.

Instead, I'd have gone that way and made it thinner and taller, something like that.

So fraction then, squishes space.

The next thing to think about is,

what happens if I've got a matrix where I scale by say,

minus one here of one of the axis.

Well, what that is going to do,

to the original axis, is

it's going to flip them around.

So if I've got 1, 0 here,

and 0, 1 being the other axis of course, then,

that's going to scale the first one

over here to being -1,0, and of the 0,2

is going to scale the other axis up to a 0,2 here.

So, my original little cube,

goes from here to here.

So, it's changed in area by a factor of two,

one times two but it's also flipped over.

The x axis has gone over there.

Now, what does that mean?

Well, if I had previously an axis system where I

went using my right hand from my right hand there, that's my first one,

that's my second axis around,

and I went anti-clockwise,

now, I'm going the other way.

Now, I've got a left-handed coordinate system,

and I go clockwise.

So I need to get my left hand out to describe them now.

So I've changed the sense of the coordinate system and flipping it over.

Now, the other matrix we need to think about, get another pen,

is -1, 0, 0, -1

and that inverts everything.

It inverts both axis,

it takes 1,0 to -1,0,

and it takes 0,1 down here to 0,-1.

So it flips everything in both coordinates,

and that's called an "Inversion".

Another matrix I can think of is

0,1,1,0. That's kind of fun.

What that does is it takes i hat 1,0 here

it takes it to 0,1

so it takes it to there.

0,1 that guy goes there,

and it takes the other axis, which was there.

It was also 0,1,

and it takes it to 1,0.

So, what it does is it flips them around.

It's like I put a mirror in at 45 degrees.

I could have another mirror, which would be 0,-1,-1,0.

And that would take 1,0 here and it would make it 0,-1,

take it down there, 0,-1,

and it would take this axis,

0,1 and it would make it to -1,0.

So make it over there.

So that's like having a mirror plane in there.

Just for completeness, I can think of another two mirrors,

and they would be -1,0,0,1

and that flips the x axis.

That's like a vertical mirror, that's that guy.

And I can have another one,

which would be

1,0,0,-1.

And that flips the horizontal axis.

That flips this guy down but leaves this guy unchanged.

So those are all my mirrors.

Another thing I want to think about are shears,

say I wanted to keep e1 hat where it was,

at 1,0 but move e2 hat over.

So e2 hat is 0,1.

So I want to move e2 hat over to here say.

So I want to get e2 to primed to be equal to 1,1 say.

Now, in which case I just write down my matrix, right?

So I now can say that e1 becomes itself,

1,0 and e2 becomes 1,1.

That would be the transformation matrix for that shear.

It would be shearing the unit square over from being

a little square to being a little parallelogram here, something like that.

Of course, I could shear the x axis as well.

I could do some combination of shears,

but that is basically how a shear would look.

Now, the last sort of shape change I can do after stretches,

inversion, mirrors, and shears is a rotation.

If I take e1 hat again, and e2 hat.

If I rotate them round,

well, e1 hat is going to go round here.

So, e1 primed is going to be equal to 0,1.

And e2 hat is going to go round to here,

and e2 primed is going to become -1,0.

So, that 90 degree rotation there is going to

have the transformation matrix 0,1,-1,0.

And in general, I can write down the rotation by an angle here,

let's say an angle here of theta.

I can write that down as being

cos theta, sine theta, sine theta, cos theta.

And I need to put a minus sign in here where positive theta are actually that way.

So we did a rotation by minus 90,

so sine of minus 90 is minus one.

And that's a general expression for a rotation in 2D.

If I wanted to do it in 3D,

I need to think about the axis I was doing it along or around,

so far as rotating about z,

I would preserve all of the z's for a 3D rotation something like that.

This isn't really a course about matrix rotations and matrix geometry, and so on,

that would be something like crystallography of this course about data science.

So we don't need to think too much about rotations, but it is interesting.

If we need to do things like transform faces if we wanted to do facial recognition,

we'll want to do these sorts of stretches of mirrors and shears and rotations to faces.

To get them all facing like that, rather than facing like this,

or sort of some funny angle that we had from our camera that was looking at somebody.

So we do need to do this in data science on occasion, and that's rotations.

So what we've described in this video is we've described

all the possible sort of changes we can do with a matrix.

So now, we need to think about how we do a rotation and then a stretch.

And that's the next little part.