The Law of Cosines Advanced. This lesson goes beyond core Geometry. You can skip it.

Watch the video explainer

Learning goals

  • Derive the Law of Cosines from a signed projection and the Pythagorean theorem
  • Explain how the included angle changes the square of the opposite side
  • Use two sides and their included angle to find the third side
  • Recover and check the angles of a triangle from its three sides
  • Choose a triangle law from the given sides and angles

Measure the separation with a projection

In a nondegenerate triangle ABCABC, use aa for the length of BCBC, bb for CACA, and cc for ABAB. Each lowercase letter names the side opposite the corresponding angle. The included angle between two sides is the angle at their shared endpoint. Sides aa and bb meet at CC.

Put CC at the origin and AA at (9,0)(9,0). Compare two placements of BB at the same distance from CC.

A positive signed projectionC is the origin and A lies at horizontal coordinate 9. B at (4, 3) drops to foot H on segment CA at x = 4. The acute angle is marked at C.C (0, 0)A (9, 0)B (4, 3)Hx = 43
The perpendicular foot is to the right of the origin.

In the acute placement, BB is at (4,3)(4,3). The horizontal distance from BB to AA is 9−49-4 units, and the vertical distance is 33 units. The Pythagorean theorem gives c2c^2.

c2=(9−4)2+32=34.\begin{aligned} c^2&=(9-4)^2+3^2\\ &=34. \end{aligned}
A negative signed projectionC is the origin and A lies at horizontal coordinate 9. B at (-4, 3) drops to foot H on the extension to the left of C at x = -4. The obtuse angle is marked at C.C (0, 0)A (9, 0)B (−4, 3)Hx = −43
The perpendicular foot is to the left of the origin. The dashed horizontal line extends the base.

In the obtuse placement, BB is at (−4,3)(-4,3). Its horizontal coordinate is negative. The same subtraction now gives a larger horizontal distance.

c2=(9−(−4))2+32=178.\begin{aligned} c^2&=(9-(-4))^2+3^2\\ &=178. \end{aligned}

Expanding the square shows what changed. In both placements, the squares of the horizontal and vertical coordinates of BB add to 2525, the square of BCBC. The changing part is the product of −2-2, the base length 99, and the signed horizontal coordinate.

34=92+25−2(9)(4),178=92+25−2(9)(−4).\begin{aligned} 34&=9^2+25-2(9)(4),\\ 178&=9^2+25-2(9)(-4). \end{aligned}

The Law of Cosines from a signed projection#

Now put CC at (0,0)(0,0) and AA at (b,0)(b,0). Rotate and, if necessary, reflect the triangle so B=(x,y)B=(x,y) lies above the horizontal axis. As in Triangle Area with Sine Advanced. This lesson goes beyond core Geometry. You can skip it., scaling the unit semicircle by the length aa gives the signed projection, the horizontal coordinate of BB.

x=acos⁡C.x=a\cos C.

The horizontal and vertical distances between AA and BB are ∣b−x∣|b-x| and yy. Squaring the horizontal distance gives (b−x)2(b-x)^2, even when the perpendicular foot is beyond AA. If the foot coincides with AA, the horizontal distance is zero and the same squared-distance equation gives c2=y2c^2=y^2.

c2=(b−x)2+y2=b2+(x2+y2)−2bx.\begin{aligned} c^2&=(b-x)^2+y^2\\ &=b^2+(x^2+y^2)-2bx. \end{aligned}

The Pythagorean theorem gives x2+y2=a2x^2+y^2=a^2 for BCBC. This relation also holds when x=0x=0, since then a=ya=y. Substitute this sum and the expression for xx.

c2=a2+b2−2abcos⁡C.c^2=a^2+b^2-2ab\cos C.

The numerical placements used the same expansion. The sign and size of xx can change without changing any of its steps. This equation is the Law of Cosines. Relabel the triangle to use it with any side and its opposite angle.

Check your understanding

Set C=(0,0)C=(0,0) and put AA on the positive horizontal axis. Side BCBC has length 1212 and angle CC is 120∘120^\circ. What is the horizontal coordinate of BB?

Answer choices

Find a third side from SAS

Two sides and their included angle form SAS data. The cosine equation uses those three measurements to give the square of the remaining side. Take the positive square root because a side has positive length. Use degree mode on your calculator and round only the final measurements.

Worked example 1 An acute opening

Problem. Two rods of lengths 77 cm and 1010 cm meet at a hinge opened to 60∘60^\circ. Find the exact distance dd between the free ends.

Separation across an acute openingAt hinge H, rods HP and HQ of lengths 7 cm and 10 cm enclose 60 degrees. Segment PQ is labeled d.HQP7 cm10 cmd60°
The hinge angle is between the known lengths.

Solution. The free ends are opposite the included angle. Since cos⁡60∘=12\cos60^\circ=\tfrac12, the correction subtracts 7070 from the sum of the squares.

d2=72+102−70=79,d=79 cm.\begin{aligned} d^2&=7^2+10^2-70\\ &=79,\\ d&=\sqrt{79}\text{ cm}. \end{aligned}

Check your understanding

Two fixed sides meet at an acute angle. The hinge opens to an obtuse angle while the side lengths stay fixed. How does the square of the distance between the free ends change?

Answer choices

Worked example 2 Two sightings from a dock

Problem. From one dock, the straight distances to two buoys are 230230 m and 310310 m. The angle between the sight lines is 124∘124^\circ. Treat all three points as lying in one horizontal plane. Find the straight distance dd between the buoys to the nearest meter.

Separation across an obtuse openingThe dock D is joined to buoys P and Q by sight lines of lengths 230 m and 310 m, enclosing 124 degrees at D. Segment PQ is labeled d.DQP230 m310 md124°
The sought distance joins the buoys directly.

Solution. The measured angle is between the two known sides, and dd lies across from it.

d2=2302+3102−2(230)(310)cos⁡124∘,d≈478 m.\begin{aligned} d^2&=230^2+310^2\\ &\quad-2(230)(310)\cos124^\circ,\\ d&\approx478\text{ m}. \end{aligned}

The result fits between the difference of the measured lengths, 8080 m, and their sum, 540540 m.

Worked example 3 The right-angle boundary

Problem. Two straight paths of lengths 1111 m and 1919 m start at the same point and meet there at 90∘90^\circ. Use the cosine equation to find the exact distance dd between their far ends. Explain why the Pythagorean theorem gives the same result.

Solution. The correction vanishes because cos⁡90∘=0\cos90^\circ=0. The paths are the two legs, so the unknown side is the hypotenuse.

d2=112+192=482,d=482 m.\begin{aligned} d^2&=11^2+19^2\\ &=482,\\ d&=\sqrt{482}\text{ m}. \end{aligned}

Check your understanding

In triangle ABCABC, the lengths of aa and bb are 16 and 23. The angle at CC is 108∘108^\circ. What is cc to the nearest tenth?

Answer choices

Find angles from SSS

With SSS data, all three sides are given. First check that the two shorter positive lengths add to more than the longest. This one comparison guarantees the triangle inequalities for positive lengths. Then isolate the cosine of the angle across from the side chosen on the left of the original equation.

cos⁡C=a2+b2−c22ab.\cos C=\frac{a^2+b^2-c^2}{2ab}.

As the ray from CC turns through the upper unit semicircle from 0∘0^\circ to 180∘180^\circ, the horizontal coordinate decreases from 11 to −1-1. Every value strictly between −1-1 and 11 occurs at exactly one interior angle. In degree mode the inverse cosine, written arccos⁡\arccos or cos⁡−1\cos^{-1}, returns that angle. An input of −1-1 or 11 would produce a straight or zero angle, so the triangle would be degenerate.

If you need every angle, use the cosine equation for the largest angle and then for one of the others. Subtract both from 180∘180^\circ to find the third. Starting opposite the longest side lets you see whether any angle is obtuse.

Worked example 4 Recover all three angles

Problem. In triangle ABCABC, the side lengths are 88, 1313, and 1818 units for aa, bb, and cc, respectively. Find the measures of AA, BB, and CC to the nearest tenth of a degree, and check the results against the sides.

Pairing sides with their opposite anglesTriangle ABC has sides BC of length 8, CA of length 13, and AB of length 18. No angles are labeled.CAB81318
The longest given side, AB, faces angle C.

Solution. The two shorter sides add to 2121 units, more than 1818. The largest angle is CC, across from the longest side.

cos⁡C=82+132−1822(8)(13)=−91208,C≈115.9∘.\begin{aligned} \cos C&=\frac{8^2+13^2-18^2}{2(8)(13)}\\ &=-\frac{91}{208},\\ C&\approx115.9^\circ. \end{aligned}

Use the sides touching AA in the denominator and subtract the square of the side opposite AA in the numerator.

cos⁡A=132+182−822(13)(18),A≈23.6∘.\begin{aligned} \cos A&=\frac{13^2+18^2-8^2}{2(13)(18)},\\ A&\approx23.6^\circ. \end{aligned}

Subtract the unrounded values to obtain BB.

B=180∘−C−A≈40.5∘.\begin{aligned} B&=180^\circ-C-A\\ &\approx40.5^\circ. \end{aligned}

The displayed angles add to 180.0∘180.0^\circ. Their order from smallest to largest is AA, BB, CC, which matches the order 88, 1313, 1818 of the opposite sides. The negative cosine computed for CC also agrees with its obtuse measure.

Check your understanding

The lengths of aa, bb, and cc are 1212, 1616, and 2525. Which expression gives CC in degrees?

Answer choices

Choose a law from the measurements

Start by pairing each known side with the angle across from it. The Law of Sines Advanced. This lesson goes beyond core Geometry. You can skip it. can use a known opposite pair as a ratio. The cosine equation can start from measurements that give no such pair.

Given dataFirst move
Two sides and their included angle (SAS)Use the cosine law to find the third side.
Three sides (SSS)Use the cosine law to find an angle.
Two angles and a side (ASA or AAS)Use the angle sum if needed to complete an opposite pair. Then use the sine law.
Two sides and an angle opposite a known side (SSA)Use the sine law and check the possible supplementary angles and remaining angle.

Once you have a new measurement, look at the updated data. For example, after finding the third side from SAS, all three sides are available, so the SSS procedure finds the remaining angles.

Worked example 5 Choose a law for two angles and a side

Problem. A survey triangle has angle measures 37∘37^\circ at AA and 74∘74^\circ at BB. Side ABAB measures 2121 m. Choose the first triangle law that can find ACAC, explain the choice, and calculate ACAC to the nearest tenth of a meter.

Pairing a known side with a recoverable angleTriangle ABC has 37 degrees at A, 74 degrees at B, and side AB marked 21 m. Side AC is marked as unknown.ACB21 mAC37°74°
The angle opposite AB follows from the two given angles.

Solution. Only one side is given. The angle sum completes the opposite pair for side ABAB.

C=180∘−37∘−74∘=69∘.\begin{aligned} C&=180^\circ-37^\circ-74^\circ\\ &=69^\circ. \end{aligned}

Use the Law of Sines with ABAB opposite CC and ACAC opposite BB.

ACsin⁡74∘=21sin⁡69∘,AC=21sin⁡74∘sin⁡69∘≈21.6 m.\begin{aligned} \frac{AC}{\sin74^\circ}&=\frac{21}{\sin69^\circ},\\ AC&=\frac{21\sin74^\circ}{\sin69^\circ}\\ &\approx21.6\text{ m}. \end{aligned}

Check your understanding

A triangle has sides aa and cc known. Angle AA is also known. Which first move matches the measurements?

Answer choices

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems Start →
More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (optional)

In Book II of Euclid’s Elements, the problem took two propositions. In the obtuse case the perpendicular lands outside the triangle. Euclid adds the area of twice a rectangle to the two squares. In the acute case he subtracts twice a rectangle. The diagrams let a reader compare actual areas, with the perpendicular determining which rectangle to use.

Read Book II, Proposition 12 and Book II, Proposition 13 in David E. Joyce’s edition.

Your progress

See all your progress →