Law of Cosines Calculator tool

Law of Cosines Calculator

The law of cosines generalises the Pythagorean theorem to any triangle.

What is a law of cosines calculator?

A law of cosines calculator solves a triangle when you know two sides and the angle between them, or all three sides. Leave unknown sides or angles as zero. It returns the missing side, all three angles, area, and perimeter. The rule c² = a² + b² − 2ab cos C extends the Pythagorean theorem to any triangle in Class 11 trigonometry.

How to use the Law of Cosines Calculator

  1. Enter side lengths a, b, and c you know.
  2. Enter angles A, B, C you know.
  3. Leave unknown values as 0.
  4. Use two sides plus included angle, or three sides.
  5. Read area and perimeter with the angles.

About this calculator

The law of cosines generalises the Pythagorean theorem to any triangle. When angle C is 90°, cos C is zero and the formula collapses to c² = a² + b². For oblique triangles it accounts for the acute or obtuse corner between the two known sides.

Enter sides a and b plus angle C to solve side c (SAS). Enter all three sides with angles at zero to recover every angle (SSS). Results include area from Heron's formula and the full perimeter.

Use this for land plots where two fence lengths and the corner angle are measured, or for vector magnitude when two components and their separation angle are known. Pair with [[law-of-sines]] for AAS cases, [[triangle]] for quick 3-side checks, and [[distance]] when the triangle sits on a coordinate plane.

Formula for the law of cosines

c² = a² + b² − 2ab cos C
b² = a² + c² − 2ac cos B
a² = b² + c² − 2bc cos A
  • a, b, c are side lengths opposite angles A, B, C
  • C is the angle between sides a and b when finding c
  • Angles are in degrees on the form

Law of cosines example: sides 5 and 7 with 60° between

Sides a = 5 and b = 7 enclose angle C = 60°. Side c is unknown, so leave c at 0 and enter 60 for angle C.

Law of cosines gives c² = 5² + 7² − 2 × 5 × 7 × cos 60° = 25 + 49 − 35 = 39, so c ≈ 6.2450. Remaining angles come out to about A = 43.90° and B = 76.10°.

Area is about 15.1554 square units and perimeter about 18.2450 units. Enter sides 5 and 7, angle C 60, and leave the third side blank to reproduce these values.

Common uses

  • SAS triangle homework — two sides and the included angle
  • Find all angles when three sides are measured on site
  • Vector magnitude from two components and the angle between them
  • Land-survey corner checks with two edges and a turning angle
  • Verify whether a 5-7-8 triangle is acute or obtuse

Frequently asked questions

How do I find side c when a = 5, b = 7, and angle C = 60°?

c² = 5² + 7² − 2(5)(7)cos(60°) = 25 + 49 − 35 = 39, so c ≈ 6.24. Enter a, b, and angle C; leave side c and other angles at 0.

How do I get angles from three sides?

Enter sideA, sideB, and sideC with all angles at 0. The calculator applies the cosine rule three times to recover angles A, B, and C.

Is the law of cosines the same as the Pythagorean theorem?

It is the general form. When C = 90°, cos C = 0 and you get c² = a² + b². For any other angle the −2ab cos C term adjusts the result.

Which angle is the included angle for SAS?

Angle C lies between sides a and b, and side c is opposite it. Match the labels on the diagram: the included angle sits at the corner touching both known sides.

Related calculators

Maintained by J Jaya Prakash · Last updated: October 2026