Mathematics, Statistics & Geometry

Law of Cosines Calculator

Calculate missing side lengths and angles of any non-right triangle using the Law of Cosines. Essential for advanced trigonometry.

Side c
4.95
Angle A45.582°
Angle B89.418°
Calculation StepsInputs: a = 5, b = 7, ∠C = 45° Law of Cosines: c² = a² + b² - 2ab·cos(C) c² = 5² + 7² - 2(5)(7)·cos(45°) c² = 25.00 + 49.00 - 70.00( 0.7071 ) c² = 24.502525 c = √24.502525 = 4.950003 Find ∠A: cos(A) = (b² + c² - a²) / (2bc) cos(A) = (7² + 4.95² - 5²) / (2·7·4.95) = 0.6999 ∠A = arccos(0.6999) = 45.5817° Find ∠B: 180° - ∠C - ∠A ∠B = 180° - 45° - 45.5817° = 89.4183°

Calculated locally in your browser. Fast, secure, and private.

The Generalized Pythagorean Theorem

The Law of Cosines Calculator is the ultimate tool for solving oblique (non-right) triangles. Whether you are dealing with a Side-Angle-Side (SAS) scenario or a Side-Side-Side (SSS) scenario, this calculator will instantly find the missing dimensions.

c2=a2+b22abcos(C)\begin{aligned} c^2 = a^2 + b^2 - 2ab \cos(C) \end{aligned}

Where:
c=
The side length opposite to angle C
a, b=
The other two side lengths of the triangle
C=
The angle formed exactly between sides a and b

Solving the Unsolvable

In basic geometry, you learn that the Pythagorean theorem only works on right triangles. The Law of Cosines removes this limitation. By introducing the 2abcos(C)-2ab \cos(C) term, it perfectly adjusts the formula to account for how "open" or "closed" the angle is compared to a perfect 90 degrees.

Real-World Applications

  • Surveying and Navigation: If a ship sails 50 miles North, turns 30 degrees East, and sails another 20 miles, the Law of Cosines can instantly calculate the ship's direct distance back to port.
  • Mechanical Engineering: Calculating the exact forces on a static truss or crane boom where beams meet at non-perpendicular angles.
  • Computer Game Physics: Used in Inverse Kinematics (IK) to calculate exactly how much a character's knee or elbow needs to bend to place their hand/foot on a specific target.

Frequently Asked Questions

It is a mathematical formula used to find missing side lengths or angles in any triangle, not just right-angled ones. It is effectively a generalized version of the Pythagorean theorem.

You must use it when you are given either SAS (Side-Angle-Side) or SSS (Side-Side-Side). In these situations, the Law of Sines will not work because you don't have a known 'Side-Angle' pair.

If angle C is exactly 90 degrees (a right angle), the cosine of 90° is 0. The entire '- 2ab cos(C)' part disappears, leaving just c² = a² + b², which is the Pythagorean theorem!

Yes! If you know all three sides (SSS), you can algebraically rearrange the formula to solve for any angle: cos(C) = (a² + b² - c²) / (2ab).

Yes. The cosine of an obtuse angle (greater than 90°) is negative. This double-negative makes the '- 2ab cos(C)' term positive, resulting in a side length 'c' that is longer than the hypotenuse of a right triangle.