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.
 A: 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.
A: To understand this f you need to be aware that f can only be a function of q and t, not of q dot.
I got tripped up by the same question a long time ago as an undergrad. When you get $a^2 \omega^2 sin^2(\omega t)$ then this is a function of t only (a and omega are not dynamical variables, right?) We know any function of one variable (t) can be written as the total derivative w.r.t t of another function, so thisnterm you can drop.
For the other terms in your solution, you are probably using a different zero point/angle for theta. There is then still the factor of 2 and a factor of l missing, and if i dont remember totally wrong these were typos in L.L.
About your question how to identify: a) just drop any function only depending on t
b) if you see a function like $g(q) \dot q$ you can also drop it (total derivative of G(q) with G stemfunction of g
I think no other rule which would be obscure is used in the book.
