Deriving Lagrange’s equations and introducing the Lagrangian
In my previous post here, I introduced generalized coordinates q_j, virtual displacements \delta \mathbf r_i, d’Alembert’s principle, and generalized forces Q_j. Now, I will use these concepts to derive Lagrange’s equations of motion.
Transforming the kinetic term
D’Alembert’s principle states:
\sum_{i=1}^N (\mathbf F_i - m_i \mathbf a_i) \cdot \delta \mathbf r_i = 0
I previously expressed the first part, \sum_i \mathbf F_i \cdot \delta \mathbf r_i, as \sum_j Q_j \delta q_j. Now I focus on the second part, the kinetic term: \sum_i m_i \mathbf a_i \cdot \delta \mathbf r_i.
Through a series of calculus manipulations involving the particle velocity \mathbf v_i = \dot{\mathbf r}_i and the system’s total kinetic energy T = \sum_i \frac{1}{2} m_i \mathbf v_i^2, it’s possible to show that:
m_i \ddot{\mathbf r}_i \cdot \frac{\partial \mathbf r_i}{\partial q_j} = \frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T_i}{\partial \dot q_j} \right) - \frac{\partial T_i}{\partial q_j}
Where T_i is the kinetic energy of particle i. Substituting \delta \mathbf r_i = \sum_j \frac{\partial \mathbf r_i}{\partial q_j} \delta q_j into the kinetic term and summing over all particles i gives:
\sum_i m_i \mathbf a_i \cdot \delta \mathbf r_i = \sum_i \sum_{j=1}^n \left( m_i \ddot{\mathbf r}_i \cdot \frac{\partial \mathbf r_i}{\partial q_j} \right) \delta q_j = \sum_{j=1}^n \left( \frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T}{\partial \dot q_j} \right) - \frac{\partial T}{\partial q_j} \right) \delta q_j
Here, T = \sum_i T_i is the total kinetic energy of the system.
Lagrange’s Equations: first form
Substituting the expressions for both parts back into d’Alembert’s principle:
\sum_{j=1}^n Q_j \delta q_j - \sum_{j=1}^n \left( \frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T}{\partial \dot q_j} \right) - \frac{\partial T}{\partial q_j} \right) \delta q_j = 0
Since the virtual displacements \delta q_j are independent and arbitrary, the coefficient of each must be zero. This yields the first form of Lagrange’s equations:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T}{\partial \dot q_j} \right) - \frac{\partial T}{\partial q_j} = Q_j \quad \text{for } j = 1, \ldots, n
These equations relate the change in kinetic energy with respect to generalized coordinates and velocities to the generalized forces.
Conservative systems and the Lagrangian
Now consider the important case where all applied forces are conservative, meaning they can be derived from a potential energy function V(\mathbf r_1, \ldots, \mathbf r_N, t). In this situation, the generalized force Q_j is given by:
Q_j = -\frac{\partial V}{\partial q_j}
Substituting this into the first form of Lagrange’s equations gives:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T}{\partial \dot q_j} \right) - \frac{\partial T}{\partial q_j} = -\frac{\partial V}{\partial q_j}
Typically, potential energy V depends on positions q_j (and possibly time t) but not on generalized velocities \dot q_j. Therefore, \frac{\partial V}{\partial \dot q_j} = 0. We can add \frac{\mathrm d}{\mathrm d t} (\frac{\partial V}{\partial \dot q_j}) = 0 to the left side without changing the equation:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial T}{\partial \dot q_j} \right) - \frac{\mathrm d}{\mathrm d t} \left( \frac{\partial V}{\partial \dot q_j} \right) - \frac{\partial T}{\partial q_j} + \frac{\partial V}{\partial q_j} = 0
This allows combining terms:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial (T-V)}{\partial \dot q_j} \right) - \frac{\partial (T-V)}{\partial q_j} = 0
This structure motivates defining a new function called the Lagrangian, \mathcal L:
\mathcal L = T - V
Using the Lagrangian, Lagrange’s equations for conservative systems take their standard, elegant form:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial \mathcal L}{\partial \dot q_j} \right) - \frac{\partial \mathcal L}{\partial q_j} = 0 \quad \text{for } j = 1, \ldots, n
These n second-order differential equations describe the system’s dynamics entirely through the scalar function L.
If non-conservative forces Q_j^{(nc)} are also present, the equations become:
\frac{\mathrm d}{\mathrm d t} \left( \frac{\partial \mathcal L}{\partial \dot q_j} \right) - \frac{\partial \mathcal L}{\partial q_j} = Q_j^{(nc)}
where \mathcal L = T - V still uses the potential V for the conservative forces only.
For more insights into this topic, you can find the details here.