Solution (source code)

= Solution

At an area critical point the assumed first-variation identity holds for every smooth $\varphi$ compactly supported where $\kappa_g\ne0$:
$$
0=\int_0^L\kappa_g^{-1}\dot\varphi\,ds
=-\int_0^L(\kappa_g^{-1})'\varphi\,ds.
$$
The <fundamental lemma of the calculus of variations> gives
$(\kappa_g^{-1})'=0$ on each component of $\{\kappa_g\ne0\}$. Thus $\kappa_g$ is constant there. A nonzero constant component cannot have a boundary point where continuity makes $\kappa_g=0$. Since the closed curve is connected, either $\kappa_g\equiv0$ or it is one nonzero constant everywhere. Therefore every area-maximizing curve has constant geodesic curvature.