Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Given two rectangles $R_1(l_1, b_1)$ and $R_2(l_2, b_2)$ where $l$ and $b$ are their length and breadth respectively, how to check if $R_1$ can fit inside $R_2$ or vice versa.

If $R_1$ and $R_2$ lie in the same plane and there exists an orientation of $R_1$ such that it lies completely inside $R_2$, then $R_1$ fits inside $R_2$.

share|improve this question
Nice question. The rectangle $R_1$ rotated by $\theta$ radians fits in an axis-aligned box of length $l_1\lvert\cos\theta\rvert+b_1\lvert\sin\theta\rvert$ and width $l_1\lvert\sin\theta\rvert+b_1\lvert\cos\theta\rvert$. So you want to determine whether there is any $\theta$ such that these are less than $l_2$ and $b_2$ respectively. Of course, one can restrict $\theta$ to $[0,\pi/2]$ and drop the absolute value signs. This leaves you with inequality constraints on a couple of trigonometric functions, and I don't feel like working it out after that... –  Rahul Sep 3 '12 at 12:05
This reminds me of a story where a train allowed only items of a max length/breadth/depth, so to get his over-long umbrella onto the train the passenger put it into a box. –  binn Sep 3 '12 at 12:55

1 Answer 1

up vote 2 down vote accepted

Look at: http://www.jstor.org/stable/2691523

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.