# When to use the law of cosines?

1. Oct 15, 2015

### student1856

In Griffith's Introduction to electrodynamics, he uses a cursive r as the distance between a charge and a test point. most of the time to find this distance we subtract the two position vectors and find the magnitude, but occasionally we use the law of cosines. Now yes I know we use the law of cosines when the angle is not 90 degrees in statics problems. So I assumed that was the indicator to when to use the law of cosines. However immediately after assuming this, we just subtracted a second set of vectors and found the magnitude of two vectors that didnt make a right triangle. Can someone just very clearly and slowly tell me when to use the law of cosines, and when i can just subtract two vectors and find the magnitude?

2. Oct 15, 2015

### SteamKing

Staff Emeritus
It's not clear what you are talking about here.

If you subtract two position vectors, you're going to wind up with a third vector, not a magnitude.

If you can provide some clear examples of what confuses you, for those of us who may not have a copy of Griffith's, that would be helpful.

3. Oct 15, 2015

### Geofleur

You can always just subtract two vectors and find the magnitude. You can even prove the law of cosines that way. Let $\mathbf{A}$ and $\mathbf{B}$ be vectors. Then $(\mathbf{A}-\mathbf{B})\cdot(\mathbf{A}-\mathbf{B}) = | \mathbf{A} - \mathbf{B} |^2 = A^2 + B^2 - 2AB\cos \theta$, where $\theta$ is the angle between the vectors when they are placed tail-to-tail. From a picture of the triangle formed from $\mathbf{A}$, $\mathbf{B}$, and $\mathbf{A}-\mathbf{B}$, we recognize this equation as none other than the law of cosines.

4. Oct 25, 2015

### mathwonk

of course the fact you are apparently using that A.B = |A||B| cos(theta) is equivalent to the law of cosines.