Here is a slightly tougher problem. Suppose you are asked to actually prove the formula; cosine theta equals u.v over the magnitude of u times the magnitude of v. This is the formula for finding the angle theta, between two vectors, u and v. I draw a picture; here’s is vector u, here’s vector v and angle theta. And I’ve drawn a third vector w, that goes from the point of v to the point of u.
Let me start by defining some components. I’ll call u, <u1,u2>. And v will be <v1,v2>. Let’s also observe that v plus w equals u. They are head to tail, so u equals v plus w and that means that I can solve for w by subtracting v from both sides. So w equals u minus v, let me write this way, w equals u minus v, and we’ll use that.
The first thing I want to do is write an expression for the magnitude of w². That’s the same as the magnitude of u minus v². U minus v is going to have components, . Let me write that.
Normally when you’re taking the magnitude you get the squared root of the sum of squares of the two components. We want the magnitude squared. I just want the sum of the squares of the two components. This squared; u1 minus v1², plus this squared, u2 minus v2². I have two binomials. I can expand this. I get u1² minus 2u1v1 plus v1² plus, now this guy, u2² minus 2u2v2 plus v2².
Let me collect like terms together. The u1's and u2's I’m going to collect together first. So I have u1² plus u2². That takes care of these guys. Let me get the v's together. Plus v1² plus v2². And finally the -2 terms. I’m going to pull the -2 out of them and that will leave u1v1 plus u2v2.
Let’s take a look at what we’ve got; u1² plus u2², is exactly the magnitude of u², plus v1² plus v2² is exactly the magnitude of v². Minus 2 times, and this is u.v. What I have here is that the magnitude of w² can be written this way. Let me put a little number 1 next to that.
What I want to do is come up with another expression for the magnitude of w² using the law of cosines. Just one trip back here again, let’s take a look at the triangle here. We can use the law of cosines because what we’re solving for, is the length of this opposite side. We have the length of this vector is this magnitude. I want to find the length squared and that’s going to be one side squared plus the other side squared minus 2 times the product times the cosine of the angle between. That’s the law of cosines. Let me do that.
Magnitude of w² equals magnitude of u² plus the magnitude of v². These are the two sides, minus 2 times the product, times the cosine of the angle between them. This is going to be my equation 2.
Compare this to this. I have two things that equal the magnitude of w². I can just set them equal to each other and here is what I get. This guy, magnitude of u² plus magnitude of v² minus 2 magnitude of u, magnitude of v, cosine theta equals, this guy; Magnitude of u² plus magnitude of v² minus 2u.v. A lot of things cancel which is a relief. u² cancels, v² cancels, even the -2 coefficient cancels. What you’re left with is u.v equals the magnitude of u times the magnitude of v cosine theta. Let me write that down.
The last step is just divide. This is just a number so I can divide it out. Cosine theta equals u.v over the magnitude of u times the magnitude of v. That’s a tough proof but you’re going to be proud of yourself if you made it through all the way.