# Derivation of Euler-Lagrange equations for Lagrangian with dependence on second order derivatives

Suppose we have a Lagrangian that depends on second-order derivatives:

$$L = L(q, \dot{q}, \ddot{q})$$

If we're working on the variational problem for this Lagrangian, then I know that we'll wind up with the following Euler-Lagrange equation: $$\frac{\partial L}{\partial q} - \frac{d}{dt} \frac{\partial L}{\partial \dot{q}} + \frac{d^2}{dt^2} \frac{\partial L}{\partial \ddot{q}} = 0.$$ However, I can't see how to derive this equation. Obviously, the final term is supposed to come from integrating by parts the contribution of the $\ddot{q}$ dependence to the variation in the Lagrangian; doing that yields (writing $T$ for the period of time over which we're extremising the action): $$\int_T \frac{\partial L}{\partial \ddot{q}} \delta \ddot{q} = \left[ \frac{\partial L}{\partial \ddot{q}} \delta \dot{q} - \frac{\partial L}{\partial \ddot{q}} \delta q \right]_{\partial T} + \int_T \frac{d^2}{dt^2} \frac{\partial L}{\partial \ddot{q}}.$$ Now, the term in square brackets presumably has to vanish. The right-hand term will do so, since $\delta q$ vanishes on the boundary of $T$; but why should the left-hand term vanish? Is it just a condition of dealing with the variations for such a Lagrangian that we consider only variations for which $\delta \dot{q}$ vanishes on the boundary of integration as well? Or is there something I'm missing?

-
Yes, it is a condition that $\dot q_i=0$ (as well as the $q_i=0$) at the end-points so that you can derive the acceleration-dependent E-L equation. –  Kyle Kanos Apr 22 at 12:52
For a Lagrangian that depends on first-order derivatives, we will find a second-order equation of motion. For such an equation we need two boundary conditions --- for instance, the position of the particle at an initial and final time. This condition 'fixes $q$ at the end points'. For a Lagrangian that depends on second-order derivatives, we will find a fourth-order equation of motion, in general. So we will need four boundary conditions, and fixing the velocity (as well as the position) at the initial and final time will do the trick. –  gj255 Apr 22 at 12:57
Ah, I see - that's extremely helpful, thanks a lot! –  user45019 Apr 22 at 14:00
@gj255: You ought to turn your comment into an answer. –  Kyle Kanos Apr 22 at 14:32