# A square covering a rectangle

You are given a rectangle with base b and height h with $$h>b>0$$. What is the minimum side length of a square, which completely covers this rectangle?

• Must the sides of the square and rectangle be parallel to each other? – bobble Apr 7 at 20:55
• @bobble I would say not, otherwise this is very easy. – hexomino Apr 7 at 20:57
• the side length of the square and rectangle must not necessarily be parallel. – ThomasL Apr 7 at 21:19
• @Bass Is the solution obvious? There seems to be quite a difference between the solutions where h/b is close to 1 and far from 1 and I can't immediately see what happens in between or where the tipping point would be. Maybe I'm not very good at visualising this type of problem – hexomino Apr 7 at 21:21

I think it is:

$$\min( \frac {h+b} {\sqrt 2}, h)$$

Proof of optimality:

An optimal cover can always be chosen to have the centroids of the rectangle and the covering square aligned. Because by rotational symmetry of the rectangle the covering square rotated by 180° around the centroid of the rectangle will also cover, hence will the intersection of the original and the rotated square, and this will be a symmetric around the centroid of the rectangle.

Because of axial symmetry of the rectangle the mirror image of the covering square must also cover. We will now show that a non multiple of 45° cannot do better than what we've done in figure 1.
We will focus on the first quadrant and the corner there. Because the rectangle is assumed to be tall we need only check above the diagonal. Because of mirror symmetry we can assume the corner of the square in the first quadrant is below the diagonal in other words the rotation relative to the ortho sonfiguration is clock wise and smaller than 45°. It is easily verified that in this configuraton the relavant side of the square will intersect the corresponding side of the ortho square farther left than the 45° square and from there rise at a shallower slope. Hence in the first quadrant this side of the square will lie inside the union of the ortho and 45° squares meaning it cannot improve on them.

UPDATE: Another visualisation of proof:

$$h$$, if $$\frac{b}{h} >= \sqrt{2}-1$$, and

$$\frac{h+b}{\sqrt{2}}$$ otherwise.

Proof by handwaving:

The minimal square will pass through all the corners of the rectangle. If it doesn't, we can rotate the rectangle inside the covering square, and gain a smaller covering square.

There are two ways to place a rectangle inside a square like that: with the edges parallel, and with the edges at a 45° angle. (The diagonals of the rectangle must be at the same angle wrt. the edges they touch, or else they span a non-square shape.)

The diagonals of the possible minimal covering squares are then

$$\sqrt{2}h$$ and $$h+b$$

which gives both the boundary values and the areas.