Examples: Fermat's principle in geometrical optics; variational method in quantum mechanics; the Einsteinâ€“Hilbert action and Palatini variation in general relativity; principle of least action in electromagnetism;

Paths to Lagrange's Equation, all assuming ideal constraints:

$$\begin{aligned} \text{Principle of Virtual Work} \Rightarrow \text{Lagrange-d'Alembert's Principle} &\Rightarrow \text{Lagrange's Equation} \\ \text{Hamilton's Principle} &\Rightarrow \text{Lagrange's Equation} \end{aligned}$$ Lagrange's Equation, Hamilton's Equations, and Newton's Second Law are equivalent.

Original notes on variational principles in mechanics.

On Encyclopedia of Math, also includes principle of least compulsion (Gauss' principle), principle of least curvature (Hertz' principle), Chetaev's principle of maximum wor;, Jourdain's principle; Lagrange's principle of stationary action, Jacobi's principle of stationary action.

For any virtual displacement of a system at equilibrium, the virtual work of external forces equals the virtual work of deformation.

$$\delta V = \delta W_\text{external}$$

In other words, equilibrium condition is equivalent to total virtual work being zero for all virtual displacements:

$$Q_j = 0~(j = 1, \cdots, s) \Leftrightarrow \sum_{i=1}^{n} \mathbf{F}_i \cdot \delta \mathbf{r}_i = 0$$

For a system of $n$ particles, where $\mathbf{F}_i$ is the total non-constraint force on the i-th particle:

$$\sum_{i=1}^{n} (\mathbf{F}_i - m_i \mathbf{a}_i) \cdot \delta \mathbf{r}_i = 0$$

For a system of $n$ particles in a 3-dimensional space, its kinetic energy: $T = \sum_{i=1}^n \frac{1}{2} m_i \mathbf{v}_i^2$.

The natural coordinates are subject to $k$ ideal constraints (never do work on the system): $f_i(x_1, \cdots, x_{3n}, t) = 0$.

Define components of non-constraint forces: $Q_j = \sum_{i=1}^{n} \mathbf{F}_i \cdot \frac{\partial \mathbf{r}_i}{\partial x_j}$, where $\mathbf{F}_i$ is the total force except constraint forces on the i-th particle.

Lagrange's equation of the first kind: For $j = 1, \cdots, 3n$, and Lagrangian coefficients $\lambda_i$, $$\frac{\text{d}}{\text{d}t} \frac{\partial T}{\partial \dot{x}_j} - \frac{\partial T}{\partial x_j} = Q_j + \sum_{i=1}^k \lambda_i \frac{\partial f_i}{\partial x_j}$$

The system has degree of freedom: $s = 3n - k$. With independent generalized coordinates $q_j$, $j = 1, \cdots, s$, define generalized forces: $Q_j = \sum_{i = 1}^{n} \mathbf{F}_i \cdot \frac{\partial \mathbf{r}_i}{\partial q_j}$.

Lagrange's equation of the second kind: For $j = 1, \cdots, s$, $$\frac{\text{d}}{\text{d}t} \frac{\partial T}{\partial \dot{q}_j} - \frac{\partial T}{\partial q_j} = Q_j$$

**Lagrangian** is kinetic energy plus virtual work of external forces: $L = T + W$.
If all forces are conservative and have a total potential: $V(\mathbf{r}_1, \cdots, \mathbf{r}_n) = V(q_1, \cdots, q_s, t)$,
then the Lagrangian equals kinetic energy minus potential energy: $L = T - V$,
and Lagrange's equation is simply:
$$\frac{\text{d}}{\text{d}t} \frac{\partial L}{\partial \dot{q}_j} - \frac{\partial L}{\partial q_j} = 0$$

**Action integral** is the time integral of Lagrangian: $S = \int_{t_1}^{t_2} L~\text{d}t$.

Of all variations, the dynamical path of a system will lead to a stationary value of the action integral: $$\delta S = \int_{t_1}^{t_2} \left(\delta T - \delta V + \overline{\delta W_\text{nc}}\right)~\text{d}t = 0$$ Here $W_\text{nc}$ is the work done by non-conservative forces.

For a system of $s$ degress of freedom, with independent generalized coordinates $q_i$
and generalized momentum $p_i = \frac{\partial L}{\partial \dot{q}_i}$,
**Hamiltonian** is the Legendre transformation of the Lagrangian: $H(\mathbf{q}, \mathbf{p}, t) = \sum_{i=1}^{s} p_i \dot{q}_i - L$.

$$\begin{aligned} \dot{q}_i &= \frac{\partial H}{\partial p_i} \\ \dot{p}_i &= - \frac{\partial H}{\partial q_i} \end{aligned}$$

Hamilton's Principle implies Minimum Total Potential Energy Principle and Minimum Total Complementary Energy Principle.

**Total potential energy** is deformation energy minus the work of non-conservative forces:
$\Phi = V - W_\text{nc}$.

$$\frac{\partial \Phi}{\partial q_i} = 0$$

**Total complementary energy** is the Legendre transformation of total potential energy, with respect to conjugate pairs of generalized coordinates and forces: $\Psi = q_s Q_s - V$.

$$\frac{\partial \Psi}{\partial Q_i} = 0$$