# Law of Cosines Calculator

Solve triangles using the law of cosines. Enter two sides and the included angle to find the third side, remaining angles, and area.

## What this calculates

Solve any triangle using the law of cosines. Enter two sides and the included angle to calculate the third side, the remaining angles, and the area of the triangle instantly.

## Inputs

- **Side a** — min 0 — The length of side a.
- **Side b** — min 0 — The length of side b.
- **Angle C (degrees)** — min 0, max 180 — The angle between sides a and b, in degrees.

## Outputs

- **Side c** — The length of the side opposite to angle C.
- **Angle A** — The angle opposite to side a.
- **Angle B** — The angle opposite to side b.
- **Area** — The area of the triangle.

## Details

The law of cosines generalizes the Pythagorean theorem to all triangles, not just right triangles. The formula states: c^2 = a^2 + b^2 - 2ab x cos(C), where C is the angle between sides a and b, and c is the side opposite angle C.

When angle C is 90 degrees, cos(90) = 0, and the formula reduces to c^2 = a^2 + b^2 (the Pythagorean theorem). When C is acute (less than 90), the cosine term subtracts from the sum, making c shorter. When C is obtuse (greater than 90), the cosine is negative, making c longer.

Once side c is found, the remaining angles can be calculated using the law of cosines in reverse: cos(A) = (b^2 + c^2 - a^2) / (2bc). The area is computed using A = 0.5 x a x b x sin(C). The law of cosines is essential in surveying, navigation, physics (resolving vector components), and any application involving non-right triangles.

## Frequently Asked Questions

**Q: What is the law of cosines?**

A: The law of cosines states that for any triangle with sides a, b, c and angle C opposite side c: c^2 = a^2 + b^2 - 2ab x cos(C). It relates the lengths of the sides to the cosine of one angle and is a generalization of the Pythagorean theorem.

**Q: When should I use the law of cosines vs the law of sines?**

A: Use the law of cosines when you know two sides and the included angle (SAS) or all three sides (SSS). Use the law of sines when you know a side and its opposite angle plus one other piece (AAS or ASA). The law of cosines avoids the ambiguous case that can occur with the law of sines.

**Q: How does the law of cosines relate to the Pythagorean theorem?**

A: The Pythagorean theorem is a special case of the law of cosines. When angle C = 90 degrees, cos(90) = 0, so the -2ab x cos(C) term disappears, leaving c^2 = a^2 + b^2. The law of cosines adds a correction term for non-right angles.

**Q: Can I use the law of cosines to find an angle?**

A: Yes. Rearrange to solve for the cosine of the angle: cos(C) = (a^2 + b^2 - c^2) / (2ab). Then take the inverse cosine (arccos) to find the angle. This is useful when you know all three sides (SSS case) and need to find the angles.

---

Source: https://vastcalc.com/calculators/math/law-of-cosines
Category: Math
Last updated: 2026-04-21
