Find the size of inner rectangle rotated 45 degrees within another rectangle

rectanglesrotationstrigonometry

As picture, when rotation is 45 degrees, there are multiple combinations of w and h, but if the ratio w/h is known, how do I calculate the size of inner rectangle? Thanks.

P.S. the pink one is a square.

enter image description here

Best Answer

From the figure provided, one can write

$ s = \dfrac{1}{\sqrt{2}} (h + w ) $

Suppose $ \dfrac{w}{h} = r $ a given ratio, then

$ \sqrt{2} s = h (1 + r) $

From which

$ h = \dfrac{\sqrt{2}}{1+r} s $

and

$ w = \dfrac{\sqrt{2}\hspace{3pt} r}{1 + r} s $