Law of Cosines


Both Sine rule and Cosine rule relate the sides of a triangle with its angles. Cosine rule (or Law of Cosines) is

c2=a2+b22abcosγ, c^2 = a^2 + b^2 - 2ab \cos \gamma,

which can also be rewritten as

cosγ=a2+b2c22ab. \cos \gamma = \frac {a^2 + b^2 - c^2}{2ab}.


In triangle ABC ABC, we have BAC=π4 \angle BAC = \frac {\pi}{4}, BC=5 BC = \sqrt{5} and AB=3 AB = 3. Determine AC AC.

Applying the cosine rule on BAC \angle BAC, we get that AB2+AC22ABACcosπ4=BC2 AB^2 + AC^2 - 2 AB \cdot AC \cdot \cos \frac {\pi}{4} = BC^2, which gives 0=AC232AC+4=(AC2)(AC22) 0=AC^2 - 3 \sqrt{2} AC + 4 = (AC-\sqrt{2})(AC-2\sqrt{2}). Hence, AC=2 or 22 AC=\sqrt{2} \text{ or } 2\sqrt{2}. _\square

*Note: *This is similar to the 'ambiguous case' of Sine rule, since we have 3sinπ4<5<3 3 \sin \frac {\pi}{4} < \sqrt{5} < 3, which is the condition xsinα<a<c x \sin \alpha < a < c.


Suppose a,b a, b and c c are positive reals such that a2=b2+c2bc a^2 = b^2+c^2 - bc, b2=c2+a2ac b^2 = c^2 + a^2 - ac and c2=a2+b2ab c^2 = a^2 + b^2 - ab. Show that a=b=c a = b = c.

Solution: Since c2=a2+b2ab<a2+b2+2ab=(a+b)2 c^2 = a^2 + b^2 - ab < a^2 + b^2 + 2ab = (a+b)^2, it follows that c<a+b c < a+b and we have similar inequalities for other variables. Hence, the numbers a,b a, b and c c satisfy the triangle inequality, and there exists a triangle ABC ABC such that AB=c,BC=a,CA=b AB=c, BC=a, CA=b. As such cosABC=a2+c2b22ac=a2+c2(a2+c2ac)2ac=12 \cos \angle ABC = \frac {a^2 + c^2 - b^2}{2ac} = \frac {a^2 + c^2 - (a^2+c^2-ac)}{2ac} = \frac {1}{2}, which gives us that ABC=60 \angle ABC = 60^\circ. Similarily, we have BCA=60,CAB=60 \angle BCA = 60^\circ, \angle CAB = 60^\circ, which show that triangle ABC ABC is equilaterial, thus a=b=c a=b=c. _\square

Note: This may also be done directly by summing up the 3 equations to get that (ab)2+(bc)2+(ca)2=0 (a-b)^2 + (b-c)^2 + (c-a)^2 =0.

Application and Extensions

Assuming the Cosine Rule, prove the Pythagorean theorem.

In right triangle ABC ABC with ACB=90 \angle ACB = 90^\circ, we have cosABC=a2+b2c22ab \cos \angle ABC = \frac {a^2+b^2-c^2}{2ab}, hence a2+b2c2=0 a^2+b^2-c^2=0, which gives that a2+b2=c2 a^2 + b^2 = c^2. _\square


[Apollonius' Theorem] In triangle ABC ABC, D D is the midpoint of BC BC. Show that AB2+AC2=2(AD2+BD2) AB^2 + AC^2 = 2(AD^2+BD^2).

Solution: Apply the cosine rule to triangle ABD ABD, we get AB2=AD2+BD22ADBDcosADB AB^2 = AD^2 + BD^2 - 2 AD \cdot BD \cos \angle ADB. Applying the cosine rule to triangle ADC ADC, we get AC2=AD2+CD22ADDCcosADC AC^2 = AD^2 + CD^2 - 2 AD \cdot DC \cos \angle ADC. Since ADB+ADC=180 \angle ADB + \angle ADC = 180^ \circ, so cosADB=cosADC \cos \angle ADB = - \cos \angle ADC. Adding the first 2 equations, and using the fact that BD=CD BD=CD, we get that AB2+AC2=AD2+BD2+AD2+CD2=2(AD2+BD2) AB^2 + AC^2 = AD^2 + BD^2 + AD^2 + CD^2 = 2(AD^2 + BD^2). _\square


(IMO'68) Determine all triangles whose side lengths are consecutive positive integers, and one of the angles is twice of the other.

Solution: In triangle ABC ABC, let BC=n,CA=n+1,AB=n+2 BC=n, CA=n+1, AB = n+2. Let α,β \alpha, \beta and γ \gamma be the angles at vertices A,B A, B and C C, respectively. Then γ>β>α \gamma > \beta > \alpha. Applying the cosine rule, we obtain cosα=(n+1)2+(n+2)2n22(n+1)(n+2)=n2+6n+52(n+1)(n+2)=n+52n+4 \cos \alpha = \frac {(n+1)^2 + (n+2)^2 - n^2}{2(n+1)(n+2)} = \frac {n^2+6n+5}{2(n+1)(n+2)} = \frac {n+5}{2n+4}. In a similar manner, we can obtain cosβ=n+12n \cos \beta = \frac {n+1}{2n} and cosγ=n32n \cos \gamma = \frac {n-3}{2n}. The double angle formula states that cos2θ=2cos2θ1 \cos 2 \theta = 2 \cos ^2 \theta -1. Consider the following cases:

Case 1. γ=2α \gamma = 2 \alpha. Then, n32n=2(n+52n+4)21 \frac {n-3}{2n} = 2 (\frac {n+5}{2n+4})^2 - 1. Clearing denominators and expanding, we get 0=2n3n225n12=(n4)(2n+1)(n+3) 0 = 2n^3 - n^2 - 25n - 12 = (n-4) (2n+1)(n+3). The only positive integer solution is n=4 n=4.

Case 2. γ=2β \gamma = 2 \beta. Then, n32n=2(n+12n)21 \frac {n-3}{2n} = 2 (\frac {n+1}{2n})^2 - 1. Clearing denominators and expanding, we get 0=2n3+n2n=n(2n1)(n+1) 0 = 2n^3 + n^2 - n = n(2n -1)(n+1). This has no positive integer solutions.

Case 3. β=2α \beta = 2 \alpha. Then, n+12n=2(n+52n+4)21 \frac {n+1}{2n} = 2 (\frac {n+5}{2n+4})^2 - 1. Clearing denominators and expanding, we get 0=2n3+3n29n+4=(n1)(2n2+5n4) 0=2n^3 +3n^2-9n+4 = (n-1) (2n^2+5n-4). The only positive integer solution is n=1 n=1. However, checking this triangle, we get the degenerate 123 1-2-3 triangle, hence we ignore this solution.

Thus, the only triangle is the 456 4-5-6 triangle. _\square

Note by Arron Kau
7 years, 3 months ago

No vote yet
1 vote

  Easy Math Editor

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

  • Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
  • Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
  • Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
  • Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link]( link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}


Sort by:

Top Newest

its invalid to prove pythagorean theorem using Law of Cosines. it uses the fact that

sin2θ+cos2θ=1 \sin^2 \theta + \cos^2 \theta = 1

which is in fact a result of pythagorean theorem.

Aneesh Kundu - 7 years ago

Log in to reply

Thanks for sharing! It is really helpful.

However, I would like to know how to make those cool boxes?



Daniel Liu - 7 years, 2 months ago

Log in to reply

The LaTeX\LaTeX code is: \square, and there's also a variant \blacksquare which produces: .\quad \square\quad\blacksquare.

Log in to reply

Really interesting!

Jordi Bosch - 7 years, 1 month ago

Log in to reply


Klaurence Patrick Cruz - 6 years, 3 months ago

Log in to reply


Problem Loading...

Note Loading...

Set Loading...