Lagrangian Mechanics

Constraints

Imposing constraints on a system is simply another way of stating that there are forces present in the problem that cannot be specified directly, but are known in term of their effect on the motion of the system.  Holonomic constraints are constraints of the form
fm(r1,r2,r3,...,rn,t) = 0,   m = 1, 2 , 3, ... , k.
They reduce the number of degrees of freedom of the system;  k equations of constraints reduce the number of the degree of freedom of an n-particle system from 3n to 3n - k, if the constraints are holonomic.
If the constraints are holonomic, then the forces of constraints do no virtual work.
Consider a virtual displacement of the system, i.e. an infinitesimal change in the coordinates of the system, denoted by dri, consistent with the constraints imposed on the system at a given instant t.  The work done by the force in the virtual displacement dri is called the virtual work.  For holonomic constraints, the forces of constraints are perpendicular to the virtual displacements and do no virtual work.


Generalized coordinates

Any set of independent quantities q1, q2, ... , qs, which completely define the position of the system with s degrees of freedom, are called generalized coordinates of the system, and the derivatives  are called generalized velocities.
Examples:

The generalized coordinates q1, ... , qs can be expressed in terms of the Cartesian coordinates the system.
q1 = q1(r1, r2, ... , rn ), ... , qn-m(r1, r2, ... , rn ).
These equations, together with the equation of constraints, can be inverted to find the r's in terms of the q's.


Lagrangian Mechanics

Assume a system has n independent generalized coordinates {qi}.  Assume that the generalized applied forces
{Qj} = {∑iFi·ri/∂qj}
are given by
Qj = -∂U/∂qj  or  -∂U/∂qj + d/dt(∂U/∂(dqj/dt)),
with U some scalar function, i.e. the generalized applied forces are derivable from a potential.  Then the equations of motion may be obtained from Lagrange's equations,

d/dt(∂L/∂(dqi/dt)) -  ∂L/∂qi = 0,

where L = T - U is the Lagrangian of the system.  L is a function of the coordinates qi and the velocities dqi/dt.

Example of a velocity dependent potential

If not all the forces acting on the system are derivable from a potential, then Lagrange's equations can be written in the form

d/dt(∂L/∂(dqi/dt)) -  ∂L/∂qi = Qi,

where L contains the potential of the conservative forces and Qi represents the generalized forces not arising from a potential.

Link:  Derive Lagrange's equations from D'Alembert's Principle

Define the generalized momentum or conjugate momentum or canonical momentum through
∂L/∂(dqi/dt) = pi.
If the Lagrangian does not contain a given coordinate qj then the coordinate is said to be cyclic and the corresponding conjugate momentum pj is conserved.

The Hamiltonian H of a system is given by

H(q, p, t) = ∑i(dqi/dt)pi - L.  

H is a function of the generalized coordinates and momenta of the system.  The equations of motion can be obtained from Hamilton's equations,

dqi/dt = ∂H/∂pi,  dpi/dt = -∂H/∂qi.

Assume now that the generalized forces are given by Qj = -∂U/∂qj.


Lagrange multipliers

Assume you have chosen coordinate for a system that are not independent, but are connected by m equations of constraints of the form
Σkalk dqk + alt dt =  0,  l = 1, ..., m.
Then the equations of motion can be obtained from

d/dt(∂L/∂(dqk/dt)) -  ∂L/∂qk = ∑lλlalk,  (n equations),   Σkalk dqk + alt dt =  0  (m equations).

We have m + n equations and m + n unknowns, the n coordinates and the m λ's.  The λl are called the undetermined Lagrange multipliers,  ∑lλlalk is the generalized force of constraint associated with the coordinate qk.

Link:  Hamilton's principle and Lagrange multipliers