What is the side length of smallest square which can embed a regular polygon with 2*n sides, where n is odd and n≥3. I am trying to solve problem. I have proved that the minimum side length should be greater than or equal to radius of the circum circle of given regular polygon(by contradiction). 
But I am not able to find what is the tight lower bound for it. I am curious to know if some formula can be formed for this problem or is it neccessary to use programming constructs like loops. 
Please share your approaches for this.
 A: Let $N = 2n$ where $n \ge 3$ is odd. 
Let's say we have a regular $N$-gon with circumradius $R = 1$ which fit inside  a square of side $s$. Choose a coordinate system where the circumcenter is origin and the sides of square are parallel to the coordinate axes. Reflect everything upside down if needed, one can find a $\theta \in [ 0, \frac{\pi}{N} ]$ so that one of the vertex of the $N$-gon is located at $(\cos\theta,\sin\theta)$. 
In terms of  $\theta$, the vertices of the $N$-gon will be located at
$(\cos\theta_k,\sin\theta_k)$ where  $\theta_k = \theta + \frac{2\pi k}{N}$ for 
$k = 0,\ldots, N - 1$. In order for the $N$-gon to fit inside a square of side $s$. The shadow when we project the $N$-gon to $x$- and $y$- axes will have width $\le s$.
It is clear the width of the shadow on $x$-axis is $2\cos\theta$.
The shadow on $y$-axis
is $[-\sin\theta_k,\sin\theta_k]$ for $k = \lfloor \frac{N}{4}\rfloor = \frac{n-1}{2}$. This leads to
$$s \ge 2 \max\left( \cos\theta, \sin\left(\theta  + \frac{\pi(n-1)}{2n}\right)\right) = 2\max\left(\cos\theta, \cos\left(\frac{\pi}{2n}-\theta\right)\right)$$
The minimum on RHS is achieved when $\theta = \frac{\pi}{2n} - \theta \iff \theta = \frac{\pi}{4n}$. This leads to
$$s \ge 2\cos\frac{\pi}{4n}$$
At $\theta =\frac{\pi}{4n}$, it is easy to see how to fit the $N$-gon
into an axes-aligned square of side $2\cos\frac{\pi}{4n}$. From this, we
can deduce:

The smallest square which contains a regular $N$-gon with circumradius $R$ has side $2R\cos\frac{\pi}{4n}$.

As an example, for $n = 3$, we can fit a hexagon with unit circumradius into 
a square of $2\cos\frac{\pi}{12} \approx 1.931851652578137$
