Law of Cosines Calculator

Solve triangles using the law of cosines: SAS and SSS cases with step-by-step solutions

Triangle Calculator

Triangle Solution

Sides

4.00
Side a
5.00
Side b
6.40
Side c

Angles

38.66°
Angle α
51.34°
Angle β
90.00°
Angle γ

Triangle Properties

15.40
Perimeter
10.00
Area
Right
Type

Example: Finding the Third Side (SAS)

Problem

In a triangle, two sides are 5 and 6 units, and the angle between them is 30°. Find the third side.

Solution

Given: a = 5, b = 6, γ = 30°

Using the law of cosines: c² = a² + b² - 2ab cos(γ)

c² = 5² + 6² - 2(5)(6) cos(30°)

c² = 25 + 36 - 60 × 0.866

c² = 61 - 51.96 = 9.04

c ≈ 3.01 units

Law of Cosines Formulas

Finding Sides

a² = b² + c² - 2bc cos(α)

b² = a² + c² - 2ac cos(β)

c² = a² + b² - 2ab cos(γ)

Finding Angles

α = arccos[(b² + c² - a²)/(2bc)]

β = arccos[(a² + c² - b²)/(2ac)]

γ = arccos[(a² + b² - c²)/(2ab)]

When to Use Law of Cosines

SAS: Two sides and included angle
SSS: All three sides known
Finding angles: When all sides are known
Any triangle: Works for acute, right, and obtuse

Triangle Types

Acute:All angles < 90°
Right:One angle = 90°
Obtuse:One angle > 90°
Note: For right triangles, the law of cosines reduces to the Pythagorean theorem.

Understanding the Law of Cosines

What is the Law of Cosines?

The law of cosines (also known as the cosine rule) relates the lengths of a triangle's sides to the cosine of one of its angles. It generalizes the Pythagorean theorem and can be applied to any triangle, not just right triangles.

Applications

  • Navigation and surveying
  • Engineering and construction
  • Physics and astronomy
  • Computer graphics and game development

Relationship to Pythagorean Theorem

When the angle γ = 90°, cos(90°) = 0, and the law of cosines becomes:

c² = a² + b² - 2ab × 0

c² = a² + b²

This is the Pythagorean theorem!

Historical Note

The law appeared in Euclid's Elements, though not in its modern form. The first explicit equation was presented by Persian mathematician d'Al-Kashi in the 15th century, and it was later popularized by French mathematician Viète.