The Law of Cosines is presented as a geometric result that relates the parts of a triangle:

While true, there’s a deeper principle at work.

**The Law of Interactions: The whole is based on the parts and the interaction between them.**

The wording “Law of Cosines” gets you thinking about the mechanics of the formula, not what it means. Part of my learning strategy is rewording ideas into ones that make sense.

The Law of Cosines, after cranking through geometric steps we’re prone to forget, looks like c

^{2}= a^{2}+ b^{2}– 2abcos(C).This is suspiciously like the expansion that if c = (a + b), then c

^{2}= a^{2}+ b^{2}+ 2abThe difference is that 2ab has an extra factor, cos(C), which measures the “actual overlap percentage” (2ab assumes we fully overlap, i.e. where cos(C) = 1).

So, the Law of Cosines is really a generalization of how c

^{2}= (a + b)^{2}expands when components aren’t fully lined up. We’re treating geometric lines as terms in an algebraic expansion.

Contents

## Analogy: The Assistant Chef

Imagine a restaurant with a single chef, Alice. She’s overworked, so Bob is hired as her assistant (sous chef).

Based on Alice’s current performance, and Bob’s performance in his interview, what happens when they work together?

Surely the new result must be their combined effort:

Hah! Office workers everywhere are rolling their eyes. You can’t just assume people contribute identically when they’re put together: there are interactions to account for.

Beyond their individual contributions, the two might slow each other down (*Where’d you put the whisk again?*), or find ways to work together (*I’m peeling carrots anyway, use some of mine.*).

In a system with several parts, start with the individual contributions and then ask if their interaction will:

- Help each other
- Hurt each other
- Ignore each other

The original idea that “Total = Alice + Bob” is more generally expressed as:

## Exploring The Scenario

We need to separate the *list* of participants (Alice, Bob) from the result of their interaction.

Take the numbers 5 and 3. We can write them like so:

- Parts = (5, 3)

and we’re pretty sure they combine to make 8. But is there another way to get that conclusion?

Yes: we multiply. Beyond repeated counting, multiplication shows what happens when the parts of a system interact:

We’ve gone from “parts view”, (5, 3), to “interaction view”, (5 + 3)^{2}. The result of interaction mode says the system would result in 64 if it *did* interact with itself.

One caveat: when going to interaction view, we wrote down (5 + 3)(5 + 3), but we can’t simplify (5 + 3) = 8 on the outset. We’re using addition for bookkeeping until multiplication can combine the parts.

Oh, another caveat: why can we just add the interactions, but not the parts? Great question. The individual parts might be pointing in different dimensions, and don’t line up nicely on the same scale. The interacting parts turn into *area*, which can be combined to the same result no matter the orientation.

(I’ll investigate this concept more in a follow-up. It’s a neat idea that area is a generic, easily combinable quantity but individual paths are not.)

## Generalizing the Principle

Simple setups like (5, 3) are easy to think through, like eyeballing 2x + 3 = 7 and guessing x = 2. But a more complex scenario like x^{2} + 3x = 15 requires a systematic approach.

The Law of Cosines is a systematic approach to working through the parts:

- List the parts
- Get every interaction as area
- Add to find the total contribution
- Convert into the equivalent “single part”

The last step is often implied. Once we’ve merged the jumble of interactions, we want the *single* part that could represent the entire system. Is there a single person (Charlie) whose efforts are identical to that of Alice and Bob working together?

The Law of Cosines gives us a way to find Charlie.

## What’s the Deal with Cosine?

When two parts interact, they can help, hurt, or ignore each other:

- Perfect alignment means they help 100% (5 and 3)
- Perfect mis-alignment means they hurt 100% (5 and -3)
- Partial alignment or mis-alignment means they help or hurt by a percentage
- No alignment means they ignore each other

How do we measure alignment? With cosine.

Using our trig analogy, cosine is the *percentage* an angle moves along the ground.

A 0-degree angle follows the ground perfectly (100%), and moving vertically doesn’t follow it at all (0%). Other angles are a fraction in-between.

If the parts in our system can be written as paths, and we know the angle between them is theta (theta), then we can measure the overlap with cosine. One path acts as the ground, and the other is the path we’re following:

When paths are perfectly aligned, their full strength is used (ab and ba). The interaction factor cos(theta) modifies that strength to show much they *actually* work together.

So, our jumble of interactions becomes:

Phew! And that’s the Law of Cosines: collect every interaction, account for the alignment, and simplify it to a single part. (The formula is usually written without the square root, but usually you want c, not c^{2}.)

Now, why is the Law of Cosines often written with a negative sign? Well, the assumption is that in a typical triangle, a small *internal* angle C means the sides are negatively aligned, while theta (theta) is an *external* look at their alignment:

Similarly, a large internal angle means the sides are positively aligned, and will help each other. Typically, a small angle means you’re moving in the same direction, but this internal/external difference means we reverse the sign.

Personally, I don’t memorize whether there’s a positive or negative sign: I think about whether the parts will help or hurt each other in the scenario, and make the interaction positive or negative. Don’t be a slave to the formula.

## Quick Practice Problem

Let’s say my triangle has side a = 10 and side b = 20. What is side c when the angle between a and b is:

**45 degrees in alignment**

Here, we need the Law of Cosines. a and b are pointing partially in the same direction. We switch to interaction mode to get to a common, combinable unit (area):

- a
^{2}= 100 - b
^{2}= 400 - 2ab = 2 · 10 · 20 = 400, but we need to adjust by the interaction factor. That is cos(45) = .707, so the real interaction factor is 400 · .707 = 282.8

The overall interactions are:

and the equivalent single side (c) is:

**70 degrees in mis-alignment**

Again, we need the Law of Cosines. We can see that the angles fight each other, so the interaction will be negative:

Our intuition says this arrangement should be *smaller* than the previous one (since the sides aren’t working together), and it is.

**Full alignment or mis-alignment**

When our “triangle” has an angle of 0 degrees (or 180), all the parts are lying flat. Here, the parts are in the same dimension, and can be treated as regular numbers:

- Fully aligned: 10 + 20 = 30
- Fully mis-aligned: 10 – 20 = -10 (pointing in direction of B).

The Law of Cosines still works, of course:

- Full alignment: a
^{2}+ b^{2}+ 2abcos(theta) = 100 + 400 + 400cos(0) = 900 and c = √(900) = 30 - Full mis-alignment: a
^{2}+ b^{2}– 2abcos(theta) = 100 + 400 + 400cos(180) = 100 which means c = √(100) = 10 (pointing backwards).

Again, we shouldn’t robotically follow the formula: have a rough idea what the result should be, and think through the calculations. (“The overall interaction is this, so the individual side would that…”).

Thinking of interactions is one interpretation: next time, we’ll see it as the Law of Projections.

Happy math.

## Appendix: Pythagorean Theorem

The Law of Cosines resembles the Pythagorean Theorem, no?

Now you might suspect why. The Pythagorean Theorem is the special case of *zero interaction*, which happens when the sides are at right angles. After all, 90 degree angle is vertical, and has 0% overlap with the ground.

The Law of Cosines becomes:

If we know the parts won’t interact, we can ignore interaction effects. However, the *self-interactions* are still there and must be combined: a^{2} and b^{2} are fine, but the crossover terms ab and ba disappear.

Here’s another version of the Pythagorean Theorem. We can’t combine a and b directly, so combine their interactions and reduce them to a single part:

## Appendix: The Geometric Proof

You might be hankering for a geometric proof. Here’s one from quora, based on a paper by Knuth:

The insight is that we take our original a-b-c triangle and scale it by a (giving the a^{2}-ab-ac triangle) and b (giving the ab-b^{2}-bc triangle). These two triangles build a larger, similar triangle ac-bc-c^{2}, and with some trig, the bottom portion can be shown to equal a^{2} + b^{2} – 2abcos(theta).

While interesting, I don’t like these types of proofs up front. The Law of Cosines is about interactions, not re-arranging triangles. Does this explanation get you thinking about what cosine represents? About when it should be positive, negative, or zero?

## Appendix: Another Way to Remember

Imagine sides A and B are pointing in the same direction along the horizontal number line. This means c = a + b and the Law of Cosines reduces to:

So, for a 180-degree interior angle, we get a regular algebraic statement. This helps me remember, on the fly, when to add vs. subtract. We add 2abcos(theta) when the interior angle is large.

## ADEPT Summary

Concept | Law of Cosines |
---|---|

Analogy | Imagine an assistant chef whose interactions may (or may not) be helpful. |

Diagram | |

Example | Suppose a = 10 and b = 20 in a triangle. If they are aligned 45-degrees, their interaction is a^{2} + b^{2} + 2abcos(45) = 782.8 and the remaining side is √(782.8) = 27.97 units long. |

Plain-English | The Law of Interactions: The whole is based on the parts and the interaction between them. |

Technical | Triangle with internal angle C: c^{2} = a^{2} + b^{2} – 2abcos(C) General interaction: c ^{2} = a^{2} + b^{2} + 2abcos(theta) |

## Leave a Reply

18 Comments on "Intuition For The Law Of Cosines"

now, if your general method really works, put up a proof of heron’s formula based on it.

Hi Susan, that’d be a great follow-up. I think this method probably works best for the Law of Cosines / Pythagorean theorem, but I’d like to see if it can simplify Heron’s formula (which is usually proved with a giant mess of algebra).

hi kalid,

it would be very useful.

well done kalid !”!!

please elobrote ,dot product is vector version of law of cosine ….

I’m still processing this excellent tutorial. I almost got sidetracked–The square root of 900 is 30 :)

Keep up the good work!!

@gulrez: Thanks! Hoping to do a follow-up on just that :).

@pat: Whoops, thanks for the typo! Just fixed.

I never post any comments but i had to do it now. You are awesome. These insights are so valuable. Good job.

Hey, Kalid! I was just wondering how you make the diagrams you place in your lessons. You know, because it’s always better to place your thoughts into pictures than words, and I wanted to make my own!

@cjq: I make the diagrams in PowerPoint, hope that helps!

@kalid the ideas that you have expressed in the post above (and in your geometric interpretation of complex numbers) are beautifully developed to their full potential in “Geometric Algebra”. Geometric algebra unifies geometry and algebra seamlessly and it encompasses complex algebra, quaternions, and many other seemingly disparate algebras. I have every hope that as your effort to elucidate and educate continues you will interestingly draw on the rich tradition of Geometric algebra. Look here for a very brief but accessible introduction “imaginary numbers are not real” http://www.mrao.cam.ac.uk/~clifford/introduction/intro/intro.html

@susan Heron’s formula can be derived without resorting to the cosine law.

Let A be the area of the ∆ with sides a, b and c. Moreover, let h be the perpendicular height to the vertex from base b.

Begin with the well known

A = b*h/2

Now express h in terms of a,b and c.

This can be done by looking at the triangle in terms of the two right angled triangles partitioned by the altitude h.

b = √(a²-h²) + √(c²-h²)

Rearrange this equation to express h in terms of a,b and c and substitute back into the expression for the area. Heron’s result is obtained after identifying

s = (a+b+c)/2

and some algebra.

Hey, the article is simple and just too good. Thanks for this, I won’t be able to remember the formula anymore but everytime I will work out the interactions and understand what’s really going on.

Also looking forward for your follow-up on the difference in combinations of individual paths and whole areas.

ooooh my goodness that was amazing! Now I feel like everything in math must have some sort of logical explanation! It’s amazing that we assumed that the pythagorean theorem was some manifestation of the inherent magical properties of 90 degree angles in triangles, when it turns out that it’s everpresent in all triangles in a slightly different way.

Thank you so much Kalid! I loved this article, and I think it should be everyone’s introduction to the law of cosines!

Thanks Kenny, really glad to hear it clicked :).

I’m not a math person and want you to know how wonderful it is that you’ve put this information together online!

I will never understand how people just accept the language of math. It is arbitrary. Function? That is something attend in fancy dress. How does one approach a math question when there is no easy way to define an appropriate formula? Physics and geometry are understandable in real world terms. D=RT? I can illustrate that formula by throwing my algebra book in the trash. All the words in the formula are commonly used. I’ve been reading for hours and I still don’t see any meaningful definition of sine. I was excited to see your post about sine being a percentage, but I have to admit I began to lose the thread. A reader can usually find a relatable term to better understand an unfamiliar word in about two leaps. Ephemeral? Fleeting. Fleeting? Lasting only a short time. It seems like defining math terms takes one further away from any hope of solving a problem. Sine is a percentage of height, now I understand. Wait. You said there was a dome. Math is in space where there are negative numbers that are actually letters that are not part of any language that I speak or read. Is sine a percentage of my height? Is the floor level? I’m confusing myself. I think it sounded like perspective was involved. How far away was the caveman? Hold on. How is a percentage a curve? How do you just know that the numbers need to be squared? Why aren’t they cubed? Where is the word problem that helps me understand how finding the length of a two dimensional arc has anything to do with potential interactions? How can potential interactions be a static number? Wouldn’t potential outcomes lie on a bell curve? I’m so confused!

I found this site because I thought I might build a little bridge in my garden and wondered what it would look like if it were based on the golden ratio. The Internet informed me that there is such a thing as a golden angle; and now I’m stuck. I have no use for these lopsided triangles that illustrate cosine axr2 to the z or something. If I had a golden lamp I’d wish for an illustrated dictionary of math. In English. Where all the numbers are real and all the words are defined past the point of directing the reader to a similar, meaningless word. Cosine? Oh *obviously* it is the indirect inverse of a function of the degree of the sine. What was sine again? Sorry. Ugh! An hour after defining the terms of my problem I am no closer to a solution than I am to getting that golden lamp. Was this Heron’s problem too?

Q: Find the height/ Sagitta (bisect the symmetrical, obtuse triangle from the obtuse angle to the hypotenuse) using a “chord” length of nine feet and an obtuse angle of 137.508 degrees.

It very intuitive matter .Thanks . Now i am studying trigo and complex numbers ,its all right with the basics but when it comes to advanced concepts i am unable to see it intuitively . If you could suggest few books that take in very detail of the topics ,i would be obliged .

As you work through the explanation at one point theta is defined as the external look at the “misalignment” and at another it is the internal angle. This can be confusing to a new student. Perhaps modifying the angle bnames will help the confused student internalize this explanation more easily.

For triangle /w sides of length a,b,c respectively:

c^2=a^2+b^2-2abcos(a,b),

where cos(a,b) is the cosine of the angle between sides a& b.

Maybe you could try to make a visualization of haversine and the great circle formula used for calculating two points between two sets of coordinates.