Transcript for:
Vector Operations Overview

hello everyone today we are going to talk about vectors but before we dive into vectors let's first have a look at coordinate systems in two dimensions a coordinate system consists of a horizontal line which we call the x-axis any vertical line which we call the y-axis we divide these lines by adding ticks on them at a regular distance let's say that distance is 1 in that case we can number each tick according to the distance between them if we now add a point let's call it P anywhere on this coordinate system we can assign it some coordinates based on its position we do that by tracing a line parallel to the y-axis onto the x-axis and a line parallel to the x-axis onto the y-axis this gives us an x coordinate of 5 and a y-coordinate of 3 we notice between parentheses just for fun I'm gonna add a point Q and to calculate its coordinates we do the exact same thing we trace two lines and then we get an x coordinate of negative 4 and a y-coordinate of - do you note that we always write the x coordinate first and then the y coordinate there's also a special point and that is where the x and y axes cross we call that point the origin we often give it the letter O and it's x and y coordinates are 0 all right now we are ready to move on to vectors in contrast two points vectors do not have a position we also don't use a point to represent them but instead use an arrow vectors are defined by their lengths which can become longer or shorter and their direction which is the way in which a point since they don't have a position we can perfectly move the vector somewhere else and it is still the same vector I'm gonna give this vector the letter A and the bar on top of it means that we are talking about a vector to assign X and y components of a vector we calculate how many steps the vector goes left or right and how many steps it goes up or down in this case the vector goes 5 steps to the right positive numbers indicate vital motion and negative numbers indicate level motion the vector goes three steps up and positive numbers indicate upward motion and negative numbers downward motion the vectors components are written between square brackets like so with the X component on top and the y component at the bottom just for fun let's also add an order factor of B to calculate its components we take four steps to the left which gives us negative four and we take two steps up we can then write these components once again between square brackets as I said earlier vectors do not have a position however if we assumed at the tail of a vector is sitting at the origin then we can think of a vector as being a point let's quickly have a word about notation this is a two dimensional vector we write the x and y components between these square brackets for a three dimensional vector we can add a set component and we would also add as it axis which would point outside of the screen we can expand this vector even further by adding a W component now you might be thinking four dimensional vectors wait what well we'll talk about that in the video about matrices there's one last change I'm gonna make here and that is that I'm gonna write these components as the subscript of the vectors name the reason why we do now is to not cause any confusion when we have multiple vectors finally we can generalize this to n dimensional vectors we do that by not using X Y Z and W but just counting the components from 1 up to n where n is the dimension of our vector alright let's now move on to scalar operations scale of operations artists operations between a vector and a number X is the number and it's also called a scalar but more on that later the operation could be a multiplication or a division I'm gonna continue to explain scalar multiplication but scalar division is completely analogous to multiply a vector with a scalar we just multiply every component of that vector with the scalar as an example I'm gonna take a vector a and an x value we can now fill in these values in our equation and calculate the result of a times X to clarify these numbers I'm gonna visualize vector a and the result of its multiplication with X would be a new vector that is three times longer in other words this new vector is scaled by a factor of three and that is why we call X a scalar for completeness if we would have divided by X we would get a vector that is three times shorter there's a special case in which we multiply with an x value of negative one as you can see in this case the vectors components have become the opposite and the vector itself also points in the opposite direction of the original vector to simplify this we just say that the green vector is just negative a now that we know what scale of operations are let's move on to vector operations which are operations between two vectors this could be either an addition or a subtraction I'm going to continue to explain vector addition but once again vector subtraction is completely analogous to calculate the sum of two vectors we just calculate the sum of their X components and some of their Y components as an example I'm going to take two vectors a and B I'll fill in their values in our formula and now we can calculate the sum of a and B that's all great and everything but let's actually draw these vectors and visualize the result of their addition to visualize that I'm gonna move vector B tail to the tip of vector a the result of their addition is then a new vector that starts at the tail of vector a and ends at the tip of vector B for completeness let's also talk about how subtracting vectors would look in that case we would get a vector that goes from the tip of vector B to the tip of vector a now why is this useful as I said earlier we can think of vectors as being points if their tail is sitting at the origin and lucky for us vector a and B stale are sitting at the origin so we can think of them ass points and now we see that we can use vector subtraction to calculate a vector from one point to the other what's even more interesting is that if we calculate the length of this vector we know the distance between these two points talking of length let's actually discuss the length of a vector we also refer to it as the magnitude or norm we represent it by writing these two vertical bars on either side of our vector and in two dimensions the length of a vector is defined by this formula we can extend that to three dimensions and even write a version for the generic n dimensional vector to understand how that formula works we're gonna take our beloved coordinate system and take a random vector in this case vector V then I'm gonna draw a triangle beneath the vector and you notice and I could have perfectly drawn it on top it's just that I like to draw it beneath it this triangle is a right angle triangle the width of that triangle is the vectors X component the height of that triangle is the Vectis y component and then the hypotenuse or tilted side of the triangle is the vectors length at this point we've got a right-angled triangle of which we know the width and the height and we are looking for the length of its hypotenuse and lucky for us there's been a famous mathematician called Pythagoras who came up with a Pythagoras theorem a squared plus B squared equals C squared where am V are the width and height of a right-angled triangle and C is the length of its hypotenuse we can now replace a B and C with our vectors components and vectors lengths we'll swap the left and right side of that equation we'll take the square root of either side of the equation and now we've got our expression for the length of a two-dimensional vector if we fill in the components of that vector in this case we can calculate that this vectors length is equal to five point eight three and a bit concerning a vectors length there is a special case which we call a unit vector it's also referred to as a normalized vector we write such a vector with a hat on top of it and the normalized or unit vector is nothing more a vector we do length of one in fact we can take any arbitrary vector divided by its length and then the result will be a vector that points in the same direction as the original vector but that has a length of 1 we also define a few standard unit vectors being Yi hat X which is a unit vector along the x-axis Yi hat Y which is the unit vector along the y axis and y hat z which is a unit vector along the z axis using these unit vectors we can introduce an alternative way to write vectors and that is to write em as the sum of their components multiplied by the respective unit vector we call this unit vector notation and we'll need it in just a bit but first we're going to discuss two ways in which we can multiply vectors the first one being the dot product also referred to as the scalar product because its result is a scalar we write a dot product of two vectors as a dot B and in two dimensions it is defined using this formula we can extend this formula to three dimensions and just like with the vectors length we can also write a generic version for n-dimensional vectors to understand the dot product I'm gonna draw a vector a and vector B I'll then draw a triangle beneath vector B like so and once again this is a right-angled triangle the dot product of a and B is now equal to the width of this triangle however there is a catch and that is that I'm assuming that vector a is a unit vector to explain this further I'm gonna introduce this alternative formula which says that the dot product of vector a and B is equal to the length of vector a times the length of vector B times the cosine of theta where theta is the angle between vector a and B according to this formula the dot product will get smaller if vector B gets shorter it will get larger if the angle between a and B gets smaller and finally here's the catch I've been assuming that vector a is a unit factor because if it's not then the dot product will also be scaled by a factor a and it will no longer be the width of our triangle to dive a bit deeper into how the dot product changes based on the angle between vector a and B I'm gonna draw vector a and vector B and write our angle next to it if the angle between vector a and B is zero degrees then the cosine of the angle between them which is zero degrees will be equal to one this means that we can simplify our formula in the case that theta is zero degrees because then the dot product of a and B is just the product of their lengths alternatively if the angle between a and B is 90 degrees or if it is 270 degrees then the cosine of that angle will be equal to zero and therefore we can once again simplify our formula for the dot product by saying that if a and B are perpendicular to each other then their dot product will be equal to zero finally if the angle between a and B is 180 degrees then the cosine of that angle is going to be equal to negative 1 and then the dot product of vector a and B is going to be equal to the opposite of the lengths of a and B multiplied we can simplify all these formulas even further if we assume that vector a and B are unit vectors out of this we can conclude that the dot product is equal to 1 if both vectors point in the same direction that it is equal to 0 if both vectors are perpendicular to each other and that it is equal to negative 1 if the vectors are opposite in other words you can think of the dot product as a measurement for how similar two vectors are I'm quickly going to come back to the original formula for our dot product because if we reformulate that a bit then we can write an expression to calculate theta which was of course the angle between vector a and B there's one last thing about dot product I wanted to show you which is that the length of a vector is actually to the square root of the dot product of a vector itself I leave that up to you to figure out why daddy's let's now move on to that other way to multiply two vectors which is the cross-product also referred to as the vector product because the result is a vector we write it as a cross B and it is defined as the determinant of this matrix now we haven't covered matrices yet leave learn how to calculate their determinant so you just have to take from me that that result is equal to this massive formula however if you take a closer look at this you might recognize the unit vector notation which means that we can actually rewrite this formula between our beloved square brackets also notice that the cross product is only defined in three dimensions to visualize what the cross product means I'm gonna once again draw vector a and vector B their cross product is equal to this white vector unlike the dot product the order in which we take the cross product of G vectors actually matters because if you take the cross product of BM a you get a vector that points in the opposite direction so you could therefore say that the cross product of B and a is equal to the opposite of the cross product of a and B the cross product results in a vector that is perpendicular to the original vectors you can visualize this using the right-hand rule if you take your right hand and point your index finger in the direction of vector a your middle finger in the direction of vector B then your thumb will point in direction of their cross product to show some of the properties of the cross product I'm going to introduce this alternative formula that says that the length of the cross product of vector a and B is equal to the length of vector a times the length of vector B times the sine of theta and theta is once again the angle between vector a and B another way to think of the length of the cross product of a and B is to think of it as the area of the parallelogram between vector a and be according to this formula the length of the cross product will become shorter vector a or B gets shorter the cross product will also get shorter if the angle between a and B gets smaller to show why that is I'm gonna draw once again vector a and B and I'm going to display the angle between them if the angle becomes zero degrees then the sine of theta in other words the sine of zero degrees will be equal to zero the same goes for an angle of 180 degrees this means that just like with the dot product we can also simplify this formula by saying that if a and B are parallel to each other denoted with these two vertical bars then the length of the cross product is going to be equal to 0 alternatively if the angle between a and B is 90 degrees or if it is 270 degrees then the sine of theta or the sine of the angle between a and B is going to be equal to one and therefore we can write another expression that says that if a and B are perpendicular to each other then the length of their cross product is going to be equal to the product of the length of a and B once again we can simplify all of these formulas when a and B are unit vectors in conclusion length of the cross product is equal to 0 if two vectors are parallel and equal to 1 if two vectors are perpendicular this means that you could think of the cross product as a measurement of how perpendicular two vectors are this in contrast to the dot product which was a measurement for how parallel two vectors are one last interesting property of the cross product is that if you take the cross product of the vector itself the result is equal to 0 but once again I'll leave that up to you to figure out why that is whew that was it congratulations you made it to the end of this video I really hope you learned something if you enjoyed this series then please consider becoming a patron on patreon comm for its Nash flutie monkey with that being said I'll see you all next time good bye