# Calculate width and height of a rectangle, given its diagonal and ratio

Well, I know, it's easy. We did it in class some time ago and I forgot it, I'm stupid because I can't figure it out:

E.g. I have a 32" TV with 16:9 ratio and I want to know its width and height.

I'd like to know the whole derivation so I can understand it (again) ...

You use the Pythagorean theorem like so: your diagonal's 32 inches and you know the aspect ratio of your legs; that nets you $(16x)^2+(9x)^2=(32)^2$... –  Ｊ. Ｍ. Sep 11 '11 at 20:59
Suppose that the unknown width and height are $x$ and $y$, and you’re given a diagonal $d$ and a ratio $m:n$ of width to height. That ratio means that the width is $\frac{m}{n}$ times the height, so you know that $x=\frac{m}{n}y$. You get a second relationship between $x$ and $y$ from the Pythagorean theorem: $x$, $y$, and $d$ are the lengths of the two legs and the hypotenuse of a right triangle, so $x^2+y^2=d^2$.
Now substitute $\frac{m}{n}y$ for $x$ in this second equation to get $\displaystyle\left(\frac{m}{n}y\right)^2 + y^2 = d^2$. Simplifying this, you get in turn $$\frac{m^2}{n^2}y^2 + y^2 = d^2,$$ $$\left(\frac{m^2}{n^2}+1\right)y^2 = d^2,$$ $$\left(\frac{m^2+n^2}{n^2}\right)y^2=d^2,$$ and $$(m^2+n^2)y^2=d^2n^2.$$. Finally, solve for $y$: $\displaystyle y^2 = \frac{d^2n^2}{m^2+n^2}$, so $y=\displaystyle\frac{dn}{\sqrt{m^2+n^2}}$. Once you have a numerical value for $y$, you can plug it into $x=\frac{m}{n}y$ to get $x$. (Or you can do that symbolically: $\displaystyle x=\frac{m}{n}\cdot \frac{dn}{\sqrt{m^2+n^2}} =$ $\displaystyle\frac{dm}{\sqrt{m^2+n^2}}$.