# How to find Hamiltonian from this simple Lagrangian? (tricky)

$$L~=~ \frac{1}{2} \dot{q} \sin^2{q}$$

Is it zero or not defined?

• One interesting point that nobody has pointed out: your action principle is obviously parametrization invariant. Any mechanics book will prove that this implies the hamiltonian must vanish. – ZachMcDargh Dec 12 '16 at 20:32
• The action is integrable: $$S = \Delta\left[\frac{ q}{4} - \frac{\sin(2q)}{8}\right].$$ – Sean E. Lake Dec 12 '16 at 20:37
• Reparametrization invariance only implies that the Hamiltonian is zero on-shell. In fact off-shell it is a Lagrange multiplier times a constraint. – Qmechanic Dec 13 '16 at 10:39

1. Legendre transformation. OP's question contains some subtle aspects that we would like to illuminate. Note that a Legendre transformation (singular or not) should be an involutive operation. (It would therefore be inconsistent to propose, say, that a Lagrangian, that leaves everything undetermined, should correspond to a Hamiltonian, that fixes everything. In particular, it is an oversimplification to claim that the Hamiltonian is identically zero.)

In this answer we give a consistent Legendre transformation in the framework of Dirac-Bergmann theory & constrained dynamics.

2. Lagrangian formulation. OP's Lagrangian reads $$L(q,v,t)~:=~ vf(q), \qquad f(q)~:=~\frac{\sin^2 q}{2}~\stackrel{(2)}{=}~F^{\prime}(q). \tag{1}$$ The corresponding action is invariant under time-reparametrizations. But even more strikingly, it is a boundary action: $$S[q]~=~\int_{t_i}^{t_f}\! dt~ L(q,\dot{q},t)~\stackrel{(1)}{=}~ F(q(t_f)) - F(q(t_i)), \qquad F(q)~:=~\frac{q}{4}- \frac{\sin 2q}{8}. \tag{2}$$ To have a well-defined variational problem, we should impose boundary conditions. We will assume Dirichlet boundary conditions $$q(t_i)~=~q_i \quad\text{and}\quad q(t_f)~=~q_f. \tag{3}$$ We see that the action (2) has an infinitesimal gauge symmetry of the form $$\delta q(t) ~=~\varepsilon(t)\quad\text{where}\quad \varepsilon(t_i)~=~0 \quad\text{and}\quad \varepsilon(t_f)~=~0.\tag{4}$$ The position $q$ is not a physical observable except for the boundary points. The Euler-Lagrange (EL) equation is identically satisfied. The Lagrangian momentum is $$p~=~\frac{\partial L}{\partial v}~=~f(q),\tag{5}$$ and the Lagrangian energy function $$h~=~pv-L~\stackrel{(1)+(5)}{=}~0\tag{6}$$ vanishes identically.

3. Hamiltonian formulation. According to the Dirac-Bergmann analysis, the eq. (5) is a primary constraint $$\chi~:=~p - f(q)~\approx~0.\tag{7}$$ In fact, eq. (7) is a first class constraint, which generates the gauge symmetry (4) via the Poisson bracket $$\delta ~=~\varepsilon \{ ~\cdot~, \chi\},\tag{8}$$ i.e. as a Hamiltonian vector field. The corresponding Hamiltonian action is $$S_H[q,p,\lambda]~=~\int_{t_i}^{t_f}\!dt~ L_H , \qquad L_H ~=~p\dot{q} - H, \tag{9}$$ with Hamiltonian $$H~:=~ \lambda \chi,\tag{10}$$ where $\lambda$ is an undetermined Lagrange multiplier, which imposes the constraint (7). The 3 EL equations for the Hamiltonian action (9) wrt. the 3 variables $\lambda$, $p$, and $q$ are Hamilton's equations $$\dot{p}~\approx~-\frac{\partial H}{\partial q}~=~\lambda f^{\prime}(q).\tag{11}$$ $$\dot{q}~\approx~\frac{\partial H}{\partial p}~=~\lambda, \tag{12}$$ and the constraint (7), respectively. Note that eq. (11) is a consequence of eqs. (7) & (12). Also note that the Hamiltonian (10) is zero on-shell. The fact that $\lambda$ is undetermined reflects the fact that $q$ is an unphysical gauge variable.

4. Comparison. We can complete the square of the Hamiltonian Lagrangian (9) as $$L_H ~= ~(p - f(q)) (\dot{q} - \lambda) + L(q,\dot{q},t).\tag{13}$$ Therefore if we integrate out the variables $p$ and $\lambda$ in the Hamiltonian action (13), we get back the original Lagrangian (1), which we started from. This is a consistency check that we have found the correct Hamiltonian formulation.

The Hamiltonian is undefined. Converting a Lagrangian to a Hamiltonian requires:

• Finding $$p$$
• Writing $$H=p\dot q-L$$
• Expressing $$H$$ in terms of $$p$$ and $$q$$, eliminating all dependence on $$\dot q$$.

For the third step to be possible, you need to be able to define a coordinate transformation between the $$(q,\dot q)$$ coordinate system and the $$(q,p)$$ coordinate system. This requires that $$(q,p)$$ is a good coordinate system, in that a state of the system can be uniquely represented by a pair of $$(q,p)$$ coordinates. In turn, this means that the transformation $$(q,\dot q)\rightarrow (q,p)$$ must have nonzero Jacobian.

However, it's easy to see this is not the case. We know that $$(q,p)=(q,\frac{1}{2}\sin^2 q)$$. Thus, the Jacobian is

$$J=\left|\begin{smallmatrix}1 & 0\\\sin(q)\cos(q) & 0\end{smallmatrix}\right| = 0$$

That means we CAN'T write $$p$$ as a function of $$q,\dot q$$, and there can't be a Hamiltonian $$H(p,q)$$ that is a function of only the coordinates $$(p,q)$$ because the coordinates $$(p,q)$$ don't specify the state of the system.

• Alternatively, notice that, if we actually substitute in $\dot q = dq/dt$ into the Lagrangian, we get an "action potential" $\phi(q(t))$ such that $L = \frac d{dt}(\phi(q(t)).$ The action integral is then $\int dt~\frac{d\phi}{dt} = \int d\phi = \phi(q(t_1)) - \phi(q(t_0))$ which is constant for all paths and this totally blows away any hope of doing variational calculus with said action principle. – CR Drost Dec 12 '16 at 5:34

The Lagrangian given is homogeneous of degree $$\color{red}{1}$$ in $$\dot{q}$$, that is, $$L(q,\lambda\dot{q})=\lambda L(q,\dot{q})$$ for any $$\lambda>0$$. Thus by Euler's homogeneous function theorem, we have

$$\dot{q}\frac{\partial L}{\partial\dot{q}}=\color{red}{1}\cdot L=L\implies\dot{q}\frac{\partial L}{\partial\dot{q}}-L=0$$

Hence the Hamiltonian vanishes identically.