# Largest bounded square

Suppose I have a triangular land-plot, but some part of it (the yellow part) is unusable. I want to build a square house on the usable (white) part. The house may be rotated (but must be square). What is the maximum area I can build?

NOTES:

• Both triangles in the picture are right-angled and isosceles.
• When $0<y<1$, the white part is a quadrilateral whose angles are: 90, 135, 90, 45. Its area is $\frac{1+y(2-y)}{4}$.

EDIT (following a hint by Ross Millikan): We can get a lower bound by considering two possible locations: an axis-aligned square in the lower-left corner (pink), and a 45-degree-rotated square in the top corner (green):

• In the lower-left corner, the vertical side of the square can be at most $y$, and the diagonal can be at most $\sqrt{\frac{1}{2}}$, therefore the side can be at most $min(y,\frac{1}{2})$.
• In the top corner, the vertical diagonal can be at most $\frac{1}{2}(1+y)$, and the horizontal diagonal can be at most $1-y$, therefore the side can be at most $\sqrt{\frac{1}{2}} min (\frac{1}{2}(1+y),1-y)$. This expression is maximized when $y=\frac{1}{3}$, and the side length is $\sqrt{\frac{1}{2}} \frac{2}{3} \approx 0.47$. When $y>\frac{1}{3}$, a square at the top corner must become smaller because of the horizontal diagonal, but, we don't have to push the square towards the new top corner - we can leave it at its previous position $(\frac{1}{3},\frac{2}{3})$, and have the same side-length 0.47 .

The following graph (drawn by http://rechneronline.de/function-graphs/) shows the side lengths of both squares:

And the following graph shows the areas of both squares, relative to the area of the white part:

NOW, MY QUESTION IS: Is there a way to build a larger house (a larger bounded square)?

My intuition is that there must be a way. If in some cases the largest square is at 0 degrees, and in other cases the largest square is rotated at 45 degrees, then between these cases, there must be a way to build a square rotated between 0 to 45 degrees, with a larger area.

-
Where you wrote "equilateral", you meant "isosceles". An equilateral triangle is one where all three sides have equal length, such a triangle cannot be right-angled. An isosceles triangle is one with (at least) two sides of equal length. – Daniel Fischer Oct 27 '13 at 14:38
Thanks, I corrected the question. – Erel Segal-Halevi Oct 27 '13 at 14:39
@ErelSegalHalevi I think I found a case where it is profitable to rotate/stretch the square. As you surmise it's between the cases; please see my answer below. – coffeemath Oct 29 '13 at 14:29

If $y=\sqrt{2}-1 \approx 0.414$ the two maximal squares (flush with the left side and with the diagonal) have the same sidelengths. This was obtained by equating the two formulas in the range $(1/3,1/2)$ wherein they are respectively $y$ and $(1/\sqrt{2})(1-y).$ Note that this $y$ lies in $(1/3,1/2)$ as it should. Each of these squares can be realized with one corner at $(0,y),$ and a sketch reveals there is room to rotate either one of them a bit into the white region. After that one could expand the square.

I took the square aligned to the vertical, and supposed we kept its corner at $(0,y)$ and took another corner at $(z,0)$. Then the remaining two corners are at $(y+z,z)$ (the rightmost corner, tipped up from the $x$ axis) and at $(y,y+z)$ (the topmost corner). In order for these two corners to remain in the white region we need both $y+2z \le 1$ and $2y+z \le 1$. It seems clear the restriction from the upper corner will be the more restrictive, at least for small $z$. So I set $2y+z=1$ and got $$z=3-2\sqrt{2},\ y=\sqrt{2}-1,$$ giving the sidelength of $\sqrt{y^2+z^2}=\sqrt{20-14\sqrt{2}}$ or approximately $0.4483,$ which beats the $0.414$ from the aligned squares by a small amount.

By the way I did check the fourth corner is in the white area, since $y+2z=5-3\sqrt{2} \approx 0.757.$

To check that nothing has entered the yellow region, note that the angle of "rotation", that is, the angle $OYZ$ where $O=(0,0),Y=(0,y),Z=(z,0)$ is $\arctan(z/y)=\pi/8.$ This means the rotated square is situated so that its right angle cuts the 135 degree angle at $Y$ in half, with $45/2$ degrees on either side. Thus the angle made by the top side of the rotated square with the vertical is $22/2+90<135.$ So nothing has ended up in the yellow region.

ADDED: The OP has asked more generally about the "tipped square" case when $1/3<y<1/2.$ With the same square as above, having one corner at $(0,y)$ and another at $(z,0)$, we have again the other two corners at $(y+z,z)$ and $(y,y+z)$ where the latter is uppermost. For this upper point to lie on or below $x+y=1$ requires $2y+z\le 1$, so we just define $z=1-2y$ and check things. Note first that $z \ge 0$ since $y \in (1/3,1/2).$ We also need to check that the lower rotated corner $(y+z,z)$ lies below $x+y=1$, and with $z$ taken as $1-2y$ this condition is exactly $y>1/3$ so we're OK on that score.

Finally we need to check that the top side of the square has not rotated into the forbidden yellow area; this will be so iff $z/y \le 1$ since the rotation angle is $\arctan(z/y)$ and the angle from the vertical to the topmost vertex of the rotated square is $\pi/2+\arctan(y/x).$ Now $z/y<1$ becomes $y>1/3$ once $z=1-2y$ has been put in, so we now have checked all so as to show the stretched/rotated square lies entirely in the white region. Its sidelength is $$\sqrt{y^2+z^2}=\sqrt{5y^2-4y+1}.$$

It is interesting to look at the three graphs on the interval $(1/3,1/2)$ where all three bounds apply. That is, we graph each of $y,\ (1/\sqrt{2})(1-y),\ \sqrt{5y^2-4y+1}$ over $[1/3,1/2].$ We find that the third curve (which is the upper branch of a hyperbola) lies above each of the others in the interior of $[1/3,1/2]$ and agrees with the maximum of the first two at the two endpoints, and furthermore has the same tangents at those endpoints as may be checked via derivatives.

Conclusion: For $1/3<y<1/2$ we can always do better by a rotation/stretch from the "aligned squares" mentioned in thee question, and the above describes how much better at such $y$ values. We should emphasize that this is not a proof that some other orientation/choice of where the square is to be placed might beat this rotated one. A more general analysis would be necessary for that, and seems to me would be difficult even to set up conveniently.

-
Thanks! Can you give a formula for the largest side as a function of y in the range (1/3,1/2) ? This will nicely complement the two formulas that I calculated for the other ranges. – Erel Segal-Halevi Oct 29 '13 at 14:38
@ErelSegalHalevi I'll look into that, but my approach assumes one keeps $y$ where it is and picks another point $(0,z)$, however this approach may not give the optimal place either, since the tilted rectangle need not touch the bottom, or even have a vertex at $(0,y)$. Would that particular optimum be of interest, say for comparisons? [it would then give another lower bound for the overal max sidelength, which would presumably win out for $y \in (1/3,1/2).$] – coffeemath Oct 29 '13 at 16:52
@ErelSegalHalevi Please have a look in the answer above after "ADDED." Note the formula there is not a guaranteed largest side formula, but just another lower bound for it which beats the other two lower bounds you have mentioned in your post. – coffeemath Oct 30 '13 at 1:33
Please look at the new graph I created: i.stack.imgur.com/QyMPP.png Is this what you meant? – Erel Segal-Halevi Oct 30 '13 at 7:08
It goes horizontally because, as y grows, there is no need to "push" the square upwards in a way that will make it smaller, you can just leave it where it is. In general, as y grows the white part also grows, so the size of a bounded square must be non-decreasing. – Erel Segal-Halevi Oct 30 '13 at 18:32

Hint: You have two obvious orientations for the house. You can put it in the lower left corner, which allows a size of $\max (y,\frac 12)$ You can put it in the new right angle. One constraint on this location is the opposite corner must stay within the square. How high is the new right angle corner? The diagonal must be less than or equal to this. Also the left corner must not extend outside the square. How long is the new diagonal? Take the minimum of these, and compare with the first answer.

We have not shown that some other location isn't better.

-
Thanks, your hint gives a lower bound on the largest bounded square. I edited my question to reflect this. But, my intuition is that there can be a larger square, perhaps rotated in an angle between 0 and 45 degrees. Can you give my another hint, how to find this square? – Erel Segal-Halevi Oct 28 '13 at 9:52
Specifically, when y is between 1/3 and 1/2, none of the two squares you mention is tightly bounded by the white part, so, it seems in this range there must be a larger square. – Erel Segal-Halevi Oct 28 '13 at 10:06
I would be surprised if another orientation works, but your new figure suggests a new location: slide it horizontally along the bottom until it touches the two diagonals. Good work on the problem. These packing problems are often difficult. For a given configuration it is easy enough to calculate the largest square, but it is hard to prove that you have all the configurations considered. – Ross Millikan Oct 28 '13 at 13:11