Ad Space — Top Banner

Law of Cosines

Learn the Law of Cosines formula c^2 = a^2 + b^2 - 2ab*cos(C) for solving triangles when you know two sides and an angle.

The Formula

c2 = a2 + b2 - 2ab cos(C)

The Law of Cosines is a fundamental formula in trigonometry that relates the three sides of a triangle to one of its angles. It is a generalization of the Pythagorean theorem: when angle C is exactly 90 degrees, cos(90) equals zero, and the formula reduces to the familiar c2 = a2 + b2. For any other angle, the additional term -2ab cos(C) accounts for the triangle not being a right triangle.

The formula can be written for any side of the triangle. If you want to find side a, rearrange to a2 = b2 + c2 - 2bc cos(A). Similarly for side b. This flexibility makes it one of the most versatile tools for solving triangles. You can also rearrange the formula to find an angle when all three sides are known: cos(C) = (a2 + b2 - c2) / (2ab).

The Law of Cosines has ancient origins. Versions of it appear in the works of Euclid around 300 BC in his Elements (Propositions 12 and 13 of Book 2), though it was not expressed in the modern trigonometric form until the development of cosine functions by medieval mathematicians. The modern algebraic notation was formalized in Europe during the 18th and 19th centuries.

This formula is used in two main scenarios. First, when you know two sides and the included angle (SAS), you can find the third side directly. Second, when you know all three sides (SSS), you can find any angle. These are precisely the cases where the Law of Sines cannot be applied directly, making the Law of Cosines the essential complementary tool.

Practical applications are widespread. Surveyors use it to calculate distances that cannot be measured directly. Navigation systems use it to compute great-circle distances on the globe. Engineers apply it in structural analysis when resolving forces in non-right-angle configurations. It also appears in computer graphics for calculating angles between vectors and in physics for vector addition problems.

Variables

SymbolMeaning
a, b, cLengths of the three sides of the triangle
CThe angle opposite side c (in degrees or radians)
cosThe cosine trigonometric function

Example 1

Problem: A triangle has sides a = 5, b = 7, and the included angle C = 60 degrees. Find side c.

c2 = 52 + 72 - 2(5)(7)cos(60°)

c2 = 25 + 49 - 70(0.5) = 74 - 35 = 39

c = √39 ≈ 6.24

Example 2

Problem: A triangle has sides a = 8, b = 6, c = 10. Find angle C.

cos(C) = (a2 + b2 - c2) / (2ab) = (64 + 36 - 100) / (2 × 8 × 6)

cos(C) = 0 / 96 = 0

C = arccos(0) = 90 degrees (this is a right triangle!)

When to Use It

The Law of Cosines is your go-to formula for non-right triangles.

  • Finding the third side of a triangle when two sides and the included angle are known (SAS)
  • Finding any angle of a triangle when all three sides are known (SSS)
  • Surveying and land measurement when direct measurement is impossible
  • Navigation and calculating distances on maps
  • Engineering force resolution in non-perpendicular configurations

Ad Space — Bottom Banner

Embed This Calculator

Copy the code below and paste it into your website or blog.
The calculator will work directly on your page.