Law of cosines

c2=a2+b2−2abcos⁡γc^2=a^2+b^2-2ab\cos\gamma

Result unit: length units

What it describes

A generalization of the Pythagorean theorem to any triangle.

Symbols

a,b,ca, b, c
sides of the triangle
γ\gamma
angle between sides aa and bb

Where it comes from

A generalization of the Pythagorean theorem to any triangle. When γ=90∘\gamma=90^\circ, cos⁡90∘=0\cos90^\circ=0 and the formula reduces to the Pythagorean theorem. It lets you find the third side from two sides and the angle between them.

When to use it

A triangle with two sides and the included angle (or with three sides — finding an angle).

Example

Given a=3a=3, b=4b=4, γ=60∘\gamma=60^\circ. Find side cc.
Substitutioncos⁡60∘=0.5\cos60^\circ=0.5.
Resultc2=9+16−2⋅3⋅4⋅0.5=13⇒c=13≈3.6c^2=9+16-2\cdot3\cdot4\cdot0.5=13\Rightarrow c=\sqrt{13}\approx3.6.

Related formulas

Found this formula useful? Share it.

It's free — send it to a friend who's revising.

Teaching? Embed this formula on your site.

Free widget — paste it on your school site, blog or notes. It links to the full version.

Teaching a class or tutoring? Guide students in NexTutor →