# Hamiltonian from a Lagrangian with constraints?

Let's say I have the Lagrangian: $$L=T-V.$$ Along with the constraint that $$f\equiv f(\vec q,t)=0.$$ We can then write: $$L'=T-V+\lambda f.$$ What is my Hamiltonian now? Is it $$H'=\dot q_i p_i -L'~?$$ Or something different? I have found at least one example where using the above formula gives a different answer then the Hamiltonian found by decreasing the degrees of freedom by one rather then using Lagrange multipliers.

To go from the Lagrangian to the Hamiltonian formalism, one should perform a (possible singular) Legendre transformation. Traditionally this is done via the Dirac-Bergmann recipe/cookbook, see e.g. Refs. 1-2. Note in particular, that the constraint $f$ may generate a secondary constraint

$$g ~:=~ \{f,H^{\prime}\}_{PB} +\frac{\partial f}{\partial t}~\approx~\frac{d f}{d t}~\approx~0.$$

[Here the $\approx$ symbol means equality modulo eqs. of motion or constraints.]

References:

1. P.A.M. Dirac, Lectures on QM, (1964).

2. M. Henneaux and C. Teitelboim, Quantization of Gauge Systems, 1994.

The Hamiltonian is defined by $$H = \sum_{i=1}^n \left( \frac{\partial L}{\partial \dot q_i} \dot q_i \right) - L$$ So in your case: $H' = H - \lambda f$