Triangle Length Calculator

Enter two side lengths and the angle between them to find the missing side (Law of Cosines) plus the remaining two angles and perimeter.

Quick Facts

Law of Cosines
c² = a² + b² − 2ab·cos(C)
Solves for the side opposite the known angle C.
Angle from sides
cos(A) = (b² + c² − a²) / 2bc
Gives a unique angle between 0° and 180° — no ambiguity.
Angle sum
A + B + C = 180°
Every triangle's interior angles sum to a straight angle.

Your Results

Calculated
Side c (missing length)
-
c = √(a² + b² − 2ab·cos C)
Angle A (opposite side a)
-
cos A = (b² + c² − a²) / 2bc
Angle B (opposite side b)
-
B = 180° − C − A
Perimeter
-
a + b + c

Ready

Enter two sides and the included angle, then press Calculate.

Formula and Method for Triangle Length

This calculator solves a triangle given two sides and the angle between them — the classic "side-angle-side" (SAS) case. From side a, side b, and the included angle C, it finds the missing third side using the Law of Cosines: c² = a² + b² − 2ab·cos(C). This is a direct generalization of the Pythagorean theorem to triangles that are not right triangles — when C = 90°, cos(C) = 0 and the formula collapses exactly to c² = a² + b².

How the calculation works

First the calculator finds side c with the Law of Cosines above. Once all three side lengths are known, it finds angle A (opposite side a) by rearranging the Law of Cosines: cos(A) = (b² + c² − a²) / (2bc), then takes the inverse cosine. Angle B follows immediately from the triangle angle sum: B = 180° − C − A. Using the Law of Cosines for angle A (rather than the Law of Sines) avoids the "ambiguous case," because inverse cosine always returns a unique angle between 0° and 180°, while inverse sine cannot distinguish an acute angle from its obtuse supplement.

Common mistakes

  • Using the wrong angle: the Law of Cosines requires the angle between sides a and b (the included angle) — an angle at a different vertex will give a wrong side length.
  • Degrees vs. radians: this calculator expects the angle in degrees. Entering a radian value (like 1.05 instead of 60) will produce a nonsensical result.
  • Invalid angle range: the included angle must be strictly between 0° and 180°. At those limits the three points become collinear and no triangle exists.
  • Mixed units: enter both side lengths in the same unit (both feet, both meters, etc.) before calculating; the result inherits whatever unit you selected.

Real-world applications

  • Surveying and construction use the Law of Cosines to find an unmeasurable distance (across a river, around an obstacle) from two measurable sides and the angle between them.
  • Navigation and triangulation use it to compute distances between points when direct measurement is not possible.
  • Engineering and truss design use it to verify member lengths and angles in non-right-triangle structures.
  • Physics problems involving vector addition (resultant magnitude and direction) reduce to exactly this SAS triangle calculation.

Frequently Asked Questions

What is the Law of Cosines and how does it find a missing side?
The Law of Cosines states c² = a² + b² − 2ab·cos(C), where a and b are two known sides and C is the angle between them. Solving for c gives the length of the third side directly from that SAS (side-angle-side) information.
Why use the Law of Cosines instead of the Law of Sines to find the remaining angles?
Once the third side is known, the Law of Cosines (cos A = (b² + c² − a²) / 2bc) gives a unique angle between 0° and 180°. The Law of Sines uses inverse sine, which only returns values from -90° to 90° and can give the wrong angle for obtuse triangles, so the Law of Cosines avoids that ambiguity.
What values are valid for the included angle?
The included angle must be strictly between 0° and 180°. At 0° or 180° the three points fall on a straight line, so no triangle exists, and the two side lengths must both be greater than zero.
Can this calculator handle a right triangle?
Yes. If the included angle C is 90°, cos(C) = 0 and the Law of Cosines reduces to c² = a² + b², which is the Pythagorean theorem. A right triangle is simply a special case of the SAS calculation.