So, we've looked at the two main vector operations of addition and scaling by a number.

And those are all the things we really need to be able to

do to define what we mean by a vector,

the mathematical properties a vector has.

Now, we can move on to define two things: the length of a vector,

also called its size,

and the dot product of a vector,

also called its inner, scalar or projection product.

The dot product is a huge and amazing concept

in linear algebra with huge numbers of implications,

and we'll only be able to touch on a few parts of it here, but enjoy.

It's one of the most beautiful parts of linear algebra.

So, when we define the vector initially, this guy,

r, we did it without reference to any coordinate system.

In fact, it's the geometric object,

this thing just has two properties: it's length here and its direction,

which is going this way as opposed to this way or this way.

So, irrespective of the coordinate system we decided to use,

we want to know how to calculate

those two properties: its length and the direction it's going.

Now, if the coordinate system that we used to define r,

used these two vectors, r and j,

we can say that r is equal to ai plus bj,

or is equal to a,b,

the way we were writing it in the last video.

Now, if we want to know the length of r,

well, we can draw a triangle, right? And then we can use Pythogoras' theorem.

So, we've got ai's going along this way,

and we've got bj's going along this way.

And if i and j are both of unit length that the length of those is just

a here and b here where these vertical lines on either side means the size.

So then, we can use Pythagoras' theorem just for

a triangle where we've got a there, b there.

This length then from Pythagoras' theorem will

be the square root of a squared plus b squared.

And we can say that that's equal to the length of r,

it's the square root of a squared plus b squared.

So, the length of, r is equal to a,b. So, r is that.

And the length of r, we defined to be equal to

the square root of a squared plus b squared.

Now, we've done this for two spatial directions defined by the unit vectors,

i and j, and those are at right angles to each other.

But this definition of the size of a vector is more general than that.

It doesn't matter if the different components of the vector are

dimensions in space or even things with

different, physical units like bedrooms or bathrooms or length and time and price,

we still define the size of a vector through

the sums of the squares of its components, all square rooted.

The next thing we're going to do is define the dot product which is one way,

one way of several,

of multiplying two vectors together.

So, we've got two vectors here,

r and s. I'm going to make this a bit more general, actually.

I'm going to give them components. So, I'm going to call it r_i, r_j.

So, r has a component i,

in this case, 3, and a component j, in this case, 2

in the j directions and the i directions, respectively.

And s, we could do the same thing.

We could say s has components s_i and s_j.

So then, we define the dot product,

and the product is just a number, like 3.

It doesn't have any associated spatial dimension or direction along the vectors i and j.

We'll define the dot product r dot s, to be equal to,

what happens if I multiply r_i by s_i,

and add it

to r_j times s_j.

So, in this case, that gives me,

in this case it gives me three there times minus one,

plus two times two.

So, that gives me three plus four - sorry, minus three plus four, which is equal to one.

So, the dot product of r dot s,

in this case, is minus three plus four, which is one.

Now, we can go on to look at one property of

the dot product which is that it's commutative.

So, commutative which is spelled commutative.

And that means that r dot s

is equal to s dot r. It doesn't matter which way around we do it.

And we can see that fairly simply because if we just switch that around,

we'd have s_i times r_i,

plus s_j times r_j,

and that's going to be the same number.

So, we can see immediately,

fairly trivially, that the dot product is commutative.

It doesn't matter which order we do it in.

The second property we're going to prove is

the dot product is distributive over addition.

So, if I have some third vector,

let's take some third vector, t,

what being distributive means is

that r dot s plus t is the same as r dot s plus r dot t. That is,

we can multiply out this bracket in the way that we would if they were just numbers.

And we're going to prove this in the general case for any dimension vectors.

So, we'll have a vector r is equal to the components r_1,

r_2, for i's and j's,

all way up to some dimension r_n.

And s is some other vector, s_1,

s_2, all the way up to some s _n.

And t is another one which is equal to t_1,

t_2, all the way up to some component t_n.

And then, r dot s plus t

is going to be equal to r_1 times s_1 plus t_1,

plus r_2, for the second dimension,

times s_2 plus t_2,

plus all the other dimensions,

plus r_n times s_n plus t_n,

if I multiply it out for all the dimensions.

And then, I can just multiply out those brackets,

that's going to be r_1 s_1 plus r_1 t_1,

plus, now multiply out this bracket,

r_2 s_2 plus r_2 t_2,

plus, all the dots,

r_n s_n plus r_n t_n.

And if I collect together the rs term,

so I've got r_1 s_1, r_2 s_2, and r_n s_n,

so that's r dot s,

and if I collect all the t terms together,

I've got r dot t. So,

we've demonstrated that this distributive property is in fact true.

So, it's also kind of obvious that if we multiply a vector through by a scalar,

so if we take a times s,

our other fundamental operation was multiplying by a scalar,

and then do the dot product on that,

so we do r dot a s,

then that's going to be equal to a times r dot s. Because if we take this s here,

when we do this, if we multiply s here,

through by a number, a,

we're just going to get the number a come out of all the components.

So, that's going to be if we do it r_i times as_i plus r_j times as_j,

that's the left-hand side,

and that's equal to a times r_i s_i plus r_j s_j.

So, that is, this property is called that it's

associative over scalar multiplication.

Over scalar, that's the number a, multiplication.

So, we've got three properties.

We've got it's associative over scalar multiplication,

the dot product is distributive, and it's commutative.

Now, the last thing we need to do is draw the link

between the dot product and the size of the vector.

This is quite surprising!

If we take r and dot it with itself,

we get r_i times r_i,

plus r_j times r_j,

plus all the other components, whatever they are.

So, that's equal to r_i squared plus r_j squared.

But we said that the size of the vector was the square root of that.

So, r dot r is equal to the size of the vector squared.

So, that is

the size of the vector is just given,

in some senses, by r dotted with itself, which is quite cool.