Cosine Triangle Calculator

Apply the Law of Cosines to solve a triangle: enter two sides and the angle between them to find the third side, the remaining two angles, and the triangle's area.

Quick Facts

Formula
c² = a² + b² − 2ab·cos(C)
Works for any triangle (acute, right, or obtuse) — the Pythagorean theorem is just the special case where C = 90°.

Your Results

Calculated
Side c
-
Side opposite angle C
Angle A
-
Opposite side a
Angle B
-
Opposite side b
Triangle area
-
½·a·b·sin(C)

Ready

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

Formula and method for the Cosine Triangle Calculator

The Law of Cosines relates the three sides of a triangle to one of its angles: c² = a² + b² − 2ab·cos(C), where C is the angle opposite side c (the angle sandwiched between sides a and b). This calculator uses the SAS (side-angle-side) form: you supply two sides and the angle between them, and it solves for the third side directly from that formula.

How the calculation works

After side c is known, all three sides are known, so the remaining two angles are found by applying the Law of Cosines a second and third time in rearranged form: A = cos⁻¹((b² + c² − a²) / 2bc) and B = cos⁻¹((a² + c² − b²) / 2ac). As a check, A + B + C always equals 180° (π radians) for a valid triangle. The area is found with the trigonometric area formula Area = ½·a·b·sin(C), which needs only two sides and the included angle — no separate height measurement required. Enter both sides in the same unit; the calculated side and area will be in that unit (and that unit squared for area).

Common mistakes

  • Using a non-included angle: C must be the angle physically between sides a and b. Plugging in an angle at a different vertex gives a meaningless side c.
  • Angle out of range: C must be strictly between 0° and 180° (or 0 and π radians). At either boundary the "triangle" collapses into a straight line.
  • Mixing degrees and radians: set the Angle unit selector to match what you typed — 60 typed as radians is over 3,400° and will not describe a real triangle-solving scenario.
  • Confusing Law of Cosines with Law of Sines: the Law of Sines needs at least one angle-side pair that already correspond (opposite each other); use it instead when you know two angles and a side, or two sides and a non-included angle.

Real-world applications

  • Surveying and navigation use the Law of Cosines to find a missing distance when two legs of a triangular path and the angle between them are known (triangulation).
  • Engineering and construction use it to solve for a diagonal brace or truss length given two known members and the angle at their joint.
  • Physics uses the same relation as the vector form for combining two vectors at a known angle to find the resultant magnitude.
  • Navigation and aviation use it in dead-reckoning to determine distance after a heading change (angle) over a known leg.

Frequently Asked Questions

What is the Law of Cosines?
The Law of Cosines states that for any triangle with sides a, b, and c, and C the angle opposite side c: c² = a² + b² − 2ab·cos(C). It generalizes the Pythagorean theorem, which only applies when C is a 90° angle (cos(90°) = 0, so the last term drops out).
When should I use the Law of Cosines instead of the Law of Sines?
Use the Law of Cosines when you know two sides and the included angle between them (SAS) and want the third side, or when you know all three sides (SSS) and want an angle. The Law of Sines is better suited when you know two angles and a side (AAS/ASA) or two sides and a non-included angle (SSA).
What values are valid for the included angle?
The included angle C must be strictly between 0 and 180 degrees (or between 0 and π radians). At 0° or 180° the three points become collinear and no triangle exists, so the calculator rejects those values.
How is the triangle's area calculated?
Once you know two sides and the included angle, area = ½·a·b·sin(C). This trigonometric area formula pairs naturally with the Law of Cosines and does not require the triangle's height.