Let $f:[0,\pi]\to [0,\pi]$ be a diffeomorphism. How to prove that
$$P[f]:=\int_0^\pi \sin^2(x) \left(3+2 \frac{\sin^2(f(x))}{\sin^2 x}+(f'(x))^2\right)^2dx $$ attains its minimum for $f(x)\equiv x$?
Let $f:[0,\pi]\to [0,\pi]$ be a diffeomorphism. How to prove that
$$P[f]:=\int_0^\pi \sin^2(x) \left(3+2 \frac{\sin^2(f(x))}{\sin^2 x}+(f'(x))^2\right)^2dx $$ attains its minimum for $f(x)\equiv x$?
The following SymPy script
from sympy import *
x = Symbol('x')
f = Function('f')(x)
# define Lagrangian
L = (sin(x))**2 * (3 + 2*((sin(f))**2/(sin(x))**2) + (Derivative(f,x))**2)**2
# Euler-Lagrange equation
print euler_equations(L,f,x)
produces the output
[Eq(-4*(2*(Derivative(f(x), x)*Derivative(f(x), x, x) + 2*sin(f(x))*cos(f(x))*Derivative(f(x), x)/sin(x)**2 - 2*sin(f(x))**2*cos(x)/sin(x)**3)*sin(x)*Derivative(f(x), x) + (Derivative(f(x), x)**2 + 3 + 2*sin(f(x))**2/sin(x)**2)*sin(x)*Derivative(f(x), x, x) + 2*(Derivative(f(x), x)**2 + 3 + 2*sin(f(x))**2/sin(x)**2)*cos(x)*Derivative(f(x), x))*sin(x) + 8*(Derivative(f(x), x)**2 + 3 + 2*sin(f(x))**2/sin(x)**2)*sin(f(x))*cos(f(x)), 0)]
Using function latex
to print the output in a more friendly form, we obtain the scary-looking ODE
$$\left(- 4 \left(2 \frac{d}{d x} f{\left (x \right )} \frac{d^{2}}{d x^{2}} f{\left (x \right )} + \frac{4 \frac{d}{d x} f{\left (x \right )}}{\sin^{2}{\left (x \right )}} \sin{\left (f{\left (x \right )} \right )} \cos{\left (f{\left (x \right )} \right )} - \frac{4 \sin^{2}{\left (f{\left (x \right )} \right )}}{\sin^{3}{\left (x \right )}} \cos{\left (x \right )}\right) \sin{\left (x \right )} \frac{d}{d x} f{\left (x \right )} - 4 \left(\frac{d}{d x} f{\left (x \right )}^{2} + 3 + \frac{2 \sin^{2}{\left (f{\left (x \right )} \right )}}{\sin^{2}{\left (x \right )}}\right) \sin{\left (x \right )} \frac{d^{2}}{d x^{2}} f{\left (x \right )} - 4 \left(2 \frac{d}{d x} f{\left (x \right )}^{2} + 6 + \frac{4 \sin^{2}{\left (f{\left (x \right )} \right )}}{\sin^{2}{\left (x \right )}}\right) \cos{\left (x \right )} \frac{d}{d x} f{\left (x \right )}\right) \sin{\left (x \right )} + \left(8 \frac{d}{d x} f{\left (x \right )}^{2} + 24 + \frac{16 \sin^{2}{\left (f{\left (x \right )} \right )}}{\sin^{2}{\left (x \right )}}\right) \sin{\left (f{\left (x \right )} \right )} \cos{\left (f{\left (x \right )} \right )} = 0$$
If we make $f (x) := x$, we obtain the following equation
$$ - \left(16 x + 40\right) \cos{\left (x \right )} \sin{\left (x \right )} + \left(16 x + 40\right) \sin{\left ( x\right )} \cos{\left (x \right )} = 0$$
which holds for all $x$. Hence, $f (x) = x$ is a solution to the Euler-Lagrange ODE and, thus, it makes the functional stationary. Proving that it minimizes the functional is left as an exercise for the reader.