# Hamiltonian time-invariance

Given a generic configuration space modelled on a Riemannian manifold $(Q$,$\langle , \rangle)$, I want to prove that the Hamiltonian is a constant of motion.

## Setup

The kinetic energy $K:TQ \to \mathbb{R}$ is given. by $K(p,v) := \frac{1}{2}\langle v,v \rangle_p$.

A potential energy function $V:Q \to \mathbb{R}$ is given.

Newton's Equations are:

$$\nabla_{\dot{q}} \dot{q} = -\nabla V, \ \text{where } \nabla \ \text{is given by the Levi Civita connection from } \langle , \rangle.$$

The Hamiltonian $H: TQ \to \mathbb{R}$ is then given by $$H(p,v) = K(p,v) + V(p).$$

I want to show that, along a curve $q:I\subset\mathbb{R} \to Q$ satisfying Newton's equations, we have $$\frac{d}{dt} H(q(t),\dot{q}(t)) = 0.$$

## Work

I will omit the argument $t$ in the following: \begin{align} \frac{d}{dt} H(q,\dot{q}) &= \frac{d}{dt} K(q,\dot{q}) + \frac{d}{dt}V(q) \\ &= \frac{1}{2} \frac{d}{dt} \langle \dot{q}, \dot{q} \rangle_q + dV(q)\Big(\frac{d}{dt}\Big) \\ &= \langle \nabla_{\frac{d}{dt}} \dot{q}, \dot{q} \rangle_q + \langle \nabla V, \frac{d}{dt} \rangle_q \\ &= \langle \nabla_{\frac{d}{dt}} \dot{q}, \dot{q} \rangle_q - \langle \nabla_{\dot{q}} \dot{q}, \frac{d}{dt} \rangle_q. \end{align}

However, I am not confident that in general $$\langle \nabla_B A,A \rangle - \langle \nabla_A A, B \rangle = 0,$$

so I think I may be forgetting something specific to these vector fields. Either that or I have made some mistake with notation.

You made some confusion, but your computations are almost correct. When you write $H(q,\dot{q})$ you implicitely have already passed to local coordinates $(q,\dot{q})$ on $TQ$. So you should write $\frac {d q} {dt}$ instead of $\frac d {dt}$, which is equal to $\dot{q}$. Also since the connection is compatible with the metric, you have that $\frac {d} {dt}\langle V,W\rangle = \langle D_t V,W\rangle + \langle V,D_t W\rangle$ where $D_t$ is the covariant derivative (in your case $D_t \dot q = \nabla_{\dot{q}} \dot{q}= -\nabla V$).
So the last row is $\langle D_t \dot{q}, \dot{q} \rangle_q - \langle \nabla_{\dot{q}} \dot{q}, \dot{q} \rangle_q = \langle\nabla_{\dot{q}} \dot{q}, \dot{q} \rangle_q - \langle \nabla_{\dot{q}} \dot{q}, \dot{q} \rangle_q = 0$.
For the sake of completeness, if you don't want to work in local coordinates you can use $\left. \cfrac {d}{dt} \right|_t (V\circ q) = d_{q(t)} V d_t q (\frac \partial {\partial t}|_t)$ where $d_t q (\frac \partial {\partial t}|_t)$ is the tangent vector identified with $\dot{q}(t)$.