I am a mathematician who is taking a quantum field theory course without much prior pyhsics. We have had the term "up to a total derivative" a few times, yet every time I asked what it meant I didn't really grasp it.
As an example, for our last tutorial we were given the Lagrangian $$ \mathcal{L} = i\psi^*\partial_0\psi - \frac{1}{2m}\nabla\psi^*\cdot\nabla\psi,\tag{1} $$ but then immediately in the tutorial it was given that this is equivalent (up to a total derivative) to $$ \mathcal{L} = \frac{i}{2}(\psi^*\partial_0\psi - (\partial_0\psi^*)\psi) - \frac{1}{2m}\nabla\psi^*\cdot\nabla\psi.\tag{2} $$
The things I really don't understand are:
how exactly are these things the same? (/what does "up to total derivative" mean)
how do I know when I should try to convert something to another thing through a total derivative?