Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Use the Law of Cosines

The law of cosines is Pythagoras with a correction term: c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C. Use it when you know two sides and the angle between them, or all three sides.

Recognize the task

A triangle with no right angle where no side is known together with its opposite angle: two sides and the included angle (SAS: a=7a = 7, b=5b = 5, C=60∘C = 60^\circ) or three sides (SSS: 5,6,75, 6, 7).

Two ways to do it

SAS: find the third sideside form
c2=a2+b2−2abcos⁡Cc^2 = a^2 + b^2 - 2ab\cos C
The angle in the formula is the one between the two known sides.
SSS: find an angleangle form
cos⁡C=a2+b2−c22ab\cos C = \frac{a^2 + b^2 - c^2}{2ab}
Solve for the largest angle first; a negative cosine means an obtuse angle.

Steps

StepOn a=5a = 5, b=6b = 6, c=7c = 7 (SSS)
1Identify the case. SAS: the side form. SSS: the angle form.SSS
2Find the largest angle first. It sits opposite the longest side; the cosine sign tells whether it is obtuse.cos⁡C=25+36−4960=0.2⇒C≈78.46∘\cos C = \frac{25 + 36 - 49}{60} = 0.2 \Rightarrow C \approx 78.46^\circ
3Find a second angle. Law of cosines again (or the law of sines, now that a complete pair exists).cos⁡A=36+49−2584≈0.714⇒A≈44.42∘\cos A = \frac{36 + 49 - 25}{84} \approx 0.714 \Rightarrow A \approx 44.42^\circ
4Finish with the angle sum.B≈180∘−78.46∘−44.42∘=57.12∘B \approx 180^\circ - 78.46^\circ - 44.42^\circ = 57.12^\circ

Worked examples

Example 1 · SAS

third side
a=7a = 7, b=5b = 5, C=60∘C = 60^\circ: c2=49+25−70⋅12c^2 = 49 + 25 - 70\cdot\frac{1}{2}
c=39≈6.24c = \sqrt{39} \approx 6.24

Example 2 · an obtuse angle

negative cosine
a=3a = 3, b=4b = 4, c=6c = 6: cos⁡C=9+16−3624≈−0.458\cos C = \frac{9 + 16 - 36}{24} \approx -0.458
C≈117.28∘C \approx 117.28^\circ
obtuse

Example 3 · SSS

the trace
5,6,75, 6, 7
A≈44.42∘A \approx 44.42^\circ, B≈57.12∘B \approx 57.12^\circ, C≈78.46∘C \approx 78.46^\circ

See it happen

Triangle Explorer
Classification
Special
Trig laws
Explore
Zoom100%
Lock angles
A
B
C
60.0°60.0°60.0°abcABC
∠A60.0°∠B60.0°∠C60.0°|a8.00b8.00c8.00|P 24.01Area 27.73
Equilateral — Explanations
All three sides and angles are equal. The most symmetric triangle.
Classification
By angles: Acute. By sides: Equilateral.
All angles below 90°. All sides equal.
Angle sum
Interior angles always sum to 180°.
60.0° + 60.0° + 60.0° = 180.0°
Open the angle CC between two fixed sides: at 90∘90^\circ the correction term vanishes and the law is Pythagoras; a sharper angle shortens cc, a wider one lengthens it. −2abcos⁡C-2ab\cos C measures exactly that.

Common mistakes

Wrong angle in the formula

✗ c2=a2+b2−2abcos⁡Ac^2 = a^2 + b^2 - 2ab\cos A
✓ the angle must be opposite the side on the left: cos⁡C\cos C

Subtracting before multiplying

✗ c2=(49+25−70)cos⁡60∘c^2 = (49 + 25 - 70)\cos 60^\circ
✓ c2=74−70cos⁡60∘=39c^2 = 74 - 70\cos 60^\circ = 39

Smallest angle first with the law of sines

✗ finding an obtuse angle by arcsine
✓ arcsine never returns an obtuse angle; get the largest angle by cosines