Skip to main content

Grades 10-12Free, no account needed

Law of cosines calculator

Solve SSS or SAS triangles with stable side/area formulas, degree angles and honest very-thin-triangle geometry.

All calculators

Try your problem

SSS: all sides. SAS: a,b and included C.
Opposite angle A.
Opposite angle B.
Used only for SSS.
Used only for SAS; between a and b.

Your calculations stay in this browser. No input history is saved.

Supported inputs and limits

SSS: positive sides1/1000000..1000000 with strict triangle inequalities. SAS: a,b in that range and included C=0.000001..179.999999 degrees. Scalars<=24 characters,6 decimal places or integer fractions with positive denominator, parts<=12 digits and reduced denominator<=1000000; no expressions. Exact rational/root/trigonometric expressions remain exact; numeric angles, areas and nonrational lengths are approximate to10 significant digits. Very thin diagrams can collapse at drawing resolution; exact alternatives remain. Paste cosines(sss;3;4;5) or cosines(sas;3;4;90), <=200 characters. No SSA or degenerate triangles.

Understand the method

A triangle with perpendicular sides3 and4 and hypotenuse5 has area6 and angle C=90 degrees; its cosine-law numerator is9+16-25=0.

Side a is opposite A, b opposite B, and c opposite C. The cosine law c^2=a^2+b^2-2ab cos(C) holds for every nondegenerate triangle. SSS supplies all three sides; SAS supplies a,b and the included angle C between them.

SSS checks the triangle inequalities exactly and computes area from Heron's formula. SAS uses c^2=(a-b)^2+4ab sin(C/2)^2 to avoid subtracting nearly equal quantities. Sine/projection pairs with atan2 preserve small angles better than applying acos to a rounded ratio. Outputs convert atan2 radians to degrees.

Worked examples

Read the reasoning, or load an example into the calculator.

A3-4-5 SSS triangle

Semiperimeter6 gives area sqrt(6*3*2*1)=6. Angle C=90 degrees; A and B are approximately36.86989765 and53.13010235 degrees.

Obtuse SAS

For a=2,b=3,C=120 degrees, c^2=4+9-12(-1/2)=19. Thus c=sqrt(19), while area=3 sin(120)=3 sqrt(3)/2.

Equilateral and irrational area

Sides2,2,2 give three60-degree angles. The exact area is sqrt(3), not an exact terminating decimal.

Try it without the calculator

Three questions for practice, not a graded school assessment. Your answers stay on this page and are not saved.

1. If a=3,b=4,C=90 degrees, what is c?
2. Can sides1,2,3 form a nondegenerate triangle?
3. For a=b=2,C=60 degrees, what is c?

Original Testinar learning content. This local preview is awaiting final review before publication.

Page UP