0:01

So, we have these things called vectors like this guy here.

Â What we want to do first is get an idea of what makes a vector, a vector.

Â What we'll do in this video is explore the operations we can do with vectors,

Â the sort of things that we can do with them that define what they are,

Â and the sort of spaces they can apply to.

Â So, a vector, we can think of as an object that

Â moves us about space like this guy here.

Â This could be a physical space,

Â or a space of data.

Â At school, you probably thought of a vector as something

Â that moved you around a physical space,

Â but in computer and data science,

Â we generalise that idea to think of a vector as

Â maybe just a list of attributes of an object.

Â So, we might think of a house, say,

Â so here's a house,

Â and this might have a number of attributes,

Â we could say it was 120 square metres in floor area,

Â it might have two bedrooms,

Â say, it might have one bathroom,

Â that would be sort of sensible,

Â and it might be worth 150,000 Euros, say.

Â And I could write that down as the vector,

Â 120 square metres, 2 bedrooms,

Â 1 bathroom, and 150,000 Euros.

Â While in physics, we think of this as being a thing that moves us about space,

Â in data science, we think of this vector as

Â being a thing that describes the object of a house.

Â So, we've generalized the idea of moving about space to

Â include the description of the attributes of an object.

Â Now, a vector is just something that are based on two rules.

Â Firstly, addition, and secondly,

Â multiplication by a scalar number.

Â We'll do this first, think of a vector as

Â just a geometric object starting at the origin, so something like this.

Â So we get a vector, r, there.

Â Vector addition is then when we just take another vector,

Â so let's take another vector like this guy here,

Â let's call him, s,

Â and where we put s on the end of r. So then,

Â that's s, and therefore,

Â if we put s on the end of r,

Â we get a sum that's r then going along s. We call that guy r plus s. Now,

Â we could do this the other way round.

Â We could do s and then r,

Â and that would be s plus r. So,

Â you go along s and along that way,

Â and that would be s plus r there. s plus r.

Â And we see that they actually give us the same thing, the same answer.

Â So, r plus s is equal to s plus r,

Â so it doesn't matter which way round we do the addition.

Â So, the other thing we want to be able to do is scalar multiplication,

Â that is to scale vectors by a number.

Â So a number a, say,

Â make it twice as long or half as long, something like that.

Â So we say that, say 3r was doing r three times, that would be 3r there,

Â where a was three, or we could do a half r,

Â which should be something like that.

Â The only tricky bit is what we mean by minus number,

Â and by minus r, we mean going back the other way by a whole r. So,

Â we take r, we go back the other way the same distance,

Â that would be minus r. So,

Â in this framework, minus means going back the other way.

Â At this point, it's convenient to define a coordinate system.

Â So, let's define space by two vectors.

Â First, call the first one that takes us from left to right,

Â and is of unit length, length one.

Â Let's call that a vector, i.

Â We'll have another vector here that goes up-down, a vector j,

Â it's also of unit length, of length one.

Â And then we'd say,

Â just use our vector addition rules,

Â if we wanted a vector r here, something like this,

Â that was 3, 2,

Â by which we mean we go 3i's, 1i, 2i,

Â 2i, and then 2j's.

Â So, we go 3i's plus 2j's and that gives us a vector r

Â here just from our vector sum.

Â And what we mean in the 3, 2 is

Â do 3i's added together,

Â or scalar multiple of 3i's,

Â and then do a scalar multiple of 2j's as a vector sum.

Â And that is what we mean by a coordinate system of defining r as being 3, 2.

Â So then if I have another vector, s,

Â let's say s is equal to -1i's and 2j's, that is,

Â it takes us back 1i and up 2j's, that's s. Then,

Â r plus s would be that,

Â we just put s on the end of r,

Â and then r plus s is going to be therefore that total vector.

Â That's going to be r plus s. And we can just add up the components, right?

Â So, r is 3i's and s takes us back 1.

Â So, it's three plus minus one,

Â this gives us 2i's,

Â and in the j's,

Â r takes us up two and s takes us up another two.

Â So, that's a total of 4j's.

Â So we can just add up the components when we're doing vector addition.

Â So, we can see that because we're doing this component by component,

Â then vector addition must be what's called associative.

Â Formally, what this means is that if we have three vectors,

Â r, s and another one, t,

Â it doesn't matter whether we add r plus s and then add t,

Â or whether we add r to s plus t,

Â it doesn't matter where we put the bracket.

Â We can do this addition and then that one,

Â or we can do this addition and then that one.

Â So, a consequence of it not mattering what order we had,

Â so s plus r is equals to r plus s,

Â we can also see that therefore it doesn't matter what order we do the additions and if

Â we've got three and that's called associativity.

Â That's formally that definition.

Â And vector addition, we can see,

Â when we're adding it up like this, will be associative.

Â So, I've just got rid of the s's and so on.

Â So, we can talk about another issue,

Â which is in a coordinate system,

Â what do we mean by multiplication by a scalar?

Â So, if you want to take a multiplication by a scalar, let's say, 2,

Â then we define this to mean that 2r would be equal to

Â 2 times the components of r. So 2 times 3 for i's,

Â and 2 times 2 for the j's,

Â so we've got 2 there multiply by 2,

Â and that will give us 6, 4.

Â So, 2r will be doing r, and then doing another r,

Â that would be 2r,

Â which should be at the vector 6, 4,

Â going along 3i's, 4, 5,

Â 6i's, and up 4j's.

Â Now, you need to think about another question,

Â which is minus r. So r is this,

Â minus r is then that,

Â which will be -3, -2.

Â So then, we see sort of obviously, kind of, that r,

Â plus minus r is equal to three plus,

Â minus three on the i's, and two plus,

Â minus two on the j's,

Â which is equal to 0, 0.

Â So, if we do r and then add minus r,

Â we end up back at the origin, duh.

Â And therefore, we've defined what we mean by vector subtraction here.

Â Vector subtraction it's just addition of

Â minus one times whatever I'm doing, putting after the minus sign.

Â So, if we think of another vector,

Â s, we had s was -1, 2 before, right?

Â -1i plus 2j's.

Â So then, r minus s would be this.

Â So, that's minus s there is equal to go along one on the i's,

Â and minus two on the j's.

Â So, r minus s, add up the components,

Â let's switch to an addition.

Â So, r minus s is this vector here,

Â that's r minus s. If we add up the components of that,

Â it's 3i's plus 1,

Â three plus one on the i's,

Â and two plus minus two on the j's,

Â so that gives us the vector 4,0.

Â So, if we do r is go along three,

Â and minus s is go along one,

Â we've got a total of four.

Â And if r is go up two,

Â and minus s is go down two,

Â we've ended up going up-down zero in total.

Â So, then we've not only done addition by components,

Â we've done now what we mean by vector subtraction as well,

Â as being addition of

Â a negative one multiple of the thing that we're doing in the minus part.

Â And that's vector subtraction and addition by components.

Â So, let's come back to the house example for a moment.

Â So we said, we had a house, that's my house,

Â that was 120 square metres,

Â two bedrooms, one bathroom, and 150,000 Euros.

Â So, if I put the unit in, that's square metres,

Â that's its number of beds,

Â that's its number baths,

Â and that's its thousands of Euros that it's worth.

Â So, two houses now is equal to, the vector addition of those things is equal to 2,

Â and the way we're defining vector addition times 120, 2, 1,

Â 150, which will be equal to 240, 4, 2, 300.

Â So, we'd say that in the scheme,

Â the way we're defining it,

Â then two houses would be 240 square metres,

Â that would makes sense,

Â four bedrooms, two bathrooms,

Â and worth 300,000 Euros,

Â if I bought two houses identically next to each other.

Â And that would be a scalar multiple or an addition of one house to another.

Â One house plus one house,

Â so we could keep on doing that with three houses,

Â or differently shaped houses,

Â or whatever it was, or negative houses.

Â The way we've defined vectors,

Â that will still apply to these objects of houses.

Â So, that's vectors.

Â We've defined two fundamental operations that vectors satisfy, that is addition,

Â so like r plus s here,

Â a multiplication by a scalar,

Â so like 2r here and minus s here.

Â And we've explored the properties that those

Â imply like associativity of addition and subtraction,

Â what subtraction really means of vectors r plus minus s,

Â being r minus s. And we've noticed that it can be

Â useful to define a coordinate system in which to do our addition and scaling,

Â so like r 3,2 here,

Â using these fundamental basis vectors.

Â These things that define the space, i and j,

Â which we call the basis vectors or the things that define the coordinate system.

Â We've also seen that although, perhaps,

Â it's easiest to think of vector operations geometrically,

Â we don't have to do it in a real space.

Â We could do it with vectors that a

Â data science lists of different types of things like the attributes of a house.

Â So, that's vectors, that's all the fundamental operations.

Â