# When can one omit a total time derivative in the Lagrangian formulation?

I am studying Lagrangian and Hamiltonian mechanics and i am using Landau & Lifshitz and Goldstein books. Both of them state that a modified lagrangian $$L'=L+\frac{df}{dt}$$ gives the same solutions than $L$ wich i kind of understand but its not the main problem. In landau there is a problem in which a pendulum whose attachment point is oscillating. setting up the equations is not a problem for me, but when he gives the solutions he states that he omits total time derivatives as if it was the most obvious thing to do, i guess that this omission is related to the "invariance" of the Lagrangian but i fail to se the direct relation with this. How do you know from which function are you supposed to omit the total time derivarive? How do you identify this function?... etc etc The example that i'm talking about is in Landau & Lifshitz book page 11 exercise 3)b.

Remember that the physics you get from a Lagrangian is due to a variational problem where you seek to extremize the action

$$S = \int_{t_1}^{t_2} L \, dt$$

So, the reason you can remove a total time derivative from your Lagrangian is because its contribution to the action is fixed:

$$\int_{t_1}^{t_2} \frac{df}{dt} \, dt = f(t_2) - f(t_1)$$

and thus has no impact on the variational problem. As for which total time derivatives to remove, that can be a bit of an art. With experience you can see in advance that shifting the Lagrangian by a total derivative might simplify things.

Also note that the boundary conditions play a role here, as you can clearly see above, where one gets $f$ evaluated at $t_1, t_2$. Usually this doesn't matter, especially in simple mechanics problems, but it's worth remembering for those odd cases where the boundary conditions become important.

• the lagrangian i get is: L=$$\frac{m}{2}[l^2\dot{\theta}^2+a^2\omega^2sin^2(\omega*t)-2a\omega*l*sin(\omega*t)cos(\theta)]+mglcos(\theta)$$ and the solution from the book is: L=$$\frac{m}{2}l\dot{\theta}^2+mla\omega^2cos(\omega*t)sin(\theta)+mglcos(\theta)$$ – Pablo Bähler Mar 9 '17 at 12:17