Minimizing Integral - Euler-Lagrange

Consider the functional $I$ on the space of $C^1$-functions $y$ satisfying $y(-\infty)=0$ and $y(+\infty) = 2\pi$ defined by

$$ I(y) = \int_{-\infty}^{\infty} \left( \frac{y'(x)^2}{2} + 1 - \cos y(x) \right) \, dx. $$

By the Cauchy-Schwarz inequality, we have

\begin{align*} I(y) &\geq \int_{-\infty}^{\infty} 2\sqrt{ \frac{y'(x)^2}{2} (1 - \cos y(x)) } \, dx \\ &\geq \int_{-\infty}^{\infty} \sqrt{2(1-\cos y(x))} \cdot y'(x) \, dx \\ &= \int_{0}^{2\pi} \sqrt{2(1-\cos y)} \, dy = 8. \end{align*}

Now let us examine whether there is a function satisfying $I(y) = 8$. If this holds, then the above inequalities are saturated and hence yields equalities. By the equality condition of the Cauchy-Schwarz inequality, this implies that

$$ \frac{y'(x)^2}{2} = 1-\cos y(x) \qquad \text{and} \qquad y'(x) \geq 0, $$

which is then equivalent to

$$ y'(x) = \sqrt{2(1- \cos y(x))}. $$

This equation can be solved by the separation of variables technique to yield

$$ y(x) = 4\arctan(e^x). $$

With this function we obtain

$$ I(y) = \int_{-\infty}^{\infty} \frac{4}{\cosh^2 x} \, dx = 8. $$