Law of Cosines Calculator
Use two sides and their included angle, or all three sides, to find a missing triangle measurement.
Drag & drop or upload an image or PDF
Use matching labels: side a is opposite angle A, side b is opposite B, and side c is opposite C.
Try an example
Use the Law of Cosines for SAS or SSS
The Law of Cosines connects all three sides of a triangle with one angle. It is the direct choice when you know two sides and the angle between them, called SAS, or when you know all three sides, called SSS.
Labels must stay paired: side c sits opposite angle C. With SAS, solve a side form and take the positive square root. With SSS, rearrange the same formula and use inverse cosine. Triangle checks should happen before rounding any result.
How to use the law of cosines calculator
Enter the problem as written
Type or paste the full expression. You can also upload a clear photo or PDF and check the extracted text before solving.
Read the working, not only the answer
Each transformation is separated and explained so you can compare it with your own method.
Ask about any step
Continue in the same solution to request another method, check a restriction, or ask why a rule applies.
Law of Cosines
This form links side c to its opposite angle C and the two adjacent sides a and b. The other forms follow by cycling the labels.
A reliable way to work through it
Identify SAS or SSS
For SAS, the known angle must sit between the two known sides. For SSS, all three side lengths must form a valid triangle.
Match opposite labels
Choose the formula whose left side is the side opposite the angle used in the cosine term.
Calculate, then check
Keep full precision until the final value, then confirm the side-angle ordering and any required triangle sum.
Worked example
Given a = 7, b = 10, and C = 60°, find c
The known angle C is included between sides a and b, so this is SAS.
Substitute the two sides and their included angle.
Use the exact value cos 60° = 1/2.
A side length is positive, so take the positive square root and round at the end.
The missing side is c = √79, which is approximately 8.888 units.
Common mistakes to check
Using a non-included angle for SAS
The angle in the side formula must be the angle between the two known sides.
Pairing the wrong side and angle
In c² = a² + b² - 2ab cos C, side c must be opposite angle C.
Rounding during the setup
Keep the cosine and squared value at full precision so early rounding does not shift the final side or angle.
Skipping triangle validity checks
Three positive lengths still fail to form a triangle if any two do not add to more than the third.
Related calculators
Questions students ask
When should I use the Law of Cosines?
Use it directly for SAS, where two sides and their included angle are known, or SSS, where all three sides are known.
How do I use the Law of Cosines to find an angle?
Rearrange to cos C = (a² + b² - c²)/(2ab), then apply inverse cosine in the stated angle unit.
How is the Law of Cosines related to the Pythagorean theorem?
When C is 90 degrees, cos C is zero, so the formula becomes c² = a² + b².
Can the Law of Cosines solve an SSA triangle?
Not as the direct first method. SSA gives two sides and a non-included angle, so the Law of Sines and its ambiguous-case check are usually needed first.