Law of Cosines
The law of cosines generalizes the Pythagorean theorem to arbitrary triangles without a right angle.
Free · no credit card · in your study plan in 2 minutes
Formula
c^{2} = a^{2} + b^{2} - 2ab \cdot \cos\gammaVariables & units – Law of Cosines
| Symbol | Meaning | Unit |
|---|---|---|
| a, b, c | Sides of the triangle | m, cm, etc. |
| γ | Angle opposite side c | ° or rad |
Derivation & background – Law of Cosines
Formulated geometrically in Euclid's Elements (Book II, Propositions 12 and 13), in its modern form since Arabic and early modern trigonometry. For γ = 90°, cos γ = 0 and the law becomes the Pythagorean theorem. It solves the cases SAS (two sides and the included angle) and SSS (three sides); rearranged it gives cos γ = (a² + b² − c²)/(2ab).
Exam blueprint
Validity range
Holds in every planar triangle, for each side with its opposite angle. For γ = 90° it reduces to the Pythagorean theorem.
Derivation steps
Coordinates or a height decomposition plus Pythagoras yield the extra term.
- 1Place C at the origin: A = (b|0), B = (a·cos γ|a·sin γ).
- 2c² = (a·cos γ − b)² + (a·sin γ)² = a² + b² − 2ab·cos γ (using sin² + cos² = 1).
Rearrangements
Angle from three sides
SSS case: determine all angles this way.
Other sides
The law holds cyclically for each side with its opposite angle.
Task variant
A triangle has a = 4, b = 6, c = 8. Compute γ.
cos γ = (16 + 36 − 64)/(2·4·6) = −12/48 = −0.25. γ = arccos(−0.25) ≈ 104.5°. The minus shows γ is obtuse.
b = 3, c = 5, α = 50°: compute side a.
a² = 9 + 25 − 2·3·5·cos 50° = 34 − 30·0.643 ≈ 14.7, so a ≈ 3.84.
Common mistakes
Using an angle that is not opposite the required side.
Side and opposite angle belong together: c with γ, a with α.
Mishandling the term −2ab·cos γ for obtuse γ.
For γ > 90°, cos γ is negative, the term becomes positive and c larger.
Calculator in the wrong angle mode.
Check DEG/RAD; 60° is not 60 rad.
Exam context
- Surveying and triangle tasks (SAS, SSS), also as a check for the law of sines.
These mistakes cost points in real exams. The set drills them until they stick.
Formula cluster
Triangle trigonometry
Law of cosines for SAS/SSS, law of sines for ASA/SSA; Pythagoras as the limiting case.
Worked example
a = 5, b = 7, γ = 60°: c² = 25 + 49 − 2·5·7·cos 60° = 74 − 70·0.5 = 39, so c = √39 ≈ 6.24. With γ = 90° it would remain c² = a² + b² (Pythagoras).
Applications
Triangle calculation for SAS and SSS, surveying and navigation, adding forces in physics, distance calculation in geometry
Quanta exam set
Curated exam set for "Law of Cosines":
Question (front)
Which formula describes Law of Cosines?
Answer in your set
Question (front)
How do you rearrange c² = a² + b² − 2ab·cos γ for Angle from three sides?
Answer in your set
Question (front)
Which common mistake happens with Law of Cosines?
Answer in your set
+ 7 more cards: units, variables, derivation, example, exam task
These 10 cards are ready. One click and they sit in your deck, FSRS schedules the reviews until exam day.
Scientific sources
Common notations & search queries
Related formulas
More Mathematics formulas
Frequently asked questions about Law of Cosines
When do I use the law of cosines and when the law of sines?+
Decide by the given pieces. The law of cosines is responsible when no complete side-opposite-angle pair is available: in the SAS case (two sides and the included angle, third side sought) and in the SSS case (three sides, angles sought). The law of sines, by contrast, always needs a pair of a side and its opposite angle and thus serves ASA/AAS and SSA. Practical exam procedure: sketch, mark the given pieces, check whether a side-opposite-angle pair is complete. If yes: law of sines (shorter). If no: law of cosines. Often you combine both, for example first computing the third side from SAS with the law of cosines and then finding the remaining angles conveniently with the law of sines or the law of cosines again.
How do I rearrange the law of cosines for the angle?+
Solve c² = a² + b² − 2ab·cos γ for cos γ: move c² and the cosine term to different sides, then cos γ = (a² + b² − c²)/(2ab), and γ = arccos of that. Example with a = 4, b = 6, c = 8: cos γ = (16 + 36 − 64)/48 = −12/48 = −0.25, so γ = arccos(−0.25) ≈ 104.5°. This works for every angle if you swap the roles cyclically: cos α = (b² + c² − a²)/(2bc). A big advantage over the law of sines: arccos gives a unique result in the range 0° to 180°, there is no ambiguity. The sign directly tells you the angle type: positive cosine means acute, negative obtuse.
How is the law of cosines related to the Pythagorean theorem?+
The law of cosines is the generalization of Pythagoras to arbitrary triangles: c² = a² + b² − 2ab·cos γ. If you set γ = 90°, cos γ = 0, the correction term vanishes and c² = a² + b² remains, the classical Pythagoras. For acute angles (cos γ > 0) something is subtracted, c is shorter than in the right-angled case; for obtuse angles (cos γ < 0) something is effectively added, c is longer. The term −2ab·cos γ measures exactly how far the triangle deviates from the right angle. This view also serves as a mental plausibility check: if the included angle is obtuse, the computed opposite side must be longer than √(a² + b²), otherwise something is wrong.
What does a negative cosine value mean for the angle?+
In a triangle all angles lie between 0° and 180°, and on this range the cosine is a unique, decreasing function: positive for acute angles (0° to 90°), zero at 90°, negative for obtuse angles (90° to 180°). So if rearranging the law of cosines yields a negative value like cos γ = −0.25, you know immediately without a calculator: γ is obtuse, here arccos(−0.25) ≈ 104.5°. That is a real information gain over the law of sines, where sin β = 0.9 does not reveal whether β ≈ 64° or ≈ 116° is meant. Hence the recommendation: compute angles, especially the largest angle of a triangle (opposite the longest side), preferably with the law of cosines, where obtuseness is detected automatically.
How do I compute a missing side with the law of cosines?+
In the SAS case: insert the two known sides and the INCLUDED angle and take the root at the end. Example: b = 3, c = 5 and α = 50° (note: α lies opposite the sought side a and between b and c). a² = b² + c² − 2bc·cos α = 9 + 25 − 30·cos 50° = 34 − 30·0.643 ≈ 14.7, so a ≈ 3.84. Three checks pay off: first, the inserted angle must really lie between the two known sides (and thus opposite the sought side). Second, verify the calculator is in DEG mode. Third, triangle inequality as plausibility: a must lie between |b − c| = 2 and b + c = 8, and 3.84 fits. Forgetting the final square root is the most banal yet most frequent error.
Retain Law of Cosines for exams
Create a curated FSRS exam set for c² = a² + b² − 2ab·cos γ: formula recall, variables, derivation, rearrangement, worked example, common mistakes and exam context.
Free · curated formula set · LaTeX · FSRS spaced repetition
How do you calculate with Law of Cosines?
Here is how to work through a typical Law of Cosines (c² = a² + b² − 2ab·cos γ) task step by step:
- 1
Task
A triangle has a = 4, b = 6, c = 8. Compute γ.
Solution path
cos γ = (16 + 36 − 64)/(2·4·6) = −12/48 = −0.25. γ = arccos(−0.25) ≈ 104.5°. The minus shows γ is obtuse.
- 2
Task
b = 3, c = 5, α = 50°: compute side a.
Solution path
a² = 9 + 25 − 2·3·5·cos 50° = 34 − 30·0.643 ≈ 14.7, so a ≈ 3.84.