How to find the dimensions of a rectangle given a) the area and the diagonal or b) the perimeter and the diagonal

2.5k Views Asked by At

I need to write concise formulas of these two:$\space \space \space$ $(1)$ finding the dimensions of a rectangle given the Area and the diagonal $\space \space \space$$(2)$ finding the dimensions of a rectangle given the Perimeter and the diagonal

Searching on google I can only find examples using number (eg. “Let’s assume the diagonal is $5$ and the area is $25$”etc) but I’m having trouble writing down formulas that use variables (so that I can use them in my code).

Would appreciate if someone could show me how to formulate the formulas (no pun intended) for these two. Thank you!

1

There are 1 best solutions below

5
On BEST ANSWER

Let the dimensions of rectangle be $a$ and $b$ and let the Area be $A$, perimeter be $P$ and the diagonal be $D$ $$A=ab$$ $$D=\sqrt{a^2+b^2}$$ $$D^2=a^2+b^2$$ $$D^2=(a+b)^2-2ab=(a+b)^2-2A$$ $$a+b=\sqrt{D^2+2A}$$ Now $b=\dfrac{A}{a}$ $$a+\dfrac{A}{a}=\sqrt{D^2+2A}$$ $$a^2-a\sqrt{D^2+2A}+A=0$$ Now this is a quadratic equation in the form of $a$. Hence solving it gives $$a=\dfrac{\sqrt{D^2+2A}\space\pm\sqrt{D^2+2A-4A}}{2}=\dfrac{\sqrt{D^2+2A}\space\pm\sqrt{D^2-2A}}{2}$$ $$b=\dfrac{2A}{\sqrt{D^2+2A}\space\pm\sqrt{D^2-2A}}$$ The perimeter method $$P=2(a+b)$$ $$b=\dfrac{P-2a}{2}$$ $$D^2=a^2+b^2=a^2+\Big(\dfrac{P-2a}{2}\Big)^2$$ $$8a^2-4aP-4D^2+P^2=0$$ Now this is a quadratic equation in the form of $a$. Hence solving it gives $$a=\dfrac{P\pm \sqrt{8D^2-P^2}}{4}$$ $$b=\dfrac{P\mp \sqrt{8D^2-P^2}}{4}$$