So I have this integral $$ \int_{t_1}^{t_2} f(x,y)\sqrt{\dot{x}^2+\dot{y}^2} \text{ d}t, $$
where $x,y$ are functions of $t$ and $f$ is a function of just $x,y$. Also $\dot{x}$ denotes the first derivative of $x$ with respect to $t$. I am trying to study this type of integral and look for its extremas, depending on what $f$ is. The first thing I am wondering though is what is the reason for its vanishing Hamiltonian?
First we have the Lagrangian $L = f(x,y)\sqrt{\dot{x}^2+\dot{y}^2}$ which is just the integrand. Then the generalized momenta we get from that are $$ p_x = \frac{f(x,y)\dot{x}}{\sqrt{\dot{x}^2+\dot{y}^2}} \quad\text{and}\quad p_y = \frac{f(x,y)\dot{y}}{\sqrt{\dot{x}^2+\dot{y}^2}}. $$ And now we calculate the Hamiltonian to see that it is zero $$ H = p_x\dot{x} + p_y\dot{y} - L = 0. $$ I want to know what is the reason for this? I think it has something to do with the integrand's independence from $t$. But I'm not sure where to go from there.
This is due to the reparametrization invariance of the Lagrangian. Specifically, your Lagrangian has the property that if we rewrite it in terms of a new "time function" $\tau(t)$, then we have \begin{align*} \sqrt{ \left(\frac{dx}{dt}\right)^2 + \left(\frac{dx}{dt}\right)^2 } \, dt &= \left[ \frac{d\tau}{dt} \sqrt{ \left(\frac{dx}{d\tau}\right)^2 + \left(\frac{dx}{d\tau}\right)^2 } \right] \left[ \frac{dt}{d\tau} \, d\tau \right] \\&= \sqrt{ \left(\frac{dx}{d\tau}\right)^2 + \left(\frac{dx}{d\tau}\right)^2 } \, d\tau, \end{align*} since $(dt/d\tau)(d\tau/dt) = 1$. Thus, the Lagrangian does not change under this reparametrization $t \to \tau$.
The Hamiltonian for any Lagrangian which is parametrization-invariant is identically equal to zero. A nice proof of this can be found in this answer over on Physics.SE.