This problem is different from testing if one rect is in another rect.
Known information is the sides length of two rects.
How to calculate if one rect can be pu
You can weed out the two simple cases fairly easily:
The hard part is working out whether it can fit in at an angle such as in your sketch. I don't know of a simple formula -- it probably requires a plug-and-chug solution.
Might be a good question for the Mathematics Stack Exchange site.
Added: I'm not 100% sure if this, but I think that if the hypotenuse of the second is smaller than the hypotenuse of the first then it will fit.
Oops: Nope -- I'll take that back. But if the hypotenuse of the second is larger than the hypotenuse of the first it won't fit.