# Calculate sides of right triangle with hypotenuse and area or perimeter

I'm trying to find if it is possible to find the lengths of the base and height of a right triangle with only the hypotenuse and the area (or the perimeter) of the triangle. I would have just figured that it was impossible, but I found an online calculator that could do it, but it didn't provide formulas.

Lets say you have right-angled triangle with sides $a$ and $b$ and hypotenuse $h$. We can then say that:$$h^2=a^2+b^2\tag{1}$$If its area is $A$ then we can also say that:$$A=\frac{1}{2}ab$$Which can be rearranged to give:$$4A^2=a^2b^2$$Now use (1) to eliminate $b$ and we get:$$4A^2=a^2(h^2-a^2)$$Which leads to a quadratic equation in $a^2$:$$a^4-h^2a^2+4A^2=0$$So, given $h$ and $A$, this can be solved to find $a$ and then (1) can be used to find the other side $b$.

Similary, given the perimeter $p$ we can can say that:$$p=a+b+h$$$$\therefore b=(p-h)-a$$Substitute this into (1) to get:$$h^2=a^2+((p-h)-a)^2=a^2+(p-h)^2-2a(p-h)+a^2$$Therefore:$$2a^2-2(p-h)a+(p-h)^2-h^2=0$$$$\therefore 2a^2-2(p-h)a+p^2-2ph=0$$Which is a quadratic in $a$ and can be solved to find $a$ given $h$ and $p$.

• Great explanation. Thanks! – 尺adioactiveςtud May 2 '15 at 21:02

From the Wikipedia article on Thales' theorem:

If you know the hypotenuse, you know the base of this diagram; if you also know the area, then you can compute the height (from $A=\frac12 bh$). Then you can draw a horizontal line at the required height; where it intersects the circle is the vertex with the right angle.

So with the area and hypotenuse criteria $a^2+b^2=h^2$ and $2ab=4A$ so that $(a+b)^2=h^2+4A$ and $(a-b)^2=h^2-4A$

With the hypotenuse and perimeter question you have $a+b+h=P$, which is insufficient to determine the values of $a$ and $b$.

If you have area and perimeter, you have $2ab=4A, a+b+h=P, a+b=P-h, a^2+b^2=h^2$. Using the first idea $(P-h)^2=h^2+4A$ so that $P^2-4A=2Ph$. This gives $h$ , and you work from $A$ and $h$.

For hypotenuse $h$ and area $A$, let the legs be $x$ and $y$. Then $x^2+y^2=h^2$ and $xy=2A$. It follows that $$(x+y)^2=x^2+y^2+2xy=h^2+4A$$ and $$(x-y)^2=x^2+y^2-2xy=h^2-4A.$$ Thus $x+y=\sqrt{h^2+4A}$ and $x-y=\pm\sqrt{h^2-4A}$ and now we can solve for $x$ and $y$.

For hypotenuse $h$ and perimeter $p$, we have $x^2+y^2=h^2$ and $x+y+h=p$. Thus $x+y=p-h$. Note that $$(x-y)^2=2(x^2+y^2)-(x+y)^2=2h^2-(p-h)^2.$$ Now we know $x-y$ and $x+y$, so as before we can find $x$ and $y$.

We can find one or more Pythagorean triples, if they exist, given only the hypotenuse, by testing a finite number of $$m$$ values to see which one(s) yield a positive integer for $$n$$.

$$\text{Given }C= m^2+n^2\quad \space n=\sqrt{C-m^2}\text { where }\biggl\lceil\sqrt{\frac{C}{2}}\space\space\biggr\rceil \le m\le\bigl\lfloor\sqrt{C}\bigr\rfloor$$

$$\text{For example: Given }C=65\quad \space n=\sqrt{65-m^2}\text { where }\biggl\lceil\sqrt{\frac{65}{2}}\space\space\biggr\rceil=6 \le m\le\bigl\lfloor\sqrt{C}\bigr\rfloor=8$$

$$\sqrt{65-6^2}\notin\mathbb{N}\qquad \text{so there is no f(6,n)}$$ $$\sqrt{65-7^2}=4\qquad f(7,4)=(33,56,65)$$ $$\sqrt{65-8^2}=1\qquad f(8,1)=(63,16,65)$$ From here, it is easy to pick out which has the right area.

OTOH, if you have $$only$$ the ratio $$(R)$$ of area to perimeter, you can find one or more triples, if it exists, by letting

$$n=\frac{m\pm \sqrt{m^2-8R}}{2}\text{ where }\lceil\sqrt{8R}\space \rceil \le m \le 2R+1$$

$$\text{Given }R=6\quad n=\frac{m\pm \sqrt{m^2-8*6}}{2}\text{ where }\lceil\sqrt{8*6}\space \rceil \le=7 m \le 2*6+1=13$$

$$f(7,4)=(33,56,65)\quad f(7,3)=(40,42,58)\quad f(8,6)=(28,96,100)\quad f(8,2)=(60,32,68)\quad f(13,12)=(25,312,313)\quad f(13,1)=(168,26,170)$$