The Law of Cosines

Formula and examples of law of cosines

Law of Cosines Formula

The law of cosines is a formula that relates the three sides of a triangle to the cosine of a given angle

When to use law of cosines?

There are 2 cases for using the law of cosines.

When you know 2 sides and the included angle, and want to find the 3rd side, or when you know 3 sides and want to calculate any angle.

Why only 'included' angle?

As you can see in the prior picture, Case I states that we must know the included angle . Let's examine if that's really necessary or not.

Interactive Demonstration of the Law of Cosines Formula

The interactive demonstration below illustrates the Law of cosines formula in action. Drag around the points in the triangle to observe who the formula works.

Examples

Example 1

Given : 2 sides and 1 angle

$$b^2 = a^2 + c^2 - 2ac\cdot \text{cos}(44) \\ \color{red}{x}^2 = 14^2 + 10^2 -2 \cdot 14 \cdot 10 \text{cos}(44 ^ \circ ) \\ \color{red}{x}^2 = 14^2 + 10^2 -2 \cdot 14 \cdot 10 \text{cos}(44 ^ \circ ) \\ \color{red}{x}^2 = 296 -280 \text{cos}(44 ^ \circ) \\ \color{red}{x}^2 = 94.5848559051777 \\ \color{red}{x} = \sqrt{ 94.5848559051777} \\ \color{red}{x} = 9.725474585087234$$

Example 2.

Given : 3 sides

$$a^2 = b^2 + c^2 - 2bc\cdot \text{cos}(\color{red}{A}) \\ 25^2 = 32^2 + 37^2 -2 \cdot 32 \cdot 37 \cdot \text{cos}(\color{red}{A}) \\ 625 =2393 - 2368\cdot \text{cos}(\color{red}{A}) \\ \frac{625-2393}{ - 2368}= cos(\color{red}{A}) \\ 0.7466216216216216 = cos(\color{red}{A}) \\ \color{red}{A} = cos^{-1} (0.7466216216216216 ) \\ \color{red}{A} = 41.70142633732469 ^ \circ$$

Practice Problems

The problems below are relatively straightforward ones that should help you become more comfortable using this formula. If they seem too easy, move down to the second set of problems .

$$c^2 = a^2 + b^2 - 2ab\cdot \text{cos}( 66 ^\circ) \\ c^2 = 20^2 + 13^2 - 2\cdot20\cdot 13 \cdot \text{cos}( 66 ^\circ) \\ c^2 = 20^2 + 13^2 - 2\cdot20\cdot 13 \cdot \text{cos}( 66 ^\circ) \\ c^2 =357.4969456005839 \\ c = \sqrt{357.4969456005839} \\ c = 18.907589629579544$$

$$a^2 = b^2 + c^2 - 2bc\cdot \text{cos}(A) \\ x^2 = y^2 + z^2 - 2yz\cdot \text{cos}(X ) \\ 14^2 = 20^2 + 12^2 - 2 \cdot 20 \cdot 12 \cdot \text{cos}(X ) \\ 196 = 544-480\cdot \text{cos}(X ) \\ \frac{196 -544}{480 } =\text{cos}(X ) \\ 0.725 =\text{cos}(X ) \\ X = cos^{-1}(0.725 ) \\ X = 43.531152167372454$$

$$b^2 = a^2 + c^2 - 2ac\cdot \text{cos}(115^\circ) \\ b^2 = 16^2 + 5^2 - 2bc\cdot \text{cos}( 115^\circ) \\ b^2 = 3663 \\ b = \sqrt{3663} \\ b =60.52467916095486 \\$$

$$x^2 = 17^2 + 28^2 - 2 \cdot 17 \cdot 28 \cdot \text{cos}(114 ^\circ) \\ x^2 = 1460.213284208162 \\ x =\sqrt{ 1460.213284208162} \\ x= 38.21273719858552$$

$$\color{red}{a}^2 = b^2 + c^2 - 2bc \cdot cos (A) \\ \color{red}{a}^2 = 18.5^2 + 16^2 - 2\cdot 18.5 \cdot 16 \cdot cos (44 ^\circ) \\ \color{red}{a}^2 = 144.751689673565 \\ \color{red}{a} = \sqrt{ 144.751689673565} = 12.031279635748021$$

$$\color{red}{a}^2 = b^2 + c^2 - 2bc \cdot cos (A) \\ \color{red}{a}^2 = 18.5^2 + 16^2 - 2\cdot 18.5 \cdot 16 \cdot cos (\color{red}{A})$$

Since we don't know the included angle, $$\angle A$$, our formula does not help--we end up with 1 equation and 2 unknowns.

$$\color{red}{a}^2 = b^2 + c^2 - 2bc \cdot cos (A) \\ \color{red}{a}^2 = 18.5^2 + 16^2 - 2\cdot 18.5 \cdot 16 \cdot cos (\color{red}{A})$$

Since we don't know the included angle, $$\angle A$$, our formula does not help--we end up with 1 equation and 2 unknowns.

$$x^2 = 73.24^2 + 21^2 - 2 \cdot 73.24 \cdot 21 \cdot \text{cos}(90 ^\circ) \\ \text{remember : }\color{red}{ \text{cos}(90 ^\circ) =0} \\ x^2 = 73.24^2 + 21^2 - 2 \cdot 73.24 \cdot 21 \cdot \color{red}{0} \\ x^2 = 73.24^2 + 21^2 - \color{red}{0}$$

As you can see, the Pythagorean theorem is consistent with the law of cosines. It turns out the Pythagorean theorem is just a special case of the law of cosines.

Ultimate Math Solver (Free)

Free Algebra Solver ... type anything in there!