If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains ***.kastatic.org** and ***.kasandbox.org** are unblocked.

Main content

Current time:0:00Total duration:25:11

a couple of videos ago we introduced the idea of a length of the length of a vector that equals the length and this was a neat idea because we're used to the the length of things in two or three dimensional space but it becomes very abstract when we get to n dimensions if this has a hundred components at least for me it's hard to visualize a hundred dimension vector but we've actually defined its notion of length and we saw that this is actually a scalar value it's a scalar value it's just a number in this video I want to attempt to define the notion of an angle of an angle between vectors between vectors between vectors as you can see we're building up this mathematics of vectors from the ground up and we can't just say oh I know that an angle is because everything we know about angles and even lengths it just applies to what we associate with two or three dimensional space but the whole study of linear algebra is subtracting these at these ideas into multi dimensional space and I haven't even defined what dimension is yet but I think you understand that idea to some degree already when people talk about one or two or three dimensions so let's let's say that I have some vector let's say I have two vectors vectors a and B vectors a and B they're nonzero and they're members of RN they're members of RN and they're non-zero and I don't have a notion of of their of the angle between them yet but let me let me just draw them out let me just draw them as if I could draw them in two dimensions so that would be vector a right there maybe that's vector B right there and then this vector right there would be the vector a minus B and you can verify that just the way we've learned to add and subtract vectors or you know this is heads to tails so B plus a minus B is of course going to be vector a and that all just works out there to help to help us define this notion of angle let me construct another triangle that's going to look a lot like this one but remember this is just doing this for for our our simple minds to imagine it in two dimensions but these aren't necessarily two-dimensional beasts these could be each these each could have 100 components but let me go make another triangle let me make another triangle that looks something well it should look similar it should be say it looks like that and I'm going to define the size of the triangles to be the lengths of each of these vectors remember the lengths of each of these vectors I don't care how many components they are they're just going to be your numbers so the length of this side right here is just going to be the length of a the length of this side right here it's just going to be the length of vector a minus vector B minus vector B and the length of this side right here is going to be the length of vector B now the first thing we want to make sure is that we can always construct a triangle like that and so what under what circumstances could we not construct a triangle like this well we wouldn't be able to construct a triangle like this if if this side if if B if the magnitude so let me write this down it's kind of a subtle point but I want make this very clear we want to in order to define an angle I want to be comfortable that I can always make this construction and I need to be I need to make sure that let me write reasons why I couldn't reasons reasons why I couldn't make this construction well what if the magnitude of B was greater than or the length of vector B was greater than the length of vector a plus the length of vector a minus B I couldn't in two dimensions I could never draw a triangle like that then because you would have this length Plus this length would be shorter than this thing right here and so you could never construct it and I could do it with all the sides what if this length was larger than one of these two sides or what if that length was larger than one of those two sides I could just never draw a two-dimensional rect a triangle that way so what I'm going to do is I'm going to use the triangle the vector triangle inequality to prove that each of these sides is less than or equal to the sum of the other sides and you know I could let me see I could do the same thing let me make the point clear I could show that you know if a for whatever reason was greater than the other sides plus B then I wouldn't be able to create a triangle and the last one of course is if a minus B for whatever reason was greater than the other two sides I just wouldn't be able to draw a triangle an A plus B so I need to show that for any vectors that are any real vectors nonzero real vectors or members RN that none of these can ever happen I need to prove that none of those can happen so what does triangle inequality tell us the triangle inequality tells us that if I have the sum of two vectors let me if I take the length of the sum of two vectors that that is always going to be less than and these are nonzero vectors this is always going to be less than or equal to the sum of each of their individual lengths this thumb of each of their individual lengths so let's see if we can apply that to this triangle right here so what is the magnitude the the length of a the length of a well I can rewrite vector a what is vector a equal to vector a is equal to vector B plus vector a minus B right this is just I mean I'm just rewriting the vector here I'm just rewriting a here as the sum of the other two vectors nothing fancy there I haven't used the triangle inequality or anything I've just used my definition of vector addition but here now I've if I put little parentheses here now I can apply the triangle inequality I say well you know what this is going to be by the triangle inequality which we proved it's going to be less than or equal to the lengths of each of these vectors vector B plus the length of vector a minus B so we know that a is a the length of a is less than the sum of that one in that one so we don't have to worry about this being our problem we know that that is not true now let's look at at be so is there any way that I can rewrite B is the sum of two other vectors well sure I can write it as the sum of a as the sum of a plus plus let me put it this way if that vector right there is a minus B the the same vector in the reverse direction is going to be the vector B minus a so a plus the vector B minus a that's the same thing as B in it you can see it right here the A's would cancel out and you're just left with a B there now by the by the triangle inequality we know that this is less than or equal to the length of vector a plus the length of vector B minus a now you're saying hey Sal this you're dealing with B minus a this is the length of a minus B and I could leave this two for you to prove it based on our definition of vector lengths but the length of B minus a B minus a is equal to minus one times a minus B and I'll leave it to you to say that look these the these lengths are equal because essentially well I won't I won't I could leave that but I think you can you can take that based on just the the visual depiction of them that they're the exact same vectors just in different directions and I have to be careful with length because it's not just in two dimensions but I think you get the idea and I think you know I'll leave that for you to prove that these lengths are the same thing so we know that B is less than the length of those two things so we don't have to worry about that one right there finally a minus B can we write that the magnitude or the length the length of vector a minus B well I can write that as the length of or I could write that as vector A plus vector minus B right you could say if vector right if we just put a minus B right there and go in other directions we could say - be which would be in that direction plus a would give us our vector a minus B and that's obvi actually I don't even have to go there that's obvious from this I just kind of put the negative in the parenthesis well the triangle inequality and this might seem a little mundane to you but it really shows us that we can always define a regular planar triangle based on these vectors in this way tells us this is less than or equal to the length of our vector a plus the length of minus B and I just said and you could prove it to yourself that this is the same thing as the length of B so we just saw that this is definitely less than those two this is less definite less than those two and that is definitely less than those two so we don't have we none of the reasons that would keep us from constructing a triangle or Vallot so we can always construct a triangle in this way from any arbitrary nonzero vectors in r n we can always construct this now to define an angle let me let me redraw it down here let me redraw the vectors maybe a little bit bigger that's vector a I'll draw it slightly this is vector B and then let me just draw it this way this is the vector right there that is the vector a minus B and we said we're going to define a corresponding regular run-of-the-mill vanilla triangle whose lengths are defined by the lengths of the vectors by the vector length so this is the length of B that's side this is the length of a minus B and then this is the length of a now now that I know that can always construct a triangle like this I can attempt to define or luxury I will define my definition of an angle between two vectors so we know what an angle means in this context this is just a regular run-of-the-mill geometric triangle now my definition of an angle between two vectors I'm going to say so this is what I'm trying to define this is what I'm going to define because these can be these can have arbitrary number of components it's hard to visualize but I'm going to define this angle as the corresponding angle in a regular run-of-the-mill triangle where the sides of the run in the middle triangle are the two vectors and then the opposite side is the subtraction is the length of the difference between the two vectors this is just the definition I'm just saying that these two things I'm defining this the angle between two vectors in RN that could have an arbitrary number of components I'm defining this angle to be the same as this angle the angle between the two sides the two lengths of those vectors in just a regular run-of-the-mill triangle now what can I do with this well we find a relationship between all of these things right here well sure if you remember from your trigonometry class and if you don't we have a I've proved it in their playlist you have the law of cosines law of cosines and I'll do it with an arbitrary triangle right here just because I don't want to confuse you so if this is side a B and C and this is Theta the law of cosines tells us that C squared is equal to a squared plus B squared minus 2a B cosine of theta I always think of it as kind of a more a broader Pythagorean theorem because it doesn't this thing does not have to be a right angle it accounts for all angles if this becomes a right angle then this term disappears and you're just left with the Pythagorean theorem but we've proven this this applies to just regular run-of-the-mill triangles and lucky for us we have a regular run-of-the-mill triangle here so let's let's apply the law of cosines to this triangle right here so we would get if you know in the way I drew it they correspond the length of this side squared so that means the length of a minus B squared the the length of vector a minus vector B that's just the length of that side so I'm just squaring that side it equals it equals the length of vector B squared plus the length of vector a squared - two times the length of I'll just write two times length of vector a times the length of vector B times the cosine of this angle right here times the cosine of that angle and I'm defining this angle between these two vectors to be the same as this angle right there so we know this angle by definition we know that angle right there well we know that the square of our lengths of a vector when we use our vector definition of length that this is just the same thing as the vector dotted with itself so that's a minus B dot a minus B and it's all going to be equal to this whole stuff on the right-hand side but let me simplify the left-hand side of this equation a minus B dot a minus B this is the same thing as a dot a right those two terms minus a dot B minus a dot B and then I have minus B dot a minus B dot a that's those two terms right there and then you have the minus B minus B that's the same thing as a plus B dot B remember this is just a simplification of the left-hand side and I can rewrite this a dot a we know that's just the length of a squared a dot B and B dot a are the same thing so we have two of these so this right here this term right there will simplify to minus two times a dot B and then finally B dot B we know that that's just the length of B squared now I just simplified or maybe I just expanded that's a better word I you can't when you go from a one term here to three terms you can't say you simplified it but I expand to just the left-hand side and so this has to be equal to the right-hand side by the law of cosines so that is equal to that is equal to I almost feel like instead of rewriting it let me just copy and paste it so if I just if I just do what did I just do copy and then edit copy and paste there you go and if that was worth it but maybe I saved a little bit of time so that is equal to that right there and then we can simplify we have a length of a squared here length of a squared there subtract it from both sides length of B squared here length of B squared there subtract it from both sides and then if what what can we do we can get we can Multan divide both sides by -2 because all everything else has disappeared and so that term and that term will both become ones and all we're left with is the vector a dot the vector B and this is interesting because all of a sudden we were getting a relationship between the dot products of two vectors we've kind of gone away from their definition by lengths but that the dot product of two vectors is equal to the product of their lengths is equal to the product of their lengths their vector lengths and they can have an arbitrary number of components times the cosine of the angle between them remember this theta I said this is the same as when you draw this kind of analogous regular triangle but I'm defining the angle between them to be the same as that so I can say that this is the angle between them and obviously the idea of between two vectors it's hard to visualize if you go beyond three dimensions but now we have it at least mathematically defined angle between them so if you give me two vectors we can now using this formula that we proved using the definite this definition up here we can add the calculate the the angle between any two vectors using this right here and just to make it clear what happens when what happens if a is a is a is a and maybe it's not clear from that definition so I'll make it clear here that by definition if a is equal to some scalar multiple of B where C is greater than zero will define will define theta to be equal to zero and if C is less than zero so a is collinear but goes in the exact opposite direction will define theta to be equal to 180 degrees and that's consistent with what we understand about just two-dimensional two-dimensional vectors if they're collinear and kind of the scalar multiples the same that means a look something like that and B looks something like that so you say that's a zero angle and if they go the other way if a looks something like this is the case where a is just going in the other direction from B a goes like that and B goes like that we define the angle between them to be 180 degrees but everything else is pretty well defined by the triangle example I had to make the special case of these because it's not clear you really get a triangle in these cases because then the triangle kind of disappears it flattens out if a and B are on top of each other if they're going in the exact opposite direction so that's why I wanted to make a little bit of a side note a little bit of a side note right there now we can using this definition of the angle between the vectors we can now define the idea of perpendicular vectors so we can now say perpendicular vectors this is another definition perpendicular perpendicular and this won't be earth-shattering but it kind of is because we've generalized this two vectors of that have an arbitrary number of components we're defining perpendicular mean the theta between so perpendicular to vectors a and B are perpendicular and B are perpendicular if the angle between them between them is 90 degrees and we can define that we can take two vectors dot prod them take their dot product figure out their two lengths and then you could figure out their angle between them and if it's 90 degrees you can say that they are perpendicular angles and I want to be very clear here that this is actually not defined for the zero vector right here so this situation this situation right here not defined for the zero vector because if you have the zero vector then this quantity right here is going to be zero and then this quantity right here is going to be zero and there's no clear definition for your angle right if this is zero right here you did is equal to zero times cosine of theta and so if you wanted to solve for theta you'd get cosine of theta is equal to zero over zero which is undefined undefined undefined but what we can do is create a slightly more general word than the word perpendicular so the perpendicular meet you have to have a defined angle to even talk about perpendicular if the angle between two vectors is 90 degrees we're saying by definition those two vectors are perpendicular but what if we made the statement and we can we if you look at them if the angle between two vectors is 90 degrees what does that mean what does that mean so let's say that theta is 90 degrees let me draw a line here let's say that theta is 90 degrees theta is equal to 90 degrees what is that what does this formula tell us it tells us that a dot B is equal to the length of a time's the length of B times cosine of 90 degrees well what's cosine of 90 degrees it's zero you can review your unit circle if that that doesn't make a lot of sense but that is equal to zero so this whole term is going to be equal to zero so if theta is equal to 90 degrees then a dot B is equal to zero and so this is another interesting interesting takeaway if a and B are perpendicular perpendicular then their dot product is going to be equal to zero now if their dot product is equal to zero can we necessarily say that they are perpendicular well what if they're what if what if a or b is is the zero vector right the zero vector let me call Z for zero vector you know I could just draw the you know the what if you know the zero vector dot anything is always going to be equal to zero so does that mean that the zero vector is perpendicular everything well no because the zero vector I said that we have to have the notion of of an angle between things in order to use the word perpendicular so we can't use the zero vector we can't we can't say just because two vectors dot products are equal to zero that they are perpendicular and that's because the zero vector would mess that up because the zero vector is not defined but if we say and we have been saying that a and B are not zero if they are you know non zero vectors non zero then we can say that if a and B are nonzero and their dot product is equal to zero then a and B are perpendicular so now it goes both ways but what if we just have this condition right here what if we just have the condition that a dot B is equal to zero it seems like that's kind of just a simple pure condition and we can write a word for that and these words are often used synonymously but hopefully you understand the distinction now we can say that if the two if two vectors dot product is equal zero we will call them orthogonal orthogonal as I always say spelling is into my my best subject but this is kind of a neat idea this tells us that D well that all perpendicular vectors are orthogonal and it also tells us that the zero vector so zero vector is orthogonal orthogonal to everything else to everything even to itself right the 0 dot 0 vector you still get 0 so by definition its orthogonal so for the first time probably in your mathematical career you're seeing that the words you know every time you first got exposed to the words perpendicular and orthogonal in geometry or maybe in physics or wherever else there were always kind of the same words but now I'm introducing a nice little distinction here and you can kind of you know be a little smart aleck with with teachers oh is it you know it's perpendicular only if the vectors aren't you know if neither of them are zero vector otherwise if their dot product is zero you can only say that they're orthogonal but if they're nonzero you could say that they're orthogonal and perpendicular but anyway I thought that I would introduce this little distinction for you in case you have someone who likes to trip you up with words but it also I think highlight that we are building a mathematics from the ground up and we have to be careful about the words we use and we have to be very precise about our definitions because we're not precise about our definitions and we build up a bunch of mathematics on top of this and do a bunch of proofs one day we might scratch our heads and and reach some type of weird ambiguity and it might have all came out of the fact that we weren't precise enough in defining what some of these terms mean well anyway hopefully you found this useful we can now take the angle or we can now determine the angle between vectors with an arbitrary number of components