Proof that total derivative is the only function that can be added to Lagrangian without changing the EOM So I was reading this: Invariance of Lagrange on addition of total time derivative of a function of coordiantes and time and while the answers for the first question are good, nobody gave much attention to the second one. In fact, people only said that it can be proved without giving any proof or any.
So, if I have a Lagrangian and ADD an arbitrary function of $\dot{q}$, $q$ and $t$ in such a way that the equations of motion are the same, does this extra function MUST be a total time derivative? 
EDIT Ok, I changed my question a little bit:
Question: If I have a function that obeys the Euler-Lagrange equation off-shell, this implies that my function is a time derivative? (This was used in Qmechanic's answer of this other question: Deriving the Lagrangian for a free particle, equation 14.)
Also, why people only talk about things that change the Lagrangian only by a total derivative? If this is not always the case that keeps the equation of motion the same, so why is it so important? And why in the two questions I posted about the same statement on Landau&Lifshitz's mechanics book only consider this kind of change in the Lagrangian? 
 A: I) OP essentially asked (v1):

If two Lagrangian densities ${\cal L}$ and $\tilde{\cal L}$ have the same eqs. of motions, must they necessarily differ by a total divergence?

Answer: No, not necessarily, one e.g. can always multiply a Lagrangian density ${\cal L}$ with a constant factor $\tilde{\cal L}=\lambda {\cal L}$ different from one $\lambda\neq 1$ without altering the EL equations, but the difference 
$$\tilde{\cal L}-{\cal L}=(\lambda-1) {\cal L} \tag{A}$$ 
is not a total divergence if ${\cal L}$ is not.
II) OP essentially asked (v4):

If EL equations are trivially satisfied for all field configurations, is 
  the Lagrangian density ${\cal L}$ necessarily a total divergence?

Answer: Yes, modulo topological obstructions in field configuration space.  This follows from an algebraic Poincare lemma of the so-called bi-variational complex, see e.g. Ref. 1.
We should mention that an elementary follow-your-nose-type proof exists for Lagrangians of the form $L(q^i,\dot{q}^j,t)$ without higher-order derivatives, see e.g. Ref. 2. We stress that the proof-technique of Ref. 2 does not work in the presence of higher-order derivatives or in the case of field theory. [Also Ref. 2 seems to overlook the counterexample in eq. (A).]
III) 

If two Lagrangian densities ${\cal L}$ and $\tilde{\cal L}$ have the same eqs. of motions, does there exist a constant factor $\lambda$ such that $\tilde{\cal L}-\lambda{\cal L}$ necessarily differ by a total divergence?

Answer: No, not necessarily. There are topological counterexamples.
References:


*

*G. Barnich, F. Brandt and  M. Henneaux, Local BRST cohomology in gauge theories, Phys. Rep. 338 (2000) 439, arXiv:hep-th/0002245.  

*J.V. Jose and E.J. Saletan, Classical Dynamics: A Contemporary Approach, 1998; Section 2.2.2, p. 67.
