Skip to content
QFT.org

Search QFT.org

Enter a word or phrase.

    You can also browse the main navigation and chapter contents.

    Lagrangian and Hamiltonian Mechanics

    A force that pulls to the right shifts a spring’s equilibrium to the right. That prediction checks the sign of a source both in the equation of motion and in the Hamiltonian. Begin with a real displacement q(t)q(t), mass M>0M>0, frequency ω0>0\omega_0>0 and prescribed force J(t)J(t). A dot denotes a time derivative. Varying the motion will use the product rule and integration by parts.

    L(q,q˙,t)=M2(q˙2−ω02q2)+J(t)q,S[q]=∫titfL dt.L(q,\dot q,t)=\frac M2\left(\dot q^2-\omega_0^2q^2\right)+J(t)q, \qquad S[q]=\int_{t_i}^{t_f}L\,\mathrm dt.

    LL is the Lagrangian and SS the action. The notation S[q]S[q] emphasizes that the input is a whole trajectory. The force enters with the positive action-source sign. Source conventions

    Vary a trajectory with fixed endpoints

    Compare q(t)q(t) with q(t)+ϵη(t)q(t)+\epsilon\eta(t), where ϵ\epsilon is a small real parameter and the smooth function η\eta vanishes at tit_i and tft_f. Compute the coefficient of ϵ\epsilon in S[q+ϵη]S[q+\epsilon\eta]. Keep the endpoint term visible until using the endpoint condition. Which equation makes this coefficient vanish for every allowed η\eta?

    Solution

    The velocity changes by ϵη˙\epsilon\dot\eta. Expanding both squares and differentiating at ϵ=0\epsilon=0 gives

    δS=∫titf(Mq˙η˙−Mω02qη+Jη)dt.\delta S=\int_{t_i}^{t_f} \left(M\dot q\dot\eta-M\omega_0^2q\eta+J\eta\right)\mathrm dt.

    Integration by parts moves the derivative from η\eta to q˙\dot q:

    δS=[Mq˙ η]titf+∫titf[−Mq¨−Mω02q+J]η dt.\begin{aligned} \delta S={}&[M\dot q\,\eta]_{t_i}^{t_f}\\ &+\int_{t_i}^{t_f} \left[-M\ddot q-M\omega_0^2q+J\right]\eta\,\mathrm dt. \end{aligned}

    The bracket vanishes because η\eta is zero at both endpoints. The endpoint velocities can be arbitrary. The remaining coefficient must vanish everywhere: if it did not, a variation supported in a small interval could make the integral nonzero. Thus

    M(q¨+ω02q)=J(t).M\left(\ddot q+\omega_0^2q\right)=J(t).

    The restoring force is −Mω02q-M\omega_0^2q, and JJ is the external force. “Stationary action” refers to this vanishing first-order change. A minimum also requires control of higher orders.

    To recover the sign, expand the product derivative d(q˙ η)/dt=q¨ η+q˙ η˙\mathrm d(\dot q\,\eta)/\mathrm dt=\ddot q\,\eta+\dot q\,\dot\eta before dropping any terms. The same calculation for any differentiable L(q,q˙,t)L(q,\dot q,t) gives the Euler–Lagrange equation

    ddt∂L∂q˙−∂L∂q=0,\frac{\mathrm d}{\mathrm dt}\frac{\partial L}{\partial\dot q} -\frac{\partial L}{\partial q}=0,

    qq and q˙\dot q are treated as independent arguments while taking the partial derivatives. They become a trajectory and its velocity when evaluating the result. Holding q˙\dot q fixed in ∂L/∂q\partial L/\partial q is therefore meaningful.

    Replace velocity by momentum

    The momentum conjugate to qq is p=∂L/∂q˙p=\partial L/\partial\dot q. Find the Hamiltonian H=pq˙−LH=p\dot q-L as a function of q,p,tq,p,t, with no q˙\dot q left. Check the two equations

    q˙=∂H∂p,p˙=−∂H∂q.\dot q=\frac{\partial H}{\partial p},\qquad \dot p=-\frac{\partial H}{\partial q}.
    Solution

    Here p=Mq˙p=M\dot q, which can be inverted because M>0M>0. Substitution gives

    H(q,p,t)=p22M+Mω02q22−J(t)q.H(q,p,t)=\frac{p^2}{2M}+\frac{M\omega_0^2q^2}{2}-J(t)q.

    The source changes sign in HH because it contains no velocity and is subtracted with the rest of LL. Hamilton's equations give q˙=p/M\dot q=p/M and p˙=−Mω02q+J\dot p=-M\omega_0^2q+J. Differentiating the first and inserting the second recovers the force equation.

    For constant J=J0J=J_0, complete the square:

    H=p22M+Mω022(q−q∗)2−J022Mω02,q∗=J0Mω02.H=\frac{p^2}{2M} +\frac{M\omega_0^2}{2}(q-q_*)^2 -\frac{J_0^2}{2M\omega_0^2}, \qquad q_* =\frac{J_0}{M\omega_0^2}.

    The force shifts the equilibrium to positive qq when J0>0J_0>0. The oscillation frequency remains ω0\omega_0. Both are physical checks on the source sign.

    Change the Lagrangian. Add αq˙\alpha\dot q to LL, with α\alpha a constant with units of momentum. Does this change the measured acceleration?

    Solution using the shifted momentum

    The momentum becomes p=Mq˙+αp=M\dot q+\alpha. Solving for q˙\dot q in pq˙−Lp\dot q-L gives the new kinetic term (p−α)2/(2M)(p-\alpha)^2/(2M). Consequently q˙=(p−α)/M\dot q=(p-\alpha)/M and p˙=−Mω02q+J\dot p=-M\omega_0^2 q+J still give the same acceleration. In the action the extra term integrates to α[q(tf)−q(ti)]\alpha[q(t_f)-q(t_i)]. Its variation vanishes for fixed endpoints. Both calculations show how the canonical momentum can change while the trajectory stays the same.

    Which energy is conserved?

    Define the energy stored in the unforced oscillator by

    Eosc=Mq˙22+Mω02q22.E_{\rm osc}=\frac{M\dot q^2}{2}+\frac{M\omega_0^2q^2}{2}.

    Use the equation of motion to find dEosc/dtdE_{\rm osc}/dt and dH/dtdH/dt. In particular, decide what is conserved for a constant nonzero force.

    Solution

    Differentiation gives

    dEoscdt=Mq˙(q¨+ω02q)=Jq˙.\frac{\mathrm dE_{\rm osc}}{\mathrm dt} =M\dot q(\ddot q+\omega_0^2q)=J\dot q.

    This is force times velocity, the power delivered by the source. Since H=Eosc−JqH=E_{\rm osc}-Jq,

    dHdt=Jq˙−J˙q−Jq˙=−J˙q.\frac{\mathrm dH}{\mathrm dt} =J\dot q-\dot Jq-J\dot q=-\dot Jq.

    For constant JJ, HH is conserved. EoscE_{\rm osc} generally is not: the source potential −Jq-Jq exchanges energy with it. For a time-dependent prescribed force, the oscillator and source potential form a system with explicit time dependence. The apparatus producing JJ has not been included as a dynamical degree of freedom.

    Use the equation. An impulse fixes a jump in velocity. A constant force sets a new equilibrium. Predict which features of the motion depend on the sign of JJ, then solve for them in the oscillator Green function. To vary a field at each point of spacetime, follow the time integration by parts above through its spatial counterpart. Varying a field action

    References

    • David Tong, Classical Dynamics (PDF), §2.1, printed pp. 10–12 (fixed-endpoint variation), §§4.1.1–4.1.2, pp. 82–83 (Legendre transform and Hamilton’s equations), and §4.1.4 (energy conservation).

    Scrollable formula. Use Left and Right arrow keys to reveal hidden content.

    Scrollable table. Use Left and Right arrow keys to reveal hidden columns.

    Scrollable figure. Use Left and Right arrow keys to reveal hidden content.