The Law of Cosines
Every triangle's sides and angles are connected through the law of cosines. This relationship lets you find any unknown side if you know two sides and the included angle, or any unknown angle if you know all three sides.
cos(α) = (b² + c² − a²) ÷ (2 × b × c)
cos(β) = (a² + c² − b²) ÷ (2 × a × c)
cos(γ) = (a² + b² − c²) ÷ (2 × a × b)
a, b, c— The three sides of the triangleα, β, γ— The angles opposite to sides a, b, c respectively
How to Use This Calculator
Begin by identifying which measurements you have. If you know two sides and the angle between them, enter those values. The calculator will apply the law of cosines to compute the third side.
Alternatively, if all three sides are known, input them to find all three angles. The tool rearranges the law of cosines formula algebraically, solving for the unknown quantities without requiring manual trigonometric calculations.
Example: A right triangle has sides of 3 and 4 units with a 90° angle between them. Entering a = 3, b = 4, and γ = 90° yields c = 5 (the classic Pythagorean triple). The calculator confirms this by recognizing that cos(90°) = 0, simplifying the law of cosines to the Pythagorean theorem.
When the Law of Cosines Applies
The law of cosines works for any triangle, regardless of shape or size. It's particularly valuable when:
- You lack right angles: The Pythagorean theorem only works for right triangles, but the law of cosines applies universally.
- You have two sides and an included angle (SAS): This is the most common real-world scenario in surveying and construction.
- You have all three sides (SSS): Finding angles becomes straightforward algebra.
- You have two sides and a non-included angle (SSA): The calculator handles ambiguous cases where two solutions may exist.
Common Pitfalls and Caveats
Keep these practical considerations in mind when solving triangles.
- Angle measurement consistency — Ensure your angles are in the same unit throughout—degrees or radians. Mixing them will produce incorrect results. Most calculators default to degrees, which is standard for applied problems.
- The ambiguous SSA case — When you provide two sides and a non-included angle, two valid triangles may exist. The calculator will identify this and show both solutions. Always verify which solution matches your physical constraints.
- Rounding in intermediate steps — If you manually calculate intermediate values, carry extra decimal places until the final answer. Rounding too early in cosine or inverse-cosine operations compounds errors significantly.
- Triangle inequality check — For any valid triangle, the sum of any two sides must exceed the third side. If your inputs violate this, no triangle exists. The calculator will alert you to impossible combinations.
Practical Applications
Engineers use this calculator when designing roof trusses, where two known beam lengths and their meeting angle determine the third beam. Surveyors employ it when measuring land parcels with irregular boundaries. Navigation professionals apply it to triangulation methods for pinpointing locations. In physics, it solves force vector problems where two forces at an angle result in a net force of unknown magnitude and direction.
The law of cosines is also foundational to understanding more advanced topics like the law of sines, spherical trigonometry, and coordinate geometry transformations.