Utinzo

Law of Cosines Calculator

Find missing sides or angles of any triangle using the Law of Cosines. Supports SSS (all sides known) and SAS (two sides + included angle) modes.

Did this tool work for you?

How to use this calculator

c² = a² + b² − 2ab·cos(C)

The Law of Cosines generalizes the Pythagorean theorem to any triangle. Given three sides (SSS) it finds any angle; given two sides and the included angle (SAS) it finds the third side.

  1. 1

    Choose your mode: SAS (two sides and the angle between them) or SSS (all three sides).

  2. 2

    Enter side a, side b, and either angle C (SAS) or side c (SSS).

  3. 3

    The calculator returns the missing side or angles, plus the area and perimeter.

  4. 4

    Angles are in degrees; sides share the same unit.

Frequently asked questions

What do the two modes mean?

SAS means you know sides a and b and the angle C between them; the calculator finds side c and the other two angles. SSS means you know all three sides; it finds all three angles. Switching modes changes what the third box means: an angle in degrees for SAS, a side length for SSS.

Why does it say "Invalid triangle"?

In SSS mode the sides must satisfy the triangle inequality strictly: each side shorter than the sum of the other two. Sides 1, 2 and 3 fail because 1 + 2 equals 3 exactly, which would be a flat line, and sides 2, 3 and 7 fail by a wide margin. The check is done through the cosine of an angle that would have to fall outside −1 to 1.

What angle range is accepted in SAS mode?

Greater than 0° and below 180°, in degrees. At 90° the Law of Cosines reduces to the Pythagorean theorem: sides 10 and 10 with C = 90° give c = 14.142136. Zero, negative or 180° and above gives an error.

Can I enter the angle opposite a different side?

The angle must be the one between sides a and b, which the form calls C. If your known angle lies between a different pair of sides, relabel the triangle so that those two sides are a and b before entering them.

Does it handle SSA, the ambiguous case?

No. Two sides and a non-included angle can produce zero, one or two valid triangles, which needs the Law of Sines and a decision about which solution you want. This page only covers SAS and SSS, where the triangle is fully determined.

How is the area calculated?

In SSS mode it uses Heron’s formula, √(s(s−a)(s−b)(s−c)) with s as half the perimeter. In SAS mode it uses ½·a·b·sin C. Both formulas agree for the same triangle. For SAS with 5, 7 and 60° the result is 15.155445.

What units and rounding are used?

Sides take whichever unit you type and area is in that unit squared. Sides, angles, area and perimeter are rounded to six decimal places with trailing zeros dropped. Angles are in degrees.

Are the three angles guaranteed to add up to 180°?

Up to rounding, yes. The calculator derives two angles directly and the third by subtracting from 180°, so the displayed values can differ from an exact sum by the last printed digit. For 7, 8, 9 the angles are 48.189685°, 58.411864° and 73.39845°.

About law of cosines calculator

Law of cosines calculator — SAS and SSS triangles

The formula and when to use it

The Law of Cosines says c² = a² + b² − 2ab·cos C, with matching versions for the other two sides. When C is 90° the cosine term vanishes and you get a² + b² = c². Use it when you know two sides and the angle between them (SAS) or all three sides (SSS). When you only know angles and one side, or a side pair with a non-included angle, the Law of Sines is the usual route.

What each mode takes and returns
ModeYou enterCalculator findsArea method
SASa, b, angle Cc = √(a² + b² − 2ab·cos C), then A and B½·a·b·sin C
SSSa, b, cA, B, C from cos A = (b² + c² − a²) ÷ 2bcHeron’s formula

Worked example: SAS

Sides 5 and 7 with a 60° angle between them give c = 6.244998, A = 43.897886°, B = 76.102114°, area 15.155445 and perimeter 18.244998. Widen the angle to 120° and the third side grows to 10.440307, with A = 24.503633° and B = 35.496367°. The area stays at 15.155445, because sin 60° and sin 120° are equal.

Worked example: SSS

For sides 7, 8 and 9 the angles are A = 48.189685°, B = 58.411864° and C = 73.39845°, with area 26.832816 and perimeter 24. A 3-4-5 triple returns angles of 36.869898°, 53.130102° and 90°, with area 6. Sides 1, 2 and 3 return the invalid triangle message: they would lie flat along a line.

Common ways to get the wrong answer

The usual mistake is putting the wrong angle in the third box. In SAS mode it must be the angle between a and b. Another is entering a calculator angle in radians: the field expects degrees, so 1.047 is read as about one degree rather than 60°. Finally, mixing units between sides, such as feet for a and inches for b, silently gives meaningless results.

What it does not cover

There is no SSA (ambiguous) mode, no ASA or AAS mode, and no way to enter radians. The first input row accepts only positive numbers. If you have two angles and a side, the third angle is 180° minus the two, and the Law of Sines finishes the job.

Law of Cosines Calculator – Utinzo

Learn more from an authoritative source:

Wikipedia
Related tools

Results are estimates for informational purposes only and do not constitute professional financial, medical, legal, or technical advice. Read full disclaimer →