How to Solve a Right Triangle
Rafters, stair stringers and room diagonals are all the same problem, and it needs exactly two numbers to solve.
Quick answer: A right triangle is solved once you know two of its parts besides the right angle, and one of them must be a side. Legs of 3 and 4 give a hypotenuse of 5. A 6 ft rise over a 12 ft run gives a 13.42 ft diagonal at 26.57 degrees. The calculator fills in the rest.
Right triangles turn up in work that has nothing to do with a geometry lesson. Roof rafters, stair stringers, screen sizes, the diagonal brace on a gate. The arithmetic is two formulas. The hard part is working out which two numbers you already have.
What counts as enough information
Two sides
With two sides you use Pythagoras: the two legs squared and added give the hypotenuse squared. A room measuring 12 ft by 16 ft has a diagonal of exactly 20 ft, because 144 plus 256 is 400.
It works backwards too. A 20 ft ladder with its base 5 ft from the wall reaches 19.36 ft up, since 400 minus 25 is 375, and the square root of 375 is 19.36. That is the version people actually need, and it is the one most often done wrong by assuming the ladder length is the height.
One side and one acute angle
With an angle you need the trig ratios instead. Sine is opposite over hypotenuse, cosine is adjacent over hypotenuse, tangent is opposite over adjacent.
A roof described as 6 in 12 rises 6 units for every 12 of horizontal run, so the angle is the inverse tangent of 6 divided by 12, which is 26.57 degrees. Given a 12 ft run, the rafter length is 12 divided by the cosine of 26.57 degrees, or 13.42 ft. Notice you get the same 13.42 from Pythagoras with legs of 6 and 12, which is a useful way to check yourself.
Run your own numbers
It is free, there is no sign-up, and it works on your phone.
Open the Right Triangle CalculatorA worked example: the stair stringer
A staircase with 14 risers at 7.25 inches has a total rise of 101.5 inches. Thirteen treads at 10 inches gives a total run of 130 inches.
The stringer is the hypotenuse: 101.5 squared is 10,302.25, 130 squared is 16,900, and the square root of the total is 164.93 inches, or 13 ft 9 in of timber before you cut a single notch. The pitch is the inverse tangent of 101.5 over 130, which is 38 degrees, right at the top of what most building regulations allow for a domestic flight. If that pitch matters to your project, the trade-off between rise and going is covered in our piece on stair rise and run.
Try it with your figures
No sign-up, no ads. Your inputs stay in your browser.
Use the Right Triangle CalculatorUsing the right triangle calculator
The tool labels the two legs a and b, the hypotenuse c, and the two acute angles A and B. Enter any two values, at least one of which is a side, and leave everything else blank.
Three things trip people up. The hypotenuse is always the longest side and always sits opposite the right angle, so if your entered hypotenuse is shorter than a leg the calculator will refuse the input rather than guess. Units must match, so convert to all inches or all feet before typing, never a mix. And check the degrees and radians setting before reading an angle, because a plausible-looking wrong answer is worse than an error message.
The output also includes area and perimeter. For the 12 by 16 example, the triangular half of the room is 96 square feet, which is the same half-base-times-height sum used in our guide to calculating square footage.
Common questions
How do I find an angle when I only know two sides? Divide and take the inverse. With the opposite and adjacent sides, the angle is the inverse tangent of opposite over adjacent. With a side and the hypotenuse, use inverse sine or inverse cosine instead.
Is 3-4-5 the only whole number right triangle? No. 5-12-13, 8-15-17 and 7-24-25 all work, along with any multiple of them, so 6-8-10 and 9-12-15 are right triangles too. Builders use 3-4-5 in feet to check a corner is square precisely because the numbers are easy to measure.
Why is my answer slightly different from the calculator's? Almost always rounding the angle before using it. Round 26.565 degrees up to 27 and the tangent moves from 0.5 to 0.5095, so a 24 ft run gives a rise of 12.23 ft instead of 12 ft. That is nearly three inches of error you introduced yourself. Keep the full precision until the final step.
Can I use this for a TV screen size? Yes. Screens are sold by diagonal, so a 16:9 panel with a 55 inch diagonal is about 47.9 inches wide and 27 inches high. Enter the ratio as the two legs and the diagonal as the hypotenuse.
Calculators for this
All free, no sign-up.