Cosine Triangle Calculator

How long is the missing side of your triangle?

Find unknown sides and angles in any triangle when you know three measurements. Uses the law of cosines to solve for missing values in construction, design, and engineering projects.

Updated June 2026 · How this works

Example calculation — edit any field to use your own numbers

Worth knowing
How It Works
The formula, explained simply

Imagine trying to build a picture frame where two sides meet at an angle that is not 90 degrees. The law of cosines tells you exactly how long the third side must be to complete the triangle. Unlike the Pythagorean theorem which only works for right triangles, the law of cosines works for any triangle shape.

The formula extends the Pythagorean theorem by adding a correction term based on the angle between the two known sides. When that angle is 90 degrees, the cosine becomes zero and you get the familiar a² + b² = c² formula. For acute angles, the third side is shorter than the Pythagorean result; for obtuse angles, it is longer.

This relationship appears everywhere from navigation to architecture because it solves the fundamental problem of finding distances when you cannot measure directly. Surveyors use it to map property boundaries, architects use it to design stable roof trusses, and engineers use it to calculate forces in triangulated structures like bridges and towers.

When To Use This
Right tool, right situation

Use the law of cosines when you have two sides and the included angle (SAS configuration) or when you have all three sides and need to find the angles (SSS configuration). This covers most construction and surveying scenarios where you can measure distances but angles are harder to determine directly.

Avoid using this method when you have two angles and one side (AAS or ASA), as the law of sines is more direct for those cases. Also avoid it for right triangles where the simpler Pythagorean theorem is faster and more intuitive.

The law of cosines becomes unreliable for very flat triangles where one angle approaches 180 degrees, or for very sharp triangles where angles approach zero. In these edge cases, small measurement errors create large calculation errors, and you should verify your results using alternative methods or more precise instruments.

Common Mistakes
Why results sometimes look wrong

The most common mistake is using the law of cosines when you do not have the right combination of measurements. You need two sides and the included angle between them, not just any two sides and any angle. Using a non-included angle will give you an incorrect result.

Another frequent error is entering angles in radians when the calculator expects degrees, or vice versa. Most practical applications use degrees, but scientific calculations often use radians. Always check which unit system your tool expects before entering angle measurements.

Measurement precision also creates problems in real-world applications. Small errors in measuring sides or angles can result in triangles that are mathematically impossible, even when the physical triangle exists. This happens because the law of cosines is sensitive to measurement accuracy, especially for very acute or very obtuse triangles where small changes in angle create large changes in the opposite side length.

The Math
Worked examples and deeper derivation

The law of cosines states that c² = a² + b² - 2ab·cos(C), where c is the side opposite angle C, and a and b are the other two sides. This formula gives you the length of the third side when you know two sides and the included angle between them.

To find the remaining angles, you rearrange the formula to solve for the cosine of each unknown angle. For example, cos(A) = (b² + c² - a²) / (2bc). The inverse cosine function then gives you the angle in degrees or radians.

The calculation involves several trigonometric operations that can compound rounding errors. Modern calculators handle this automatically, but it explains why some triangles that seem valid on paper might fail the calculation due to measurement precision limits or mathematical constraints inherent in triangle geometry.

Building a deck frame
Two joists measuring 12 feet and 8 feet meet at a 60-degree angle
The diagonal brace needed is 10.58 feet. This creates a stable triangular frame with angles of 60°, 45.6°, and 74.4°, giving you the exact measurements for cutting your lumber.
Surveying property boundaries
Property lines of 150 meters and 200 meters form a 45-degree corner
The diagonal distance across your property is 147.11 meters. The other two corner angles are 67.4° and 67.6°, helping you understand the exact shape of your land parcel.
Roof truss design
Roof spans 24 feet with rafters of 14 feet each meeting at a 90-degree peak
Each rafter creates a 45° angle with the ceiling, and the base span calculates to exactly 24 feet as expected. The triangular area is 168 square feet, useful for material estimates.
Expert Unlock
The thing most explanations skip

The law of cosines fails numerically when the triangle becomes nearly degenerate - either very flat or very sharp. In these cases, the cosine values approach -1 or 1, and small measurement errors get amplified dramatically. Professional surveyors and engineers use alternative formulations or additional constraints to maintain accuracy in these edge cases.

How do I use the law of cosines for triangle problems?

What measurements do I need to solve any triangle?
You need exactly three measurements: either three sides (SSS), two sides and the included angle (SAS), or two angles and one side (AAS or ASA). The law of cosines works best with two sides and the included angle between them.
Why does my triangle calculation say it cannot exist?
A triangle cannot exist if the angles sum to more than 180 degrees, if any angle is 180 degrees or larger, or if one side is longer than the sum of the other two sides. Check that your measurements are accurate and form a valid triangle.
What is the difference between law of cosines and law of sines?
The law of cosines works when you know two sides and the included angle, while the law of sines works when you know two angles and one side. Cosines is more reliable because it avoids the ambiguous case that can occur with sines.

Need something this doesn't cover?

Suggest a tool — we'll build it →