TITLE: Maximum area enclosure given side lengths
QUESTION [5 upvotes]: A peer of mine gave me the following problem :

Given a sequence of $n$ lengths (i.e.,$L_1, L_2, .., L_n$ ) where each is the length of the side, find a sequence of $n$ points (where $p_k = (x_k, y_k)$) such that $dist(p_k, p_{k+1}) = L_k$ and $dist(p_1, p_n) = L_n$ where $dist(a, b)$ is the Euclidean distance between points $a$ and $b$. 
Note that the first point , $p1$,  must be $(0, 0)$ and the second point , $p_2$,  must be $(0, L_1)$ . 
These points must correspond to the ordered clockwise vertices of the simple polygon having the maximum possible area for the given side lengths.
Determine the coordinates of the points that correspond to a polygon of maximal area.

Now, I've seen some similar problems, but this one I don't even know how to begin with. Determining the maximum area is quite easily done by Brahmagupta's formula, but the actual finding of the points seems really hard.
The only thing I could think of was finding some sort of enclosing circle and then trying to determine the points, but that's not even a starting point.
Any ideas on how to solve this?

REPLY [7 votes]: I'll add some remarks about the setup and solution for circumscribing diameter $d$, from which the maximum area (of the cyclic polygon) can be obtained.
(0) The case $n=3$ is directly solved by using Heron's formula for area of the triangle.  The case $n=4$ also has a direct solution, but it is less well-known.  For $n \gt 4$ we present an iterative approach (solution of a nonlinear equation).
(1) The order of the chord (polygon side) lengths does not affect the maximum area that the polygon can attain.  There is a nice proof of this by transposition of adjacent chords, showing that any permutation of sides in a cyclic polygon preserves area.
(2) Even if one specifies an order of the sides lengths $L_1,L_2,\ldots,L_n$, we can without loss of generality arrange (by rotation) that $L_1$ is the maximum of these.  Then the check $L_1 \lt \sum_{i=2}^n L_i$ guarantees the existence of a polygon with positive area.
(3) The diameter $d$ of the circle must be at least the maximum chord length $L_1$.  There are two distinguishable cases where the diameter strictly exceeds $L_1$.  Either the vertices all lie on a semicircle (and the circle's center is outside the polygon), or else the center of the circle will lie in the interior of the polygon.
(4) A good first step to solving for the radius (equiv. the diameter) of the circle distinguishes which of those arrangements is feasible.  For the sides $L_i$ with $i\gt 1$, define the sum of half the angles they will subtend in a circle of (yet undetermined) diameter $d$:
$$ \Theta(d) := \sum_{i=2}^n \sin^{-1} (L_i/d) $$
(5) If $\Theta(L_1) = \pi/2$, then $d=L_1$ is the solution, and besides the diameter chord $L_1$, the other chords are inscribed in its semicircle.
(6) If $\Theta(L_1) \lt \pi/2$, then the feasible $d$ will exceed $L_1$ but all the vertices will lie on a semicircle, with the longest chord $L_1$ bridging across the smaller chords.  The nonlinear equation to satisfy is then:
$$ \Theta(d) = \sin^{-1} (L_1/d) $$
(7) If $\Theta(L_1) \gt \pi/2$, then the feasible $d$ will exceed $L_1$ but not all the vertices will lie on a semicircle, and thus the circle's center will lie in the interior of the cyclic polygon.  Thus central angles subtend by the chords will thus add to $2\pi$, and in terms of our $\Theta(d)$ notation, the nonlinear equation to solve is:
$$ \Theta(d) = \pi - \sin^{-1} (L_1/d) $$
Example
Consider the lengths, arranged as above so that the longest length comes first:
$$ 10, 8, 2, 5, 6, 4, 8, 5, 4, 2 $$
The check $\Theta(10) \approx 4.771 \gt \pi/2$ tells us the vertices will wind around the center of the circle, so that per (7) the nonlinear equation to satisfy is:
$$ \sin^{-1}(L_1/d) + \Theta(d) = \pi $$
It simplifies the derivatives (needed for Newton's method) if we make the change of variable $z = L_1/d$, so the equation becomes:
$$ F(z) := \sin^{-1}(z) + \sum_{i=2}^n \sin^{-1}(\alpha_i z) = \pi $$
where $\alpha_i = L_i/L_1$.  For $z\in (0,1)$ we get its derivative:
$$ F'(z) = (1-z^2)^{-1/2} + \sum_{i=2}^n \alpha_i(1 - \alpha_i^2 z^2)^{-1/2} $$
Note that $F(z)$ is continuous, monotone increasing on $[0,1]$. Now $F(0) = 0$, and we also know as a result of the check $\Theta(10) \gt \pi/2$ that $F(1) \gt \pi$.  Therefore a root of $F(z) = \pi$ will exist "in between" by IVT.
Often one uses a step or two of a low-order convergent method such as bisection or secant method to "get close" to the root before applying a Newton method.  A bisection step amounts to checking $F(1/2) \approx 2.760 \lt \pi$, so our root search should be restricted to $z\in [1/2,1]$.
Since $F(1/2) \approx 2.760$ and $F(1) \approx 6.342$, a step of the secant method (linear interpolation) gives a root approximation near:
$$ z_0 = \frac{(1/2)(F(1)-\pi) - (1)(F(1/2)-\pi)}{F(1)-F(1/2)} \approx 0.5533 $$
which we adopt as an initial guess for Newton's method:
$$ z_{k+1} = z_k - \frac{F(z_k) - \pi}{F'(z_k)} $$
A table of a few subsequent iterates, calculated using Google Sheets, shows quick convergence:
$$ 
\begin{array}{c|c|c|c} 
k & z_k & F(z_k) & F'(z_k) \\
\hline 
1 & 0.5533006452 & 3.070530159 & 5.884332671 \\
2 & 0.5653772049 & 3.141749930 & 5.910562711 \\
3 & 0.5653505955 & 3.141592654 & 5.910503695 \\
4 & 0.5653505954 & 3.141592654 & 5.910503695
\end{array} $$
For Newton's method it is typical that iterates quickly settles down to approaching the limit from one side (as they did in this case). 
Recall that $z = L_1/d$ and thus $d = L_1/z \approx 17.68813915$.  Converting from diameter to radius gives $r \approx 8.844069575$.