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.
2 Answers
Comments to the question (v2):
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:
P.A.M. Dirac, Lectures on QM, (1964).
M. Henneaux and C. Teitelboim, Quantization of Gauge Systems, 1994.

- 201,751
-
- P.A.M. Dirac, Can. J. Math. 2 (1950) 129.
– Qmechanic Apr 15 '16 at 14:54
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 $

- 3,109