 In this video, we're going to talk about the arithmetic we can do with vectors. Vectors are mathematical objects Let's just like normal numbers are just like real numbers are they are mathematical objects and we can do arithmetic with a special kind of arithmetic and It's not very difficult to do especially when we take it back to just the geometrical Interpretation really over what a vector is everything just falls out naturally and it's it's really easy to understand At the end we're just going to mention two specific kinds of arithmetic types of Multiplication with vectors and we call those dot products and cross products. So we're not going to go into too much depth I just want you to understand that those two things exist and what the implications are for Vectors that are orthogonal or perpendicular to each other and ones that are parallel to each other So let's look at vector arithmetic So let's then talk about vector arithmetic Now vector arithmetic, we've seen the intuition behind it It is quite simple if you keep in mind What we've seen up till now. I just want to put it on as I said on a bit of Fermi ground So first of all, let's start with something we cannot do. We have a vector here, which is an R2 In R2, and we have a vector which is an R3 that vector in R2 We don't know what a z-component is that can be anything so it's impossible to add it to a vector in R in R3 That's just impossible. So it's got to be component-wise, and they've got to have exactly the same They've got to be in the same space. Otherwise we can't do that Vector addition is as you can see here. There's commutative It doesn't matter in what order if I want to walk some way I can go around the block one way or I can walk around the block the other way And you know these days getting out the house just go by and do some shopping If you live close by your shopping center just to add a bit of spice You can walk try and walk two different ways to the shop Interesting times we live in Of course, if you watch this way in the future, hopefully this is not too bad in memory for you So I have two vectors there and you see the upside down A here in mathematics If you've never seen that symbol before that means for all Just for all So for all while I write it as one word there because I'm used to writing it in Lartic Anyway for all so for all Vectors A and B elements of R in So that's this V short annotation for writing out everything for all vectors for all vectors and I list two generic ones A and B in R in So if it was R2, they both had to be an R2 if it was an R3 They both had to be an R2 We have that the following holds that a plus B equals B plus a doesn't matter which Plus a that doesn't matter which way around I walk whether I walked and remember those two green ones If I walk this way in that way, it's the same as if I walk that way and that way gonna end up in the same spot no problem there and You see the two vectors that I have here I've just named a sub 1 a sub 2 a sub 3 b sub 1 b sub 2 b sub 3 And I just print them both to the screen in the actual fact This is what this function matrix screen was remember I'm passing these as a list object But if I want mathematical or the Wolfram language to print it out nicely to the screen as a column vector I use the function matrix form and I pass that list object to it And there we have it I have my two column vectors and if I add a and B or five B and A We inherit from the properties of into from the properties of real numbers real numbers are Under their binary operation as we call it of addition It's commutative 3 plus 4 equals 4 plus 3 Because we inherit the property from them because they are all real numbers That means the whole vectors commutative and we see there a plus B and B plus a Wolfram language was going to change it around So they look exactly the same In many computer languages, we also have this idea of Boolean logic logic So you see a double equal sign there It just asks the question is the left hand side equal to the right hand side is a plus B equal to B plus a yes It's true, and it's using these ones that I created up there Remember this is a computer variable name creates a little space in my computer memory a little another little Computer variable name little space my memory I add an object to it and in both instances those are list objects that I add to it I'm just asking the question if I add those two list objects to each other Do I get exactly the same thing when I commute them? Yes indeed. We have another thing is associativity and It says for all vectors for all vectors a b and c in the same space a plus B First and then added to see would be the same as adding a to the Addition of the vectors B and C so that associative property is there and again we inherit that element wise We inherit that from the fact that we're dealing with real numbers as far as the elements or components are concerned And I'm just showing you there how to do it I've just added another magic see a vector C there And I show you a plus B and then plus C or then a plus B plus C and we ask are they the same So there's the one printed to the screen There's no semicolon there, so it is going to print to the screen You see the second one and the two are exactly the same so the associative property holds Then there's this idea of an additive identity vector now an additive identity We all know what that is for the real sets is the number zero if I take any real number and I add zero to it I get that same number and that zero is unique There's no other number in the reels that has the same property that when you add it to an arbitrary real number gives you zero There's only one it gives you the same number. I should say it's only that and we do get the same thing in In vectors there exists this up this backwards e means there there exists They exist so they exist as zero subscript in And we put the zero and we put an underline over it because it says a vector. It's not just a single zero and It is an element of our in so if it's our two this is going to be zero zero And if it was our three zero zero zero That's why we put the underline over it and in the subscript n means it had got to have the same number of Components as the space that we in and then this little thing sometimes people write Cologne or ST for such of that for all V elements in that same space It follows that that means it follows that One thing you've got a lover's math notation is this absolutely fantastic how succinct can we write that this is looks absolutely fantastic Whole sentence there just written so beautifully such that the zero vector plus V equals V and That's us it there exists this and now it is unique in some courses that you take you'll have to prove all of this And you'll have to prove that it is unique There's no other vector in that same space with that property. Just as this with zero with the reels But anyway, there exists a zero vector in this in an element of this vector space Such that for all V no matter which one I take in that same space. It implies that zero plus V equals V Why don't I also write the V plus zero equals V? Well, I don't have to because I already showed the commutative property. It is now implied so we don't have to repeat it We're just building Building these properties one on top of each other Later on we're gonna see that this is actually the wrong way to go about it We're actually gonna construct these axioms and then we're going to have this group of elements And we're gonna see if they obey those properties and if they do they are a member of That structure that we create so we're actually creating here what it's called a vector space and vectors are elements they are members I should say of Vectors of this structure this mathematical structure called vector spaces But anyway now we're just listing them as properties and there I go on to show you I have the zero vector there Which I just call oh There and there we go Show you to the screen. It's three zeros and if I add that to anything. I'm just getting that value back So this is additive identity Then quickly talk about scalar vector multiplication. We've already seen that when we talked about unit vectors So if I have a scalar which is now just going to be a simple real number and I multiplied by a vector Yes, I'm doing it element wise In computer science, we'll call that broadcasting and broadcasting the scalar to components in a list and So each one of those are multiplied by that so you can well imagine that if I have a vector and I multiply by a scalar That's my vector. All I'm going to do if I multiply this by three I'm just going to make it three times longer because each component this component becomes three times longer that component becomes three times longer Intuitive sense. I told you if you remember those basics, it really is as simple as that Which means if I Take the norm of this new one and you can see the reasoning there because I can take out that C square as a common denominator And bring it outside so The norm of a constant multiple of a vector is this going to be that constable constant Multiple times the norm of that vector and that should make absolute intuitive sense Which also means I can multiply by negative one and all I do then is I Just change the direction of a vector Because if I have my components there if I just change each component into its negative This is supposed to be x-axis and y-axis by the way That's flat on the screen if I have this vector pointing up towards the right and I multiply each by the negative Each component takes component this becomes a negative the white component just becomes its negative So there we go. I have the two yen. You can see there goes my zero line Right about there right about there whatever This is the vectors pointing in opposite directions the pointing in the v direction and the negative v direction And all I do when I multiply by a scalar Which is negative one I point in exactly the opposite direction That length is still the same the norm stays the same that's always positive because remember I'm adding a bunch of squares So that's always going to be positive Vic that this idea of add of scalar multiples of negative one Allows me to do vector subtraction Because vector subtraction is just the addition of one that points in the other way So v plus negative v intuitively that must be the zero vector no problems there But it also means if I have two vectors here We have vector u and vector v and if I want to say u minus v all I do is I take this v and This vector v and I multiply by the scalar negative one So that I get this idea of u plus the negative v. That's exactly the same thing as u minus v So I'm just going to keep my addition there and just this was all multiplied by negative one And if I do simple addition now, I get zero to negative nine really is quite simple and I just do it there in Using the warframe language there is this arithmetic that we can do with a vector and that is Starting to get a bit special now when we talk about the dot product or the scalar product or the inner product of vectors And that's one of the two ways in which we can multiply vectors We can multiply two vectors. I've created two vectors in our in A and B And I'm going to take their dot product. You're going to see the dot product gives me back a scalar a single value So there we write a dot B. We put that dot in the middle It's also going to be now. It's going to be an element just of our not of our end It's just a real number and what we do is Component wise multiplication. So it's this a one times B one I've got a sub one B sub one and I add to that the next one a sub two B sub two So a sub two B sub two plus all the way to the end a sub in and B sub in a sub in B sub in So that's the dot product or the inner product or the scalar product Whatever name and we can write it very succinctly there. It's just the sum of i equals one to n of a i times B i So I just do it component wise which shows you something else. They better both be in the same space Otherwise, there's going to be some of these elements without without friends and we just can't have that So that's the dot product and fortunately in the warframe language There is a function for that dot and I just pass it a and B and you see we get back That's the exact same thing one other thing about the warframe language. It has a lot of shortcuts So instead of writing dot I can use the shorthand notation. Let's put a full stop between that so a full stop B Behind the scenes it is dot a comma B and behind the scenes. There's obviously even more going on but anyway exactly the same thing as going on and That should tell us something in as much as Look at those two vectors. Let's just draw them quickly on the screen there Let's draw them on the screen. I've got Let's do that So I've got three comma five one two three one two three four five, so it's about up there So there's my one vector And let's draw the other one is negative five I'm going to try and be the same year one two three four five there and three up One two three up. So it's about there What do you note about these two vectors? Well, they are at a right angle to each other They're the right angle to each other if I now do the dot product I'm going to get zero because one doesn't have components in The other one's direction If you can if you can look at it as just these two separate vectors here This one here will have no components in this one's direction and this one has no components in that one's direction and Later on we'll see another equation for doing this and it is going to Involve a cosine and the cosine of 90 degrees or pi over two radians is zero Just a little tidbit there to wait the appetite But if you do the dot product there remember what it is It's component-wise multiplication and then addition so we have three times negative five and we add to that Five and three and that's negative 15 plus 15 and that equals zero So this idea is very easy to find out if two vectors are perpendicular We call it orthogonal in any algebra. Well, they're orthogonal if the dot product is zero That'll hold no matter what space we're talking about. We've just done a flat plane here with R2 And very simple to do the dot products now the vector cross product. That's a very interesting thing It has many applications applications in To get the area of a parallelogram it has an application of course in physics quite a bit Where we have this idea of the cross product of two vectors Now the cross product of two vectors. I'm just going to show you something very quickly here. I Put my ruler on the screen here. I'm just doing this with a ruler on the screen itself So there I have my x y and z My y my x up here is my z if I Have two vectors say this vector here And that vector there you can imagine just think to yourself in the corner of your room You've got two vectors coming out the corner there You can actually make a plane from those two in other words if there were physical metal rods that you put out there You can actually put a sheet of Cardboard or whatever on top of those two lying on top of those two. They define a whole plane and the interesting thing about the cross product of two vectors is the resultant vector is going to be perpendicular to that plane So these two are in the same plane and this one is going to stick out perpendicular to that plane And that's quite interesting. It's going to be orthogonal to the plane made by those additional to those original two vectors and Here we can see get some idea of the cross product of to of two vectors and The way that I'm going to show you is actually a lot simpler I'm going to have two vectors. Let's make them a and b and I'm going to write a sub 1 a sub 2 and a sub 3 I'm going to have a vector B B sub 1 B sub 2 and B sub 3 I'm going to take their cross product and the way that we're going to do that is we're going to incorporate I Hat J hat and K hat and then we're going to write them a sub 1 a sub 2 a sub 3 and Do the same thing B sub 1 B sub 2 B sub 3 and I'm going to take the determinant of that I'm going to take the determinant of this Now you might Wonder what a determinant is and of course we're going to devote a whole section just on the determinants very quickly I'm going to show you how to do it and it's going to make no sense whatsoever But the way to do that would be I'm going to go first in the I hat direction Which means I'm going to close off the column I that I contain So that's this a sub 1 B sub 1 and the row that it contains and I'm going to do this cross multiplication here, so I'm going to say a 2 B 3 minus a 3 B 2 and that is going to go in the I hat direction Then I'm going to have a negative And we'll see later why that is so I'm going for J now, so I'm going to close off The column that Jason and the row that Jason and that leaves me with a 1 B 3 So that's that a 1 and across from is the B 3 minus a 3 B 1 and That's going to be in the J hat direction and then a positive Now I close off the column with a K and the row with a K that leaves me with a 1 B 2 minus a 2 B 1 and that's in the K hat direction and That vector there is going to be perpendicular to a and B So we're not going to do any of the exercises here I just want for now this intuitive understanding that the cross product gives me a vector and cross product gives me a vector and A dot product gives me a scalar and I want you for now to understand that if I take the dot product of two vectors that are perpendicular to each other It's got to be zero and The cross product think about the cross product. What about two? Vectors that are parallel So remember if they the same length in the same direction they the same because I can bring their tails together So that they both the same If you take the two rods in the corner of your room and you bring them out and they write They coincident they lying on top of each other. Can I still form a plane from those two? No, I can't because if I put the cardboard on top of the rod just laid on top Cut somehow so it fits nicely in the corner there. I can swivel it over that rod this way and that way which means I can form Infinitely many planes with those two So if I can do that, how can I find a vector that's perpendicular to that plane if I have no idea of what the plane is? So this gives us an idea that if I have two vectors and the angle between them is zero Then what is that going to mean for the cross product which has to be perpendicular to that? Well, it's going to be zero, isn't it? So Intuitively we have this idea of the dot product how that can help us to determine whether two vectors are perpendicular and the cross product is which is going to help us to determine if Two vectors point in the same direction the angle is zero between them So the very gentle introduction The normal arithmetic is very easy and then this idea of the dot product cross product You know that it exists now, and that's all we have to do now We know that it exists and then this idea of vectors being perpendicular or vectors being parallel