It is the equations of motion that are invariant under the addition of a function that is the total time derivative of some function, to the Lagrangian. Since the Euler-Lagrange equations involve derivatives with respect to position and velocity only, a partial derivative wrt to position or velocity of this added function will be zero.
Hope this helps
Preet, what you just noticed is the basis for later things like contact transformations and the resulting Hamilton-Jacobi theory. It turns out that you can add a more general class of functions whose derivatives obey a certain relationship, and if you can find these functions and changes of variable then you can make any classical physics problem a piece of cake.
We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling We Value Civility
• Positive and compassionate attitudes
• Patience while debating We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving