What this calculator does
This tool solves a right triangle from any two known sides. The right angle is fixed at vertex C, so side c is always the hypotenuse (the longest side, opposite the right angle), while sides a and b are the two perpendicular legs. From your two inputs it computes the missing side, the perimeter, semiperimeter, area, all three altitudes, and the three interior angles in degrees.
How to use it
Pick a calculation mode. Choose Given a and b if you know both legs, or Given a and c if you know one leg and the hypotenuse. Enter the two side lengths, optionally choose a display unit (purely cosmetic — it labels the outputs but does not change the numbers), and set how many significant figures to round results to. The unit applies to every length output, areas use that unit squared, and angles are always reported in degrees.
The formulas
The missing side comes from the Pythagorean theorem: with two legs, \(c = \sqrt{a^2 + b^2}\); with a leg and the hypotenuse, \(b = \sqrt{c^2 - a^2}\). Then \(P = a + b + c\) and \(s = P/2\). Because the legs are perpendicular, the area is simply $$K = \tfrac{1}{2}\cdot a\cdot b.$$ Each altitude equals twice the area divided by the side it falls on: $$h_a = \frac{2K}{a}, \quad h_b = \frac{2K}{b}, \quad h_c = \frac{2K}{c}.$$ The angles are \(A = \operatorname{atan2}(a, b)\), \(B = \operatorname{atan2}(b, a)\), and \(C = 90^\circ\), so \(A + B + C = 180^\circ\).
Worked example
With \(a = 3\) and \(b = 4\): $$c = \sqrt{9 + 16} = 5, \quad P = 12, \quad s = 6, \quad K = 6,$$ $$h_a = 4, \quad h_b = 3, \quad h_c = 2.4, \quad A \approx 36.87^\circ, \quad B \approx 53.13^\circ, \quad C = 90^\circ.$$ This is the classic 3-4-5 Pythagorean triple.
FAQ
Does the unit change the answers? No. All sides share one unit, so the numbers are identical for any choice; the unit is attached only as a label.
Why does mode "Given a and c" require c > a? The hypotenuse must be the longest side. If \(c \le a\) then \(c^2 - a^2\) would not be positive and no real triangle exists.
Why is ha equal to b? The legs are perpendicular, so the altitude onto one leg is just the other leg. Only \(h_c\), the altitude to the hypotenuse, is a new value: \(h_c = \frac{ab}{c}\).