Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Consider the square $S = [-1,1]\times[-1,1]$. Suppose we put a smaller square inside it, which is rotated with an angle $\alpha$ relative to the large square. What is the largest such square that does not contain the origin in its interior?

When $\alpha=0$, the answer is obvious: the maximal side-length is $1$. Every square with side-length larger than 1 must contain the origin in its interior. But when $\alpha>0$, it seems that the maximal side-length is smaller, and I don't know how to calculate it.

share|cite|improve this question
Have you considered how the angle $\alpha$ causes the alternate-corner angle to change relative to the outer circle? In particular, it may be helpful to consider the angle $\alpha$ compared to the angle from the inner square interior corner to the outermost corner to the outer square center. – abiessu Oct 6 '13 at 17:22
I meant square in all cases, not circle... – abiessu Oct 6 '13 at 17:27
up vote 1 down vote accepted

Draw a line with slope $\alpha\in\ ]0,{\pi\over4}] $ through the origin. A largest square tilted by $\alpha$ not containing $(0,0)$ in its interior is the square with two vertices on this line and the other two vertices on the lines $x=-1$, $\>y=1$. Denote the side of this square by $s$. Looking at the upper rim of the figure we see that the following equation holds: $$s\cos\alpha+{s\over\sin\alpha}=1+\cot \alpha\ .$$ This leads to $$s={\cos\alpha+\sin\alpha\over 1+\cos\alpha\sin\alpha}\ .$$ enter image description here

share|cite|improve this answer
"Looking at the upper rim of the figure..." what rim of what figure? – Erel Segal-Halevi Oct 18 '13 at 12:49
Ah, I see now. Thanks! – Erel Segal-Halevi Oct 19 '13 at 17:52

OK, this is my current attempt of an answer:

Consider a square that is pushed towards to top-right corner of $S$. The coordinates of this square are (where $c:=cos(\alpha)$ and $s:=sin(\alpha)$):

  • T (top): $(1-dc,1)$
  • R (right): $(1,1-ds)$
  • B (bottom): $(1-ds,1-dc-ds)$
  • L (left): $(1-dc-ds,1-dc)$

Due to symmetry, it is sufficient to study the range: $0 < \alpha < \frac{\pi}{4} $ , where $0<s<c<1$.

Now, an method for deciding if a point is in polygon can be used to decide if $(0,0)$ is in the given square, as a function of $d$.

Using the ray-crossing method, we have to consider a ray from the origin, and check how many times this ray crosses the sides of the above square. If the number is odd, then the origin is inside the square.

Consider, as a ray, the negative y axis.

Assume that $d<1$. In this case, T R and L are all above the origin, therefore the ray cannot cross the lines LT and TR. Additionally, T R and B are all to the right of the origin, therefore the ray also cannot cross the lines TR and RB.

It remains to check whether the negative y axis crosses the side LB, i.e., the y coordinate of the origin is above the line LB. The equation of the side LB is:

$$ cy(x) = (c+s-d-dsc)-sx $$ $$ where: x \in [1-ds-dc,1-ds] $$

If we substitute $x=0$, we get:

$$ cy(0) = c+s-d-dsc $$

If this number is negative, then the origin is above the side LB, and the origin is inside the square. The condition for this is:

$$ c+s-dc^2-dsc-ds^2 < 0 $$ $$ d > \frac{c+s}{1+sc} $$

(An alternative way to reach at the same solution is described in Robert Israel's answer).

You can plot that function here, using this line:


The minimum is at: $\alpha=\pi/4$, where the lower bound is approximately: $d>0.943$.

To conclude: a square with $d\geq 1$ always contains the origin.

share|cite|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.