Triangle Side Calculator: Find Any Side
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This calculator finds the length of any side of a triangle when you enter the other two sides and the included angle (or, for right triangles, the other two sides). You choose which side to solve for, enter the known values, and the calculator returns the missing side length in your chosen unit. It uses the law of cosines for general triangles and the Pythagorean theorem for right triangles.
Formula
For a general triangle with sides a, b, and c, and the angle C opposite side c (the included angle between sides a and b), the law of cosines states:
c² = a² + b² − 2ab·cos(C)
Where:
- a and b are the lengths of two sides (in any consistent unit, e.g., meters, feet).
- C is the angle between those two sides, in degrees (or radians if you use the radian version).
- c is the length of the side opposite angle C (the side you want to find).
For a right triangle (where one angle is exactly 90°), the Pythagorean theorem applies:
c² = a² + b² (where c is the hypotenuse, the side opposite the right angle).
This is actually a special case of the law of cosines because cos(90°) = 0, so the third term disappears.
Worked Example
Using the default values from the calculator: a = 5 m, b = 7 m, and the included angle C = 60°.
- Write the law of cosines: c² = a² + b² − 2ab·cos(C).
- Plug in the numbers: c² = 5² + 7² − 2·5·7·cos(60°).
- Calculate each term: 5² = 25, 7² = 49, 2·5·7 = 70, and cos(60°) = 0.5.
- So c² = 25 + 49 − 70·0.5 = 74 − 35 = 39.
- Take the square root: c = √39 ≈ 6.24 m.
The calculator returns 6.24 m, matching our manual calculation.
When to Use This Calculator
Use this tool whenever you need to find a missing side of a triangle and you have two sides plus the included angle (SAS) or, for right triangles, any two sides (which is the same as SAS with the right angle). Common real-world situations include:
- Finding the length of a roof rafter when you know the run and the rise (right triangle).
- Determining the distance across a lake or field when you can measure two sides and the angle between them.
- Calculating the diagonal of a rectangular plot or a TV screen (right triangle).
- Solving geometry homework problems that involve the law of cosines.
If you have three sides and want an angle, use the law of cosines rearranged: cos(C) = (a² + b² − c²) / (2ab).
How to Read the Result
The result is the length of the side opposite the angle you entered. It will be in the same unit you used for the other two sides. For example, if you enter sides in meters, the result is in meters; if you enter feet, the result is in feet. The calculator does not convert units—you must use the same unit for all inputs.
For a right triangle, if you enter the two legs (the sides that form the right angle), the result is the hypotenuse. If you enter one leg and the hypotenuse, you can find the other leg by rearranging the Pythagorean theorem: leg = √(hypotenuse² − other leg²).
Common Mistakes and Pitfalls
- Mixing units: Entering one side in meters and another in feet will give a wrong result. Convert all sides to the same unit first.
- Using the wrong angle: The angle must be the included angle—the one between the two sides you know. If you enter an angle that is not between them, the law of cosines will not work.
- Forgetting the square root: The law of cosines gives c², not c. Always take the square root at the end.
- Degrees vs. radians: This calculator uses degrees. If you are working in radians, you would need to convert or use the radian version of the formula.
- Triangle inequality: The side you calculate must be less than the sum of the other two sides and greater than their difference. If your inputs violate this, the triangle cannot exist, and the calculator may produce a result that is mathematically valid but geometrically impossible.
Limitations of the Formula
The law of cosines works for any triangle, but it requires that you know two sides and the included angle. If you have different information (e.g., two angles and a side, or three sides), you need a different formula (law of sines or law of cosines rearranged). Also, the formula assumes Euclidean geometry—it does not apply to spherical triangles (e.g., on the Earth’s surface) or non-Euclidean spaces.
For right triangles, the Pythagorean theorem only works when one angle is exactly 90°. If you are not sure the triangle is right-angled, use the general law of cosines instead.
Frequently Asked Questions
Can I use this calculator for any triangle?
Yes, as long as you have two sides and the included angle. The law of cosines works for acute, obtuse, and right triangles. For right triangles, you can also use the Pythagorean theorem, which is simpler.
What if I only have two sides and an angle that is not included?
That is the ambiguous case (SSA). The law of cosines will not directly give you the third side. You would need to use the law of sines, but be careful: there may be two possible triangles, one triangle, or no triangle at all.
How do I find a side if I have three angles and one side?
Use the law of sines: a/sin(A) = b/sin(B) = c/sin(C). With one side and its opposite angle, you can find the scale factor and then calculate the other sides.
What is the difference between the law of cosines and the Pythagorean theorem?
The Pythagorean theorem is a special case of the law of cosines when the angle C is 90°. In that case, cos(90°) = 0, so the term −2ab·cos(C) disappears, leaving c² = a² + b².
Can I enter angles in radians?
This calculator uses degrees. If you have an angle in radians, multiply by 180/Ï€ to convert to degrees before entering it.
Why does the calculator show a result even when my inputs don’t form a valid triangle?
The law of cosines will always produce a number, but if the triangle inequality is violated (the sum of any two sides is less than the third), the triangle cannot exist. In that case, the result is not meaningful. Always check that your inputs could form a real triangle.
Related
Formula used
sel mode | Triangle type | General=0, Right=1 in a | Side a | m | 5 | 0 in b | Side b | m | 7 | 0 in C | Angle C (included) | degrees | 60 | 0 out c | Side c | m | sqrt(a^2 + b^2 - 2*a*b*cosd(C)) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.