Can a Lagrangian be such that all possible paths have the same action?

Q: Can a Lagrangian be such that all possible paths have the same action?

I was thinking if a Lagrangian of the motion of a particle could be represented as the total time derivative of some arbitrary function. In that case the action $S=\int^A_B L \, \mathrm{dt}$ will be a constant since $$S=\int^A_B \frac{df}{dt} \mathrm{dt}=f(A)-f(B)$$ and it will be independent of the path. It will depend only on the initial and final positions of the particle. Is such kind of a Lagrangian possible, either mathematically or physically?

Typically, theories like these are called Topological field theories, since the action depends only on the dyanmics at the boundary. It is a field unto itself, but note that a lot of the typical reasoning you see in, say, Goldstein doesn't really work, because the equations of motion will come out to $0=0$, because all paths from $A$ to $B$ minimize the action.
• It may be worth mentioning that such a lagrangian will always yield the same equations of motion as a lagrangian $\tilde{L}=0$, because both lagrangians can be connected by a gauge transformation: $L = f = f+0=f+\tilde{L}$, with f satisfying exactly the conditions you demand from a gauge transformation. – Quantumwhisp Mar 21 '17 at 17:08
• @SchrodingersCat: any total derivative of $t$ will do, but say we just take a standard Lagrangian, and time derive it, so take $m{\dot x}{\ddot x} - {\dot x}V^{\prime}(x)$ – Jerry Schirmer Mar 21 '17 at 20:03