# Homework Help: Prove the law of cosines.

1. Nov 3, 2011

### smerhej

1. The problem statement, all variables and given/known data

Prove the law of cosines: If v and w are vectors in R^2, then

|v-w|^2 = |v|^2 + |w|^2 - 2|v||w|cosθ

where θ is the angle between v and w.

2. Relevant equations/info

|x| refers to length, and not absolute value (If that doesn't make any sense then I must be wrong, but our prof. insisted on only using single lines to define a value as 'length', which can be confusing at times).

3. The attempt at a solution

I got blindsided by this question (missed the lecture..). Even just a starting point, or even an online resource would be greatly appreciated, and to go as far fully providing me with the solution would be extremely helpful (but I suppose possibly detrimental).

Also, the rest of the assignment deals with orthogonal projections, and cross products, as well as distances from points to planes, and lines - do these sort of questions involve the usage of the above law?

2. Nov 3, 2011

### mtayab1994

Do you mean you want to prove the following:

3. Nov 3, 2011

### CompuChip

Assuming you know the explicit form of the dot product ($\vec a \cdot \vec b = |\vec a| |\vec b| \cos\theta$ with $\theta$ the angle between them) you can just write it out using the properties of the dot product:
$$|v - w|^2 = (v - w) \cdot (v - w) = \cdots$$

4. Nov 4, 2011

### smerhej

Alright,

So I get:

v2 - 2vw +w2 = v2 + w2 - 2vwcosθ

Then:

-2vw = -2vwcosθ

so for that to be true cosθ needs to equal 1, meaning theta is 0.

..now what?

5. Nov 4, 2011

### CompuChip

Sorry, what?
Where is the left hand side coming from?
And what does "2vwcosθ" mean? v and w are vectors, vw is not a valid product.
Please try to be a bit more precise in your notation, it is important here!

6. Nov 4, 2011

### smerhej

Right sorry,

So doing the dot product of the LHS gives us:

|v|2 + |w|2

Then, we substract the lengths |v|2 + |w|2 of the RHS from the lengths |v|2 + |w|2 of the LHS , which leaves

0 = 2 |v| |w| cosθ

I'm still confused as to where this is going. I really am sorry for being so clueless on this matter.

7. Nov 4, 2011

### smerhej

Hold on.. If 0 = 2 |v| |w| cos (theta) then that means cos of theta has to equal 0 (so cos of 2 over pi) meaning the angle is 90 degrees, meaning the two vectors are perpendicular.

Right?

8. Nov 4, 2011

### CompuChip

Yes, I think you are missing my point.
The equality I wrote,
$$|v - w|^2 = (v - w) \cdot (v - w),$$
is the definition of |v - w|, because the length of a vector is the square of the dot product with itself.
You can then work out the dot product, but note that wherever you get v . v, you don't really get v2, but you get |v|2 (again, by the same definition).

9. Nov 4, 2011

### CompuChip

Yep, and two arbitrary vectors aren't perpendicular, in general.
So there's a big clue something went wrong :-)

10. Nov 4, 2011

### smerhej

Alright, so let me try again.

|v-w|2 = |v|2 + |w|2 - 2|v||w|cosθ

so,

2|v||w|cosθ = |v|2 + |w|2 - |v-w|2

" " = |v|2 + |w|2 - (|v|2 + |w|2 -2(v)(w))

" " = 2(v)(w)

|v||w|cosθ = (v)(w)

Yes? But is that saying that the dot product between v and w is equal to length of v times length of w times the cosinus of the angle between them? Does that make sense?..

11. Nov 4, 2011

### vantz

S=A + B
S2=(A+B)2
S.S=(A+B).(A+B)
... etc

12. Nov 5, 2011

### Ray Vickson

Yes. That is how it is sometimes defined.

RGV

13. Nov 5, 2011

### CompuChip

q.e.d.

14. Nov 5, 2011

### smerhej

I can't tell if you just insulted me or told me that I finally arrived at the appropriate answer.. Either way thanks for all your help (everyone)!

15. Nov 6, 2011

### CompuChip

Nope, it was not meant as an insult.
I was just reminding you that what you've written there is what you told us in your first post is the thing you want to prove.

The conclusion is usually taken as the definition of the inner product, as Ray pointed out. So in a sense, you'd have to read your post backwards.

Am I correct in sensing that you are a bit confused about what the definitions are here, and what you want to prove, and how to write that down?

16. Nov 6, 2011

### smerhej

Yes, very much so. :\