← MATH 142 MathScape 0 MATH142

The Law of Cosines and Heron's Formula

3 min read

Jump to a section
Textbook: Stewart, Redlin, Watson, Precalculus: Mathematics for Calculus, 7th ed.  •  Chapter: 6  •  Section: 6

A surveyor knows the lengths of two sides of a triangular lot and the angle between them, but has no way to walk the third side directly. The Law of Cosines closes that triangle from the two sides and their included angle, and Heron’s formula gives the lot’s area from just the three side lengths.

By the end of this page you can:

The floor. For a triangle with sides a, b, c and angle C opposite side c, c squared equals a squared plus b squared minus 2ab cos C. When C is 90 degrees, cos C is 0 and this collapses to the Pythagorean theorem.

Quick Reference

Field Value
Textbook Stewart, Redlin, Watson, Precalculus 7e
Chapter 6
Section 6.6 The Law of Cosines
Open alternate OpenStax Precalculus 2e, 8.2 Non-right Triangles: Law of Cosines
Difficulty core
Time 30 min

Before You Start

The Idea

The Law of Sines needs a known angle paired with its opposite side, so it cannot start a SAS or SSS triangle on its own. The Law of Cosines fills that gap. It relates all three sides to one angle, so it works whenever you know two sides and the angle between them, or all three sides. Each side has its own version, with the angle opposite that side carrying the cosine term.

Once the Law of Cosines produces a first side or angle, the Law of Sines is usually the quicker way to finish the remaining parts. When you only know the three sides and want the area, Heron’s formula gives it directly, with no angle required.

Key Formulas

For a triangle with sides a, b, c and opposite angles A, B, C:

\[ a^2 = b^2 + c^2 - 2bc\cos A \] \[ b^2 = a^2 + c^2 - 2ac\cos B \] \[ c^2 = a^2 + b^2 - 2ab\cos C \]

Source: Stewart 7e, Section 6.6 The Law of Cosines.

Heron’s formula for the area, with semiperimeter \( s = \tfrac{1}{2}(a + b + c) \):

\[ \text{Area} = \sqrt{s(s-a)(s-b)(s-c)} \]

Source: Stewart 7e, Section 6.6 The Law of Cosines.

Worked Example

A triangular plot has two sides of length 5 and 8 meters meeting at a 60 degree angle. Find the third side, then find the plot’s area from its three sides.

Label the known sides a = 5 and b = 8, with the included angle C = 60 degrees opposite the unknown side c.

Apply the Law of Cosines for c:

\[ c^2 = 5^2 + 8^2 - 2(5)(8)\cos 60^\circ \]

Compute the parts, using cos 60 degrees = 1/2, then take the positive square root for a length.

Reveal the answer

\[ c^2 = 25 + 64 - 80\left(\tfrac{1}{2}\right) = 89 - 40 = 49 \]

So c = 7 meters. A length is positive, so only the positive root is kept.

For the area, the three sides are 5, 7, and 8, with semiperimeter

\[ s = \tfrac{1}{2}(5 + 7 + 8) = 10 \]

Heron’s formula gives

\[ \text{Area} = \sqrt{10(10-5)(10-7)(10-8)} = \sqrt{10 \cdot 5 \cdot 3 \cdot 2} = \sqrt{300} = 10\sqrt{3} \approx 17.32 \text{ m}^2 \]

Connections

This builds on the Law of Sines, the Pythagorean theorem, and finding the area of a triangle. The Pythagorean theorem is the special case where the included angle is 90 degrees. Together with the Law of Sines, the Law of Cosines completes the toolkit for solving any oblique triangle: start a SAS or SSS triangle with the Law of Cosines, then finish the remaining angles with the Law of Sines. Heron’s formula leads into area and surveying problems where no angle is measured. It does not cover the AAS, ASA, or SSA cases, which are the Law of Sines.

Resources

Back to MATH 142 Skills

Last updated: 2026-06-24