# 11.3: The Law of Cosines

In Section 11.2, we developed the Law of Sines (Theorem ef{lawofsines}) to enable us to solve triangles in the 'Angle-Angle-Side' (AAS), the 'Angle-Side-Angle' (ASA) and the ambiguous 'Angle-Side-Side' (ASS) cases. In this section, we develop the Law of Cosines which handles solving triangles in the index{Side-Angle-Side triangle} 'Side-Angle-Side' (SAS) and index{Side-Side-Side triangle} 'Side-Side-Side' (SSS) cases.footnote{Here, 'Side-Angle-Side' means that we are given two sides and the 'included' angle - that is, the given angle is adjacent to both of the given sides.} We state and prove the theorem below.

Theorem (PageIndex{1}): Law of Cosines

Given a triangle with angle-side opposite pairs ((alpha, a)), ((eta, b)) and ((gamma, c)), the following equations hold

[ a^2 = b^2 + c^2 - 2bc cos(alpha) qquad b^2 = a^2 + c^2 - 2ac cos(eta) qquad c^2 = a^2 + b^2 - 2ab cos(gamma) label{lawofcosines}]

or, solving for the cosine in each equation, we have

[ cos(alpha) = dfrac{b^2+c^2 - a^2}{2bc} qquad cos(eta) = dfrac{a^2+c^2 - b^2}{2ac} qquad cos(gamma) = dfrac{a^2+b^2 - c^2}{2ab} ]

To prove the theorem, we consider a generic triangle with the vertex of angle (alpha) at the origin with side (b) positioned along the positive (x)-axis.

From this set-up, we immediately find that the coordinates of (A) and (C) are (A(0,0)) and (C(b,0)). From Theorem ef{cosinesinecircle}, we know that since the point (B(x,y)) lies on a circle of radius (c), the coordinates of (B) are (B(x,y) = B(c cos(alpha), c sin(alpha))). (This would be true even if (alpha) were an obtuse or right angle so although we have drawn the case when (alpha) is acute, the following computations hold for any angle (alpha) drawn in standard position where (0 < alpha < 180^{circ}).) We note that the distance between the points (B) and (C) is none other than the length of side (a). Using the distance formula, Equation ef{distanceformula}, we get

[egin{array}{rclr} a & = & sqrt{(c cos(alpha) - b)^{2} + (c sin(alpha) - 0)^2} & a^{2} & = & left(sqrt{(c cos(alpha) - b)^{2} + c^2 sin^2(alpha)} ight)^2 & a^2 & = & (c cos(alpha) - b)^{2} + c^2 sin^2(alpha) & a^2 & = & c^2 cos^2(alpha) - 2bc cos(alpha) + b^2 + c^2 sin^2(alpha) & a^2 & = & c^2left(cos^2(alpha) + sin^2(alpha) ight) + b^2 - 2bc cos(alpha) & a^2 & = & c^2(1) + b^2 - 2bc cos(alpha) & ext{Since (cos^2(alpha) + sin^2(alpha) = 1)} a^2 & = & c^2 + b^2 - 2bc cos(alpha) & end{array} ]

The remaining formulas given in Theorem (PageIndex{1}) can be shown by simply reorienting the triangle to place a different vertex at the origin. We leave these details to the reader. What's important about (a) and (alpha) in the above proof is that ((alpha,a)) is an angle-side opposite pair and (b) and (c) are the sides adjacent to (alpha) -- the same can be said of any other angle-side opposite pair in the triangle. Notice that the proof of the Law of Cosines relies on the distance formula which has its roots in the Pythagorean Theorem. That being said, the Law of Cosines can be thought of as a generalization of the Pythagorean Theorem. If we have a triangle in which (gamma = 90^{circ}), then (cos(gamma) = cosleft(90^{circ} ight) = 0) so we get the familiar relationship (c^2 = a^2 + b^2). What this means is that in the larger mathematical sense, the Law of Cosines and the Pythagorean Theorem amount to pretty much the same thing.footnote{This shouldn't come as too much of a shock. All of the theorems in Trigonometry can ultimately be traced back to the definition of the circular functions along with the distance formula and hence, the Pythagorean Theorem.}

Example (PageIndex{1}):

Solve the following triangles. Give exact answers and decimal approximations (rounded to hundredths) and sketch the triangle.

1. (eta = 50^{circ} label{locsas}), (a = 7) units, (c=2) units
2. (a=4 label{locsss}) units, (b=7) units, (c = 5) units

Solution

1. We are given the lengths of two sides, (a=7) and (c = 2), and the measure of the included angle, (eta = 50^{circ}). With no angle-side opposite pair to use, we apply the Law of Cosines. We get (b^2 = 7^2 + 2^2 - 2(7)(2)cosleft(50^{circ} ight)) which yields (b = sqrt{53-28cosleft(50^{circ} ight)} approx 5.92) units. In order to determine the measures of the remaining angles (alpha) and (gamma), we are forced to used the derived value for (b). There are two ways to proceed at this point. We could use the Law of Cosines again, or, since we have the angle-side opposite pair ((eta, b)) we could use the Law of Sines. The advantage to using the Law of Cosines over the Law of Sines in cases like this is that unlike the sine function, the cosine function distinguishes between acute and obtuse angles. The cosine of an acute is positive, whereas the cosine of an obtuse angle is negative. Since the sine of both acute and obtuse angles are positive, the sine of an angle alone is not enough to determine if the angle in question is acute or obtuse. Since both authors of the textbook prefer the Law of Cosines, we proceed with this method first. When using the Law of Cosines, it's always best to find the measure of the largest unknown angle first, since this will give us the obtuse angle of the triangle if there is one. Since the largest angle is opposite the longest side, we choose to find (alpha) first. To that end, we use the formula (cos(alpha) = frac{b^2+c^2-a^2}{2bc}) and substitute (a = 7), (b = sqrt{53-28cosleft(50^{circ} ight)}) and (c = 2). We getfootnote{after simplifying ldots} [cos(alpha) = frac{2-7cosleft(50^{circ} ight)}{sqrt{53-28cosleft(50^{circ} ight)}}] Since (alpha) is an angle in a triangle, we know the radian measure of (alpha) must lie between (0) and (pi) radians. This matches the range of the arccosine function, so we have [alpha = arccosleft(frac{2-7cosleft(50^{circ} ight)}{sqrt{53-28cosleft(50^{circ} ight)}} ight) , ext{radians} , approx 114.99^{circ}] At this point, we could find (gamma) using (gamma = 180^{circ} - alpha - eta approx 180^{circ} - 114.99^{circ} - 50^{circ} = 15.01^{circ}), that is if we trust our approximation for (alpha). To minimize propagation of error, however, we could use the Law of Cosines again,footnote{Your instructor will let you know which procedure to use. It all boils down to how much you trust your calculator.} in this case using (cos(gamma) = frac{a^2+b^2-c^2}{2ab}). Plugging in (a = 7), (b = sqrt{53-28cosleft(50^{circ} ight)}) and (c=2), we get (gamma = arccosleft(frac{7-2 cosleft(50^{circ} ight)}{sqrt{53-28cosleft(50^{circ} ight)}} ight)) radians (approx 15.01^{circ}). We sketch the triangle below.

As we mentioned earlier, once we've determined (b) it is possible to use the Law of Sines to find the remaining angles. Here, however, we must proceed with caution as we are in the ambiguous (ASS) case. It is advisable to first find the extit{smallest} of the unknown angles, since we are guaranteed it will be acute.footnote{There can only be one extit{obtuse} angle in the triangle, and if there is one, it must be the largest.} In this case, we would find (gamma) since the side opposite (gamma) is smaller than the side opposite the other unknown angle, (alpha). Using the angle-side opposite pair ((eta, b)), we get (frac{sin(gamma)}{2} = frac{sin(50^{circ})}{ sqrt{53-28cosleft(50^{circ} ight)}}). The usual calculations produces (gamma approx 15.01^{circ}) and (alpha = 180^{circ} - eta - gamma approx 180^{circ} - 50^{circ} - 15.01^{circ} = 114.99^{circ}).

1. Since all three sides and no angles are given, we are forced to use the Law of Cosines. Following our discussion in the previous problem, we find (eta) first, since it is opposite the longest side, (b). We get (cos(eta) = frac{a^2+c^2-b^2}{2ac} = -frac{1}{5}), so we get (eta = arccosleft(-frac{1}{5} ight)) radians (approx 101.54^{circ}). As in the previous problem, now that we have obtained an angle-side opposite pair ((eta, b)), we could proceed using the Law of Sines. The Law of Cosines, however, offers us a rare opportunity to find the remaining angles using extit{only} the data given to us in the statement of the problem. Using this, we get (gamma = arccosleft(frac{5}{7} ight)) radians (approx 44.42^{circ}) and (alpha = arccosleft(frac{29}{35} ight)) radians (approx 34.05^{circ}).

We note that, depending on how many decimal places are carried through successive calculations, and depending on which approach is used to solve the problem, the approximate answers you obtain may differ slightly from those the authors obtain in the Examples and the Exercises. A great example of this is number ef{locsss} in Example ef{locex}, where the extit{approximate} values we record for the measures of the angles sum to (180.01^{circ}), which is geometrically impossible. Next, we have an application of the Law of Cosines.

Example (PageIndex{2}): locapplication

A researcher wishes to determine the width of a vernal pond as drawn below. From a point (P), he finds the distance to the eastern-most point of the pond to be (950) feet, while the distance to the western-most point of the pond from (P) is (1000) feet. If the angle between the two lines of sight is (60^{circ}), find the width of the pond.

Solution

We are given the lengths of two sides and the measure of an included angle, so we may apply the Law of Cosines to find the length of the missing side opposite the given angle. Calling this length (w) (for extit{width}), we get (w^2 = 950^2 + 1000^2 - 2(950)(1000)cosleft(60^{circ} ight) = 952500) from which we get (w = sqrt{952500} approx 976) feet.

In Section 11.2, we used the proof of the Law of Sines to develop Theorem ef{areaformulasine} as an alternate formula for the area enclosed by a triangle. In this section, we use the Law of Cosines to derive another such formula - Heron's Formula.

Note: Heron's Formula

Suppose (a), (b) and (c) denote the lengths of the three sides of a triangle. Let (s) be the semiperimeter of the triangle, that is, let (s = frac{1}{2}(a + b + c)). Then the area (A) enclosed by the triangle is given by

[ A = sqrt{s (s-a) (s-b) (s-c)} label{HeronsFormula}]

We prove Theorem ef{HeronsFormula} using Theorem ef{areaformulasine}. Using the convention that the angle (gamma) is opposite the side (c), we have (A = frac{1}{2} ab sin(gamma)) from Theorem ef{areaformulasine}. In order to simplify computations, we start by manipulating the expression for (A^2).

[ egin{array}{rclr} A^2 & = & left(dfrac{1}{2} ab sin(gamma) ight)^2 & & = & dfrac{1}{4} a^2 b^2 sin^{2}(gamma) & & = & dfrac{a^2b^2}{4} left(1 - cos^{2}(gamma) ight) & ext{since (sin^2(gamma) = 1 - cos^{2}(gamma)).} end{array}]

The Law of Cosines tells us (cos(gamma) = frac{a^2 + b^2 - c^2}{2ab}), so substituting this into our equation for (A^2) gives

[ egin{array}{rclr} A^2 & = & dfrac{a^2b^2}{4} left(1 - cos^{2}(gamma) ight) & ext{hphantom{perfect square trinomials.}} & = & dfrac{a^2b^2}{4} left[1 - left( dfrac{a^2 + b^2 - c^2}{2ab} ight)^2 ight] & & = & dfrac{a^2b^2}{4} left[1 - dfrac{left(a^2 + b^2 - c^2 ight)^2}{4a^2b^2} ight] & & = & dfrac{a^2b^2}{4} left[dfrac{4a^2 b^2 - left(a^2 + b^2 - c^2 ight)^2}{4a^2b^2} ight] & & = & dfrac{4a^2 b^2 - left(a^2 + b^2 - c^2 ight)^2}{16} & & = & dfrac{(2ab)^2 - left(a^2 + b^2 - c^2 ight)^2}{16} & & = & dfrac{left( 2ab - left[a^2+b^2 - c^2 ight] ight) left( 2ab + left[a^2+b^2 - c^2 ight] ight)}{16} & ext{difference of squares.} & = & dfrac{left(c^2 - a^2 + 2ab - b^2 ight)left( a^2 + 2ab + b^2- c^2 ight)}{16} & end{array} ]

[ egin{array}{rclr} A^2 & = & dfrac{left(c^2 - left[a^2 - 2ab + b^2 ight] ight) left( left[a^2 + 2ab + b^2 ight]- c^2 ight)}{16} & & = & dfrac{left(c^2 - (a-b)^2 ight) left( (a+b)^2- c^2 ight)}{16} & ext{perfect square trinomials.} & = & dfrac{ (c-(a-b))(c+(a-b))((a+b) -c)((a+b)+c)}{16} & ext{difference of squares.} & = & dfrac{ (b+c-a)(a+c-b)(a+b-c)(a+b+c)}{16} & & = & dfrac{(b+c-a)}{2} cdot dfrac{(a+c-b)}{2} cdot dfrac{(a+b-c)}{2} cdot dfrac{(a+b+c)}{2} & end{array} ]

At this stage, we recognize the last factor as the semiperimeter, (s = frac{1}{2}(a+b+c) = frac{a+b+c}{2}). To complete the proof, we note that

[ (s - a) = dfrac{a+b+c}{2} - a = dfrac{a+b+c-2a}{2} = dfrac{b+c-a}{2} ]

Similarly, we find ((s-b) = frac{a+c-b}{2}) and ((s-c) = frac{a+b-c}{2}). Hence, we get

[ egin{array}{rclr} A^2 & = & dfrac{(b+c-a)}{2} cdot dfrac{(a+c-b)}{2} cdot dfrac{(a+b-c)}{2} cdot dfrac{(a+b+c)}{2} & & = & (s-a) (s-b) (s-c) s & end{array} ]

so that (A = sqrt{s(s-a)(s-b)(s-c)}) as required.

We close with an example of Heron's Formula.

Example (PageIndex{3}):heronex

Find the area enclosed of the triangle in Example ef{locex} number ef{locsss}.

Solution

We are given (a = 4), (b=7) and (c = 5). Using these values, we find (s = frac{1}{2}(4+7+5) = 8), ((s - a) = 8 - 4 = 4), ((s-b) = 8-7 =1) and ((s-c) = 8-5=3). Using Heron's Formula, we get (A = sqrt{s(s-a)(s-b)(s-c)} = sqrt{(8)(4)(1)(3)} = sqrt{96} = 4sqrt{6} approx 9.80) square units. qed

## 5 11 12 triangle

Angle &angle A = α = 24.6 2 199773287 ° = 24°37'12&Prime = 0.4 3 296996662 rad
Angle &angle B = β = 66.42 2 18215218 ° = 66°25'19&Prime = 1.15 9 92794807 rad
Angle &angle C = γ = 88.95 8 82011495 ° = 88°57'30&Prime = 1.55 3 26135067 rad

Height: ha = 10.99 8 81816679
Height: hb = 4.99 9 91734854
Height: hc = 4.58 3 2575695

Median: ma = 11.23 6 61025271
Median: mb = 7.36 5 54599313
Median: mc = 6.08 3 27625303

Inradius: r = 1.96 4 39610121
Circumradius: R = 6.00 1 09919815

Vertex coordinates: A[12 0] B[0 0] C[2 4.58 3 2575695 ]
Centroid: CG[4.66 7 66666667 1.52 8 75252317 ]
Coordinates of the circumscribed circle: U[6 0.10 9 91089451 ]
Coordinates of the inscribed circle: I[3 1.96 4 39610121 ]

Exterior (or external, outer) angles of the triangle:
&angle A' = α' = 155.3 8 80022671 ° = 155°22'48&Prime = 0.4 3 296996662 rad
&angle B' = β' = 113.57 8 8178478 ° = 113°34'41&Prime = 1.15 9 92794807 rad
&angle C' = γ' = 91.04 2 17988505 ° = 91°2'30&Prime = 1.55 3 26135067 rad

SAS” is when we know two sides and the angle between them. use The Law of Cosines to calculate the unknown side, then use The Law of Sines to find the smaller of the other two angles, and then use the three angles add to 180° to find the last angle.

The Cosine Rule can be used in any triangle where you are trying to relate all three sides to one angle. If you need to find the length of a side, you need to know the other two sides and the opposite angle. It doesn’t matter which way around you put sides b and c – it will work both ways.

## SURFACE AND INTERFACE PHENOMENA

### 4.1.7 Growth Rate vs Distance between Substrate Holder and Hot Filament

Up to certain critical temperature range ∼750 K the growth rate VG depends exclusively on density and effectiveness of energizing of the incident flow. Even in such relatively low temperature conditions the dependence VG(L) does not follow a square low. The directional pattern of the flow is focused stronger than one may expect from the “cosine law” of simple evaporator. This is due to the character of the initial vapor emission from microporous ceramic. In addition, the electrical field intensifies the flow directional pattern.

Figure 20 shows the plot of VG(L) for the same chamber and open plasmatron. In the range of L > 4 cm the observed dependence is close to V G ∼ L − 1 1 2 . Dependence VG ∼ 1/L may be actualized with a semiclosed plasmatron surrounded by a cylindrical screen. Based on this reactor geometry the growth rate of 40 mm/h was achieved during a 3-h deposition. Although screening increases the deposition yield in a given solid angle, the overall process yield may be decreased due to side physical–chemical phenomena upon the screen.

Fig. 20 . Growth rate vs distance between substrate and hot filament.

Intensification of the deposition process using short-distance geometry possesses some obvious limitations due to the inevitable substrate temperature increase. Not only does the temperature increase change the growth mechanism and film structure, as was discussed above, but at temperature >∼800 K the growth rate decreases due to intensified desorption of the precursor radicals from the growth front.

A water-cooled heat sink may be useful for special applications although it cannot be considered a universal solution. More prospective should be an optimized plasmatron design minimizing the cathode temperature and direct irradiation of the substrates.

## Non-right Triangles: Law of Cosines

Suppose a boat leaves port, travels 10 miles, turns 20 degrees, and travels another 8 miles as shown in (Figure). How far from port is the boat? Figure 1.

Unfortunately, while the Law of Sines enables us to address many non-right triangle cases, it does not help us with triangles where the known angle is between two known sides, a SAS (side-angle-side) triangle , or when all three sides are known, but no angles are known, a SSS (side-side-side) triangle . In this section, we will investigate another tool for solving oblique triangles described by these last two cases.

### Using the Law of Cosines to Solve Oblique Triangles

The tool we need to solve the problem of the boat’s distance from the port is the Law of Cosines, which defines the relationship among angle measurements and side lengths in oblique triangles. Three formulas make up the Law of Cosines. At first glance, the formulas may appear complicated because they include many variables. However, once the pattern is understood, the Law of Cosines is easier to work with than most formulas at this mathematical level.

Understanding how the Law of Cosines is derived will be helpful in using the formulas. The derivation begins with the Generalized Pythagorean Theorem, which is an extension of the Pythagorean Theorem to non-right triangles. Here is how it works: An arbitrary non-right triangle is placed in the coordinate plane with vertex at the origin, side drawn along the x-axis, and vertex located at some point in the plane, as illustrated in (Figure). Generally, triangles exist anywhere in the plane, but for this explanation we will place the triangle as noted. Figure 2.

We can drop a perpendicular from to the x-axis (this is the altitude or height). Recalling the basic trigonometric identities , we know that In terms of and The point located at has coordinates Using the side as one leg of a right triangle and as the second leg, we can find the length of hypotenuse using the Pythagorean Theorem. Thus, The formula derived is one of the three equations of the Law of Cosines. The other equations are found in a similar fashion.

Keep in mind that it is always helpful to sketch the triangle when solving for angles or sides. In a real-world scenario, try to draw a diagram of the situation. As more information emerges, the diagram may have to be altered. Make those alterations to the diagram and, in the end, the problem will be easier to solve.

### Law of Cosines

The Law of Cosines states that the square of any side of a triangle is equal to the sum of the squares of the other two sides minus twice the product of the other two sides and the cosine of the included angle. For triangles labeled as in (Figure), with angles and and opposite corresponding sides and respectively, the Law of Cosines is given as three equations.  Figure 3.

To solve for a missing side measurement, the corresponding opposite angle measure is needed.

When solving for an angle, the corresponding opposite side measure is needed. We can use another version of the Law of Cosines to solve for an angle. Given two sides and the angle between them (SAS), find the measures of the remaining side and angles of a triangle.

1. Sketch the triangle. Identify the measures of the known sides and angles. Use variables to represent the measures of the unknown sides and angles.
2. Apply the Law of Cosines to find the length of the unknown side or angle.
3. Apply the Law of Sines or Cosines to find the measure of a second angle.
4. Compute the measure of the remaining angle.

### Finding the Unknown Side and Angles of a SAS Triangle

Find the unknown side and angles of the triangle in (Figure). Figure 4.

First, make note of what is given: two sides and the angle between them. This arrangement is classified as SAS and supplies the data needed to apply the Law of Cosines.

Each one of the three laws of cosines begins with the square of an unknown side opposite a known angle. For this example, the first side to solve for is side as we know the measurement of the opposite angle  Because we are solving for a length, we use only the positive square root. Now that we know the length we can use the Law of Sines to fill in the remaining angles of the triangle. Solving for angle we have The other possibility for would be In the original diagram, is adjacent to the longest side, so is an acute angle and, therefore, does not make sense. Notice that if we choose to apply the Law of Cosines , we arrive at a unique answer. We do not have to consider the other possibilities, as cosine is unique for angles between and Proceeding with we can then find the third angle of the triangle. The complete set of angles and sides is [/hidden-answer]

## 11.3: The Law of Cosines

Lecture 5.4, The Law of Cosines

Notes and exercises for lecture 5.4

Lecture Notes 5.4 Law of Cosines.pdf (Ken’s lecture notes on the sum and difference formulas, in pdf)

WS_5_4_LawOfCosines.pdf (Worksheet practicing this material, in pdf)

S&Z 11.2-11.3.pdf (Relevant section from the free textbook by Stitz & Zeager, in pdf)

Video podcasts on lecture 5.4

5.4a Law of Cosines.mov (short podcast on the law of cosines.)

5.4b Herons Formula & Five Guys.mov (short podcasts on some results involving the law of cosines.)

Abbreviated podcast notes on lecture 5.4

Presentations (slides without audio) on lecture 5.4

Recommended external links for lecture 5.4

Dr. Paul Dawkin’s Online Math Notes on .

The Law of Cosines, a generalization of the Pythagorean theorem, allows us to completely solve triangles when we are given three parts of a triangle, not all angles. Here we develop the law of cosines and then apply it.

The lecture notes (by Dr. Ken W. Smith) are available in three formats:

1. written out, as a textbook section (in pdf)

2. as a podcast (in 2 parts), accompanied by 4-to-1 abbreviated notes.

3. as a short presentation (slides without audio, in 2 parts)

There are also class exercises (Worksheet 5.1) and a related section of the textbook by Stitz & Zeager.

The Law of Cosines applies to any triangle with side lengths a,b,c and angles A,B,C. Note that if C is a right angle, then cos(C) = 0 and the law of cosines reduces to the Pythagorean Theorem: a 2 + b 2 = c 2 . Here, c would be the length of the hypotenuse of the right triangle.

Note that the length of the unknown side c is continually recalculated using the Law of Cosines. The Law of Cosines is a tool for solving triangles. From that, you can use the Law of Cosines to find the third side. It works on any triangle, not just right triangles.

## Contents

Though the notion of the cosine was not yet developed in his time, Euclid's Elements, dating back to the 3rd century BC, contains an early geometric theorem almost equivalent to the law of cosines. The cases of obtuse triangles and acute triangles (corresponding to the two cases of negative or positive cosine) are treated separately, in Propositions 12 and 13 of Book 2. Trigonometric functions and algebra (in particular negative numbers) being absent in Euclid's time, the statement has a more geometric flavor:

Proposition 12
In obtuse-angled triangles the square on the side subtending the obtuse angle is greater than the squares on the sides containing the obtuse angle by twice the rectangle contained by one of the sides about the obtuse angle, namely that on which the perpendicular falls, and the straight line cut off outside by the perpendicular towards the obtuse angle.

Using notation as in Fig. 2, Euclid's statement can be represented by the formula

This formula may be transformed into the law of cosines by noting that CH = (CB) cos(π − γ) = −(CB) cos γ . Proposition 13 contains an entirely analogous statement for acute triangles.

Euclid's Elements paved the way for the discovery of law of cosines. In the 15th century, Jamshīd al-Kāshī, a Persian mathematician and astronomer, provided the first explicit statement of the law of cosines in a form suitable for triangulation. He provided accurate trigonometric tables and expressed the theorem in a form suitable for modern usage. As of the 1990s, in France, the law of cosines is still referred to as the Théorème d'Al-Kashi.   

The theorem was popularized in the Western world by François Viète in the 16th century. At the beginning of the 19th century, modern algebraic notation allowed the law of cosines to be written in its current symbolic form.

The theorem is used in triangulation, for solving a triangle or circle, i.e., to find (see Figure 3):

• the third side of a triangle if one knows two sides and the angle between them:
• the angles of a triangle if one knows the three sides:
• the third side of a triangle if one knows two sides and an angle opposite to one of them (one may also use the Pythagorean theorem to do this if it is a right triangle):

These formulas produce high round-off errors in floating point calculations if the triangle is very acute, i.e., if c is small relative to a and b or γ is small compared to 1. It is even possible to obtain a result slightly greater than one for the cosine of an angle.

The third formula shown is the result of solving for a in the quadratic equation a 2 − 2ab cos γ + b 2 − c 2 = 0 . This equation can have 2, 1, or 0 positive solutions corresponding to the number of possible triangles given the data. It will have two positive solutions if b sin γ < c < b , only one positive solution if c = b sin γ , and no solution if c < b sin γ . These different cases are also explained by the side-side-angle congruence ambiguity.

### Using the distance formula Edit

Consider a triangle with sides of length a , b , c , where θ is the measurement of the angle opposite the side of length c . This triangle can be placed on the Cartesian coordinate system aligned with edge a with origin at C, by plotting the components of the 3 points of the triangle as shown in Fig. 4:

Squaring both sides and simplifying

An advantage of this proof is that it does not require the consideration of different cases for when the triangle is acute, right, or obtuse.

### Using trigonometry Edit

Dropping the perpendicular onto the side c through point C , an altitude of the triangle, shows (see Fig. 5)

(This is still true if α or β is obtuse, in which case the perpendicular falls outside the triangle.) Multiplying through by c yields

Considering the two other altitudes of the triangle yields

Adding the latter two equations gives

Subtracting the first equation from the last one results in

This proof uses trigonometry in that it treats the cosines of the various angles as quantities in their own right. It uses the fact that the cosine of an angle expresses the relation between the two sides enclosing that angle in any right triangle. Other proofs (below) are more geometric in that they treat an expression such as a cos γ merely as a label for the length of a certain line segment.

Many proofs deal with the cases of obtuse and acute angles γ separately.

### Using the Pythagorean theorem Edit

#### Case of an obtuse angle Edit

Euclid proved this theorem by applying the Pythagorean theorem to each of the two right triangles in the figure shown ( AHB and CHB ). Using d to denote the line segment CH and h for the height BH , triangle AHB gives us

and triangle CHB gives

Substituting the second equation into this, the following can be obtained:

This is Euclid's Proposition 12 from Book 2 of the Elements.  To transform it into the modern form of the law of cosines, note that

d = a cos ⁡ ( π − γ ) = − a cos ⁡ γ .

#### Case of an acute angle Edit

Euclid's proof of his Proposition 13 proceeds along the same lines as his proof of Proposition 12: he applies the Pythagorean theorem to both right triangles formed by dropping the perpendicular onto one of the sides enclosing the angle γ and uses the binomial theorem to simplify.

#### Another proof in the acute case Edit

Using more trigonometry, the law of cosines can be deduced by using the Pythagorean theorem only once. In fact, by using the right triangle on the left hand side of Fig. 6 it can be shown that: c 2 = ( b − a cos ⁡ γ ) 2 + ( a sin ⁡ γ ) 2 = b 2 − 2 a b cos ⁡ γ + a 2 cos 2 ⁡ γ + a 2 sin 2 ⁡ γ = b 2 + a 2 − 2 a b cos ⁡ γ , quad c^<2>&=(b-acos gamma )^<2>+(asin gamma )^<2>&=b^<2>-2abcos gamma +a^<2>cos ^<2>gamma +a^<2>sin ^<2>gamma &=b^<2>+a^<2>-2abcos gamma ,end>>

This proof needs a slight modification if b < a cos(γ) . In this case, the right triangle to which the Pythagorean theorem is applied moves outside the triangle ABC . The only effect this has on the calculation is that the quantity ba cos(γ) is replaced by a cos(γ) − b. As this quantity enters the calculation only through its square, the rest of the proof is unaffected. However, this problem only occurs when β is obtuse, and may be avoided by reflecting the triangle about the bisector of γ .

Referring to Fig. 6 it is worth noting that if the angle opposite side a is α then:

This is useful for direct calculation of a second angle when two sides and an included angle are given.

### Using Ptolemy's theorem Edit

Referring to the diagram, triangle ABC with sides AB = c , BC = a and AC = b is drawn inside its circumcircle as shown. Triangle ABD is constructed congruent to triangle ABC with AD = BC and BD = AC . Perpendiculars from D and C meet base AB at E and F respectively. Then:

Now the law of cosines is rendered by a straightforward application of Ptolemy's theorem to cyclic quadrilateral ABCD :

Plainly if angle B is right, then ABCD is a rectangle and application of Ptolemy's theorem yields the Pythagorean theorem:

### By comparing areas Edit

One can also prove the law of cosines by calculating areas. The change of sign as the angle γ becomes obtuse makes a case distinction necessary.

• a 2 , b 2 , and c 2 are the areas of the squares with sides a , b , and c , respectively
• if γ is acute, then ab cos γ is the area of the parallelogram with sides a and b forming an angle of γ′ =
• π / 2 − γ
• if γ is obtuse, and so cos γ is negative, then −ab cos γ is the area of the parallelogram with sides a and b forming an angle of γ′ = γ
• π / 2 .

Acute case. Figure 7a shows a heptagon cut into smaller pieces (in two different ways) to yield a proof of the law of cosines. The various pieces are

• in pink, the areas a 2 , b 2 on the left and the areas 2ab cos γ and c 2 on the right
• in blue, the triangle ABC , on the left and on the right
• in grey, auxiliary triangles, all congruent to ABC , an equal number (namely 2) both on the left and on the right.

The equality of areas on the left and on the right gives

Obtuse case. Figure 7b cuts a hexagon in two different ways into smaller pieces, yielding a proof of the law of cosines in the case that the angle γ is obtuse. We have

• in pink, the areas a 2 , b 2 , and −2ab cos γ on the left and c 2 on the right
• in blue, the triangle ABC twice, on the left, as well as on the right.

The equality of areas on the left and on the right gives

The rigorous proof will have to include proofs that various shapes are congruent and therefore have equal area. This will use the theory of congruent triangles.

### Using geometry of the circle Edit

Using the geometry of the circle, it is possible to give a more geometric proof than using the Pythagorean theorem alone. Algebraic manipulations (in particular the binomial theorem) are avoided.

Case of acute angle γ , where a > 2b cos γ . Drop the perpendicular from A onto a = BC , creating a line segment of length b cos γ . Duplicate the right triangle to form the isosceles triangle ACP . Construct the circle with center A and radius b , and its tangent h = BH through B . The tangent h forms a right angle with the radius b (Euclid's Elements: Book 3, Proposition 18 or see here), so the yellow triangle in Figure 8 is right. Apply the Pythagorean theorem to obtain

Then use the tangent secant theorem (Euclid's Elements: Book 3, Proposition 36), which says that the square on the tangent through a point B outside the circle is equal to the product of the two lines segments (from B ) created by any secant of the circle through B . In the present case: BH 2 = BC·BP , or

Substituting into the previous equation gives the law of cosines:

Note that h 2 is the power of the point B with respect to the circle. The use of the Pythagorean theorem and the tangent secant theorem can be replaced by a single application of the power of a point theorem.

Case of acute angle γ , where a < 2b cos γ . Drop the perpendicular from A onto a = BC , creating a line segment of length b cos γ . Duplicate the right triangle to form the isosceles triangle ACP . Construct the circle with center A and radius b , and a chord through B perpendicular to c = AB, half of which is h = BH. Apply the Pythagorean theorem to obtain

Now use the chord theorem (Euclid's Elements: Book 3, Proposition 35), which says that if two chords intersect, the product of the two line segments obtained on one chord is equal to the product of the two line segments obtained on the other chord. In the present case: BH 2 = BC·BP, or

Substituting into the previous equation gives the law of cosines:

Note that the power of the point B with respect to the circle has the negative value −h 2 .

Case of obtuse angle γ . This proof uses the power of a point theorem directly, without the auxiliary triangles obtained by constructing a tangent or a chord. Construct a circle with center B and radius a (see Figure 9), which intersects the secant through A and C in C and K . The power of the point A with respect to the circle is equal to both AB 2 − BC 2 and AC·AK . Therefore,

which is the law of cosines.

Using algebraic measures for line segments (allowing negative numbers as lengths of segments) the case of obtuse angle ( CK > 0 ) and acute angle ( CK < 0 ) can be treated simultaneously.

### Using the law of sines Edit

By using the law of sines and knowing that the angles of a triangle must sum to 180 degrees, we have the following system of equations (the three unknowns are the angles):

Then, by using the third equation of the system, we obtain a system of two equations in two variables:

where we have used the trigonometric property that the sine of a supplementary angle is equal to the sine of the angle.

sin ⁡ ( α + γ ) = sin ⁡ α cos ⁡ γ + sin ⁡ γ cos ⁡ α

By dividing the whole system by cos γ , we have:

Hence, from the first equation of the system, we can obtain

By substituting this expression into the second equation and by using

we can obtain one equation with one variable:

By multiplying by (bc cos α) 2 , we can obtain the following equation:

Recalling the Pythagorean identity, we obtain the law of cosines:

### Using vectors Edit

Taking the dot product of each side with itself:

When a = b , i.e., when the triangle is isosceles with the two sides incident to the angle γ equal, the law of cosines simplifies significantly. Namely, because a 2 + b 2 = 2a 2 = 2ab , the law of cosines becomes

An analogous statement begins by taking α , β , γ , δ to be the areas of the four faces of a tetrahedron. Denote the dihedral angles by β γ ^ >> etc. Then 

When the angle, γ , is small and the adjacent sides, a and b , are of similar length, the right hand side of the standard form of the law of cosines can lose a lot of accuracy to numerical loss of significance. In situations where this is an important concern, a mathematically equivalent version of the law of cosines, similar to the haversine formula, can prove useful:

c 2 = ( a − b ) 2 + 4 a b sin 2 ⁡ ( γ 2 ) = ( a − b ) 2 + 4 a b haversin ⁡ ( γ ) . c^<2>&=(a-b)^<2>+4absin ^<2>left(<2>> ight)&=(a-b)^<2>+4aboperatorname (gamma ).end>>

In the limit of an infinitesimal angle, the law of cosines degenerates into the circular arc length formula, c = a γ .

Versions similar to the law of cosines for the Euclidean plane also hold on a unit sphere and in a hyperbolic plane. In spherical geometry, a triangle is defined by three points u , v , and w on the unit sphere, and the arcs of great circles connecting those points. If these great circles make angles A , B , and C with opposite sides a , b , c then the spherical law of cosines asserts that both of the following relationships hold:

In hyperbolic geometry, a pair of equations are collectively known as the hyperbolic law of cosines. The first is

cosh ⁡ a = cosh ⁡ b cosh ⁡ c − sinh ⁡ b sinh ⁡ c cos ⁡ A

where sinh and cosh are the hyperbolic sine and cosine, and the second is

cos ⁡ A = − cos ⁡ B cos ⁡ C + sin ⁡ B sin ⁡ C cosh ⁡ a .

As in Euclidean geometry, one can use the law of cosines to determine the angles A , B , C from the knowledge of the sides a , b , c . In contrast to Euclidean geometry, the reverse is also possible in both non-Euclidean models: the angles A , B , C determine the sides a , b , c .

allows to unify the formulae for plane, sphere and pseudosphere into:

Verifying the formula for non-Euclidean geometry

Hence, for a sphere of radius 1

Likewise, for a pseudosphere of radius i

Verifying the formula in the limit of Euclidean geometry

In the Euclidean plane the appropriate limits for the above equation must be calculated:

Applying this to the general formula for a finite R yields:

### By the Pythagorean Theorem

One way to think of the law of cosines is as an extension of the Pythagorean theorem for a right triangle:  By Pythagorean theorem, we know But is just some portion of side length which is less than the length of . Substituting the difference gives us, By Pythagorean theorem, we also know that Substituting the appropriate values gives us, Expanding the squared term gives us  And by the definition of cosine, we know that Substituting this value in give us  ### Using the Distance Formula

The law of cosines solves for a particular side length using the other side lengths and an angle. We can write this length using the distance formula as the distance from one vertex of the triangle to another.

Let be oriented so that is at the origin, and is at the point . We use the formula for the distance between two points   is the distance from to .

Since and , substituting the appropriate points into the distance formula gives us Squaring the inner terms, we have Since ,  ## Non-right Triangles: Law of Cosines

Suppose a boat leaves port, travels 10 miles, turns 20 degrees, and travels another 8 miles as shown in [link]. How far from port is the boat? Unfortunately, while the Law of Sines enables us to address many non-right triangle cases, it does not help us with triangles where the known angle is between two known sides, a SAS (side-angle-side) triangle, or when all three sides are known, but no angles are known, a SSS (side-side-side) triangle. In this section, we will investigate another tool for solving oblique triangles described by these last two cases.

### Using the Law of Cosines to Solve Oblique Triangles

The tool we need to solve the problem of the boat’s distance from the port is the Law of Cosines, which defines the relationship among angle measurements and side lengths in oblique triangles. Three formulas make up the Law of Cosines. At first glance, the formulas may appear complicated because they include many variables. However, once the pattern is understood, the Law of Cosines is easier to work with than most formulas at this mathematical level.

Understanding how the Law of Cosines is derived will be helpful in using the formulas. The derivation begins with the Generalized Pythagorean Theorem, which is an extension of the Pythagorean Theorem to non-right triangles. Here is how it works: An arbitrary non-right triangle A B C

is placed in the coordinate plane with vertex A

drawn along the x-axis, and vertex C

located at some point ( x , y )

in the plane, as illustrated in [link]. Generally, triangles exist anywhere in the plane, but for this explanation we will place the triangle as noted. We can drop a perpendicular from C

to the x-axis (this is the altitude or height). Recalling the basic trigonometric identities, we know that

In terms of θ , x = b cos θ

has coordinates ( b cos θ , b sin θ ) .

as one leg of a right triangle and y

as the second leg, we can find the length of hypotenuse a

using the Pythagorean Theorem. Thus,

The formula derived is one of the three equations of the Law of Cosines. The other equations are found in a similar fashion.

Keep in mind that it is always helpful to sketch the triangle when solving for angles or sides. In a real-world scenario, try to draw a diagram of the situation. As more information emerges, the diagram may have to be altered. Make those alterations to the diagram and, in the end, the problem will be easier to solve.

The Law of Cosines states that the square of any side of a triangle is equal to the sum of the squares of the other two sides minus twice the product of the other two sides and the cosine of the included angle. For triangles labeled as in [link], with angles α , β ,

and opposite corresponding sides a , b ,

respectively, the Law of Cosines is given as three equations. To solve for a missing side measurement, the corresponding opposite angle measure is needed.

When solving for an angle, the corresponding opposite side measure is needed. We can use another version of the Law of Cosines to solve for an angle.

Given two sides and the angle between them (SAS), find the measures of the remaining side and angles of a triangle.

1. Sketch the triangle. Identify the measures of the known sides and angles. Use variables to represent the measures of the unknown sides and angles.
2. Apply the Law of Cosines to find the length of the unknown side or angle.
3. Apply the Law of Sines or Cosines to find the measure of a second angle.
4. Compute the measure of the remaining angle.

Find the unknown side and angles of the triangle in [link]. First, make note of what is given: two sides and the angle between them. This arrangement is classified as SAS and supplies the data needed to apply the Law of Cosines.

Each one of the three laws of cosines begins with the square of an unknown side opposite a known angle. For this example, the first side to solve for is side b ,

as we know the measurement of the opposite angle β .

Because we are solving for a length, we use only the positive square root. Now that we know the length b ,

we can use the Law of Sines to fill in the remaining angles of the triangle. Solving for angle α ,

The other possibility for α

would be α = 180° – 56.3° ≈ 123.7°.

In the original diagram, α

is adjacent to the longest side, so α

is an acute angle and, therefore, 123.7°

does not make sense. Notice that if we choose to apply the Law of Cosines, we arrive at a unique answer. We do not have to consider the other possibilities, as cosine is unique for angles between 0°

we can then find the third angle of the triangle.

The complete set of angles and sides is

Find the missing side and angles of the given triangle: α = 30° , b = 12 , c = 24.

for the given triangle if side a = 20 ,

For this example, we have no angles. We can solve for any angle using the Law of Cosines. To solve for angle α , Because the inverse cosine can return any angle between 0 and 180 degrees, there will not be any ambiguous cases using this method.

### Solving Applied Problems Using the Law of Cosines

Just as the Law of Sines provided the appropriate equations to solve a number of applications, the Law of Cosines is applicable to situations in which the given data fits the cosine models. We may see these in the fields of navigation, surveying, astronomy, and geometry, just to name a few.

On many cell phones with GPS, an approximate location can be given before the GPS signal is received. This is accomplished through a process called triangulation, which works by using the distances from two known points. Suppose there are two cell phone towers within range of a cell phone. The two towers are located 6000 feet apart along a straight highway, running east to west, and the cell phone is north of the highway. Based on the signal delay, it can be determined that the signal is 5050 feet from the first tower and 2420 feet from the second tower. Determine the position of the cell phone north and east of the first tower, and determine how far it is from the highway.

For simplicity, we start by drawing a diagram similar to [link] and labeling our given information. Using the Law of Cosines, we can solve for the angle θ .

Remember that the Law of Cosines uses the square of one side to find the cosine of the opposite angle. For this example, let a = 2420 , b = 5050 ,

corresponds to the opposite side a = 2420.

To answer the questions about the phone’s position north and east of the tower, and the distance to the highway, drop a perpendicular from the position of the cell phone, as in [link]. This forms two right triangles, although we only need the right triangle that includes the first tower for this problem. and the basic trigonometric identities, we can find the solutions. Thus

The cell phone is approximately 4638 feet east and 1998 feet north of the first tower, and 1998 feet from the highway.

Returning to our problem at the beginning of this section, suppose a boat leaves port, travels 10 miles, turns 20 degrees, and travels another 8 miles. How far from port is the boat? The diagram is repeated here in [link]. The boat turned 20 degrees, so the obtuse angle of the non-right triangle is the supplemental angle, 180° − 20° = 160° .

With this, we can utilize the Law of Cosines to find the missing side of the obtuse triangle—the distance of the boat to the port.

The boat is about 17.7 miles from port.

### Using Heron’s Formula to Find the Area of a Triangle

We already learned how to find the area of an oblique triangle when we know two sides and an angle. We also know the formula to find the area of a triangle using the base and the height. When we know the three sides, however, we can use Heron’s formula instead of finding the height. Heron of Alexandria was a geometer who lived during the first century A.D. He discovered a formula for finding the area of oblique triangles when three sides are known.

Heron’s formula finds the area of oblique triangles in which sides a , b ,

is one half of the perimeter of the triangle, sometimes called the semi-perimeter.

Find the area of the triangle in [link] using Heron’s formula. Then we apply the formula.

The area is approximately 29.4 square units.

Use Heron’s formula to find the area of a triangle with sides of lengths a = 29.7 ft , b = 42.3 ft ,

A Chicago city developer wants to construct a building consisting of artist’s lofts on a triangular lot bordered by Rush Street, Wabash Avenue, and Pearson Street. The frontage along Rush Street is approximately 62.4 meters, along Wabash Avenue it is approximately 43.5 meters, and along Pearson Street it is approximately 34.1 meters. How many square meters are available to the developer? See [link] for a view of the city property. Find the measurement for s ,

which is one-half of the perimeter.

The developer has about 711.4 square meters.

Find the area of a triangle given a = 4.38 ft , b = 3.79 ft,

Access these online resources for additional instruction and practice with the Law of Cosines.

### Key Equations

 Law of Cosines a 2 = b 2 + c 2 − 2 b c cos α b 2 = a 2 + c 2 − 2 a c cos β c 2 = a 2 + b 2 − 2 a b c o s γ
 Heron’s formula Area = s ( s − a ) ( s − b ) ( s − c ) where s = ( a + b + c ) 2

### Key Concepts

• The Law of Cosines defines the relationship among angle measurements and lengths of sides in oblique triangles.
• The Generalized Pythagorean Theorem is the Law of Cosines for two cases of oblique triangles: SAS and SSS. Dropping an imaginary perpendicular splits the oblique triangle into two right triangles or forms one right triangle, which allows sides to be related and measurements to be calculated. See [link] and [link].
• The Law of Cosines is useful for many types of applied problems. The first step in solving such problems is generally to draw a sketch of the problem presented. If the information given fits one of the three models (the three equations), then apply the Law of Cosines to find a solution. See [link] and [link].
• Heron’s formula allows the calculation of area in oblique triangles. All three sides must be known to apply Heron’s formula. See [link] and See [link].

### Section Exercises

#### Verbal

If you are looking for a missing side of a triangle, what do you need to know when using the Law of Cosines?

two sides and the angle opposite the missing side.

If you are looking for a missing angle of a triangle, what do you need to know when using the Law of Cosines?

represents in Heron’s formula.

is the semi-perimeter, which is half the perimeter of the triangle.

Explain the relationship between the Pythagorean Theorem and the Law of Cosines.

When must you use the Law of Cosines instead of the Pythagorean Theorem?

The Law of Cosines must be used for any oblique (non-right) triangle.

#### Algebraic

For the following exercises, assume α

If possible, solve each triangle for the unknown side. Round to the nearest tenth.