# Law of Cosines

## Definition

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

$c^2 = a^2 + b^2 - 2ab \cos \gamma,$

which can also be rewritten as

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

## Technique

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

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

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

### Suppose $a, b$ and $c$ are positive reals such that $a^2 = b^2+c^2 - bc$, $b^2 = c^2 + a^2 - ac$ and $c^2 = a^2 + b^2 - ab$. Show that $a = b = c$.

Solution: Since $c^2 = a^2 + b^2 - ab < a^2 + b^2 + 2ab = (a+b)^2$, it follows that $c < a+b$ and we have similar inequalities for other variables. Hence, the numbers $a, b$ and $c$ satisfy the triangle inequality, and there exists a triangle $ABC$ such that $AB=c, BC=a, CA=b$. As such $\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 $\angle ABC = 60^\circ$. Similarily, we have $\angle BCA = 60^\circ, \angle CAB = 60^\circ$, which show that triangle $ABC$ is equilaterial, thus $a=b=c$. $_\square$

Note: This may also be done directly by summing up the 3 equations to get that $(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$ with $\angle ACB = 90^\circ$, we have $\cos \angle ABC = \frac {a^2+b^2-c^2}{2ab}$, hence $a^2+b^2-c^2=0$, which gives that $a^2 + b^2 = c^2$. $_\square$

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

Solution: Apply the cosine rule to triangle $ABD$, we get $AB^2 = AD^2 + BD^2 - 2 AD \cdot BD \cos \angle ADB$. Applying the cosine rule to triangle $ADC$, we get $AC^2 = AD^2 + CD^2 - 2 AD \cdot DC \cos \angle ADC$. Since $\angle ADB + \angle ADC = 180^ \circ$, so $\cos \angle ADB = - \cos \angle ADC$. Adding the first 2 equations, and using the fact that $BD=CD$, we get that $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$, let $BC=n, CA=n+1, AB = n+2$. Let $\alpha, \beta$ and $\gamma$ be the angles at vertices $A, B$ and $C$, respectively. Then $\gamma > \beta > \alpha$. Applying the cosine rule, we obtain $\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 \beta = \frac {n+1}{2n}$ and $\cos \gamma = \frac {n-3}{2n}$. The double angle formula states that $\cos 2 \theta = 2 \cos ^2 \theta -1$. Consider the following cases:

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

Case 2. $\gamma = 2 \beta$. Then, $\frac {n-3}{2n} = 2 (\frac {n+1}{2n})^2 - 1$. Clearing denominators and expanding, we get $0 = 2n^3 + n^2 - n = n(2n -1)(n+1)$. This has no positive integer solutions.

Case 3. $\beta = 2 \alpha$. Then, $\frac {n+1}{2n} = 2 (\frac {n+5}{2n+4})^2 - 1$. Clearing denominators and expanding, we get $0=2n^3 +3n^2-9n+4 = (n-1) (2n^2+5n-4)$. The only positive integer solution is $n=1$. However, checking this triangle, we get the degenerate $1-2-3$ triangle, hence we ignore this solution.

Thus, the only triangle is the $4-5-6$ triangle. $_\square$ Note by Arron Kau
5 years, 8 months ago

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.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. 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 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example 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 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$

Sort by:

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

$\sin^2 \theta + \cos^2 \theta = 1$

which is in fact a result of pythagorean theorem.

- 5 years, 6 months ago

Thanks for sharing! It is really helpful.

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

Thanks,

Daniel

- 5 years, 8 months ago

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

Really interesting!

- 5 years, 7 months ago

THANKS.....

- 4 years, 9 months ago