Square the Sector

I would like to find the largest possible square that fits in a sector of a circle with radius $r$ and arc length $\theta \leq \pi$. Method doesn't matter here - a straightedge-and-compass construction is just as good as a set of coordinate equations.

• For $\theta\ge\pi$ take the square with side length $\frac{2}{\sqrt 5}r$ and the circle center on the middle of one side. (Why is this maximal?) Commented Mar 30, 2014 at 21:48
• Well, yes. The application I'm using this for is exclusively $\theta \leq \pi$, though. Thanks anyway? Commented Mar 30, 2014 at 22:06

I assume you mean the angle is $\theta$ (the length of the arc would be $r\theta$). I'll suppose $0 < \theta < \pi/2$. There are two plausible configurations:
Unless I've made an error, in the first configuration the side length $a$ of the square is $a_1 = \dfrac{1}{\sqrt{2\tan^2(\theta) + 2 \tan(\theta) + 1}}$. In the second it is $a_2 = \dfrac{1}{\sqrt{3 + 2 \sin(\theta) - 2 \cos(\theta)}}$. It seems that $a_2 > a_1$ for all $\theta$ in this interval.
• (1) In addition, a proof is needed to show that the maximum is not reached in any other than these two "plausible" configurations. (2) For small $\theta$, the second configuration is clearly better than the first. Commented Mar 30, 2014 at 23:26