Triangle Edge Calculator: Find Side Lengths
- Perimeter
- m
- Result
- Side a
- 5 m
- You entered
- Side b
- 7 m
- You entered
This calculator works out the missing side length of a triangle when you provide the other two sides and the included angle (SAS), or all three sides to check if it is valid. You enter the known values, and it returns the third side using the law of cosines, along with the triangle’s perimeter. It is a straightforward tool for geometry homework, construction layout, or any task where you need a precise side length without working through the formula by hand.
Formula
The calculator uses the law of cosines, which relates the three sides of a triangle to one of its angles. For a triangle with sides a, b, and c, and angle C opposite side c, the formula is:
c² = a² + b² − 2ab·cos(C)
Where:
- a and b are the lengths of two known sides (in meters, feet, or any consistent unit).
- C is the included angle between sides a and b, measured in degrees.
- c is the length of the side opposite angle C (the side you want to find).
To get the side c, take the square root of both sides: c = √(a² + b² − 2ab·cos(C)). The perimeter is simply a + b + c.
Worked Example
Using the default values from the calculator: side a = 5 m, side b = 7 m, and included angle C = 60°.
- Square the sides: a² = 25, b² = 49.
- Multiply 2ab = 2 × 5 × 7 = 70.
- Find cos(60°) = 0.5.
- Compute 2ab·cos(C) = 70 × 0.5 = 35.
- Plug into the formula: c² = 25 + 49 − 35 = 39.
- Take the square root: c = √39 ≈ 6.24 m.
The calculator returns 6.24 m for side c, and the perimeter is 5 + 7 + 6.24 = 18.24 m. This matches the result shown in the tool.
When to Use This Calculator
You would use this calculator whenever you know two sides of a triangle and the angle between them (the included angle), and you need the third side. This is the classic SAS (side-angle-side) case. Common situations include:
- Finding the length of a roof rafter when you know the run and the rise angle.
- Determining the distance across a lake or field when you can measure two sides and the angle between them.
- Solving geometry problems in school where you are given two sides and an included angle.
- Checking whether a triangle with given side lengths is valid (using the triangle inequality, which the calculator indirectly helps with).
If you instead know two angles and a side (ASA or AAS), you would use the law of sines, not this calculator. This tool is specifically for the SAS case.
How to Read the Result
The output side c is the length of the side opposite the angle you entered. It is in the same unit you used for the other two sides—if you enter meters, you get meters; if you enter feet, you get feet. The perimeter is the total distance around the triangle.
One thing to note: the angle must be the included angle between the two known sides. If you enter the wrong angle (for example, an angle opposite one of the known sides), the result will be incorrect. Also, the law of cosines works for any triangle, including obtuse triangles, as long as the angle is between 0° and 180°. For an obtuse angle, the cosine is negative, which makes the term −2ab·cos(C) positive, correctly increasing the length of side c.
Common Mistakes and Misconceptions
A frequent error is mixing up units—entering one side in meters and another in feet. The calculator has no way to know your units, so always use the same unit for all inputs. Another mistake is using the wrong angle: the angle must be the one between the two sides you know. For example, if you know sides a and b, the angle must be C (opposite side c), not A or B.
A common misconception is that the law of cosines only works for right triangles. That is false—it works for all triangles. In fact, when the angle is 90°, cos(90°) = 0, and the formula simplifies to the Pythagorean theorem: c² = a² + b². So the Pythagorean theorem is just a special case of the law of cosines.
Another issue is rounding too early. If you round intermediate values, you can get a slightly different final answer. The calculator keeps full precision internally and only rounds the final result to two decimal places, which is the best practice.
Limitations of the Formula
The law of cosines is mathematically exact, but the result is only as good as your inputs. If your measurements of sides or the angle have errors, the computed side will reflect those errors. Also, the formula assumes a flat (Euclidean) triangle. On a curved surface, like the Earth’s surface for very large distances, the law of cosines does not apply directly; you would need spherical trigonometry.
Additionally, the angle must be in degrees for this calculator. If you have the angle in radians, you would need to convert first (multiply by 180/Ï€). The calculator uses the cosine of the angle in degrees (cosd), so entering radians would give a wrong result.
Alternatives and Related Methods
If you do not know the included angle but know all three sides, you can use the law of cosines to find any angle instead. That is a different calculation, but the same formula rearranged. If you know two angles and a side, use the law of sines: a/sin(A) = b/sin(B) = c/sin(C). For a right triangle, you can use simple trigonometric ratios (sine, cosine, tangent) or the Pythagorean theorem.
For construction or DIY projects, you might also use a physical protractor and tape measure, but a calculator gives more precise results, especially with non-integer angles.
Frequently Asked Questions
Can I use this calculator for a right triangle?
Yes. If the included angle is 90°, the law of cosines reduces to the Pythagorean theorem, and the calculator will give the correct hypotenuse. You can also enter 90° and the two legs to find the hypotenuse, or enter the hypotenuse and one leg to find the other leg (as long as the angle is the one between the two known sides).
What if I only know two sides and a non-included angle?
That is the SSA (side-side-angle) case, which is ambiguous—there may be zero, one, or two possible triangles. The law of cosines does not directly apply. You would need the law of sines and careful consideration of the ambiguous case. This calculator is not designed for that scenario.
How do I check if three side lengths form a valid triangle?
Use the triangle inequality theorem: the sum of any two sides must be greater than the third side. For example, sides 3, 4, and 8 do not form a triangle because 3+4 < 8. You can also use the law of cosines to compute the angle opposite the largest side; if the angle is 180° or more, the triangle is degenerate or impossible.
What units should I use?
Any unit you like, as long as you are consistent. The calculator does not care whether you use meters, feet, inches, or miles. Just make sure all three side inputs are in the same unit, and the output will be in that same unit. The angle is always in degrees.
Why is my result different from a drawing I made?
Drawings are rarely to scale, and hand-measured angles are often imprecise. The calculator gives the mathematically exact result based on the numbers you entered. If your drawing is off by a few degrees or a small length, the computed side will differ from your visual estimate. Trust the math if your inputs are accurate.
Can this calculator handle very large or very small numbers?
Yes, within the limits of floating-point arithmetic. The calculator can handle numbers from tiny fractions to very large values, but extremely large numbers (like 10^15) may lose precision. For practical purposes, it works fine for any realistic triangle.
Related
Formula used
in a | Side a | m | 5 | 0 in b | Side b | m | 7 | 0 in c_angle | Included angle C | deg | 60 | 0 out c | Side c | m | sqrt(a^2 + b^2 - 2*a*b*cosd(c_angle)) | 2 out perimeter | Perimeter | m | a + b + 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.