There's something fishy that I don't get clearly with the action principle of classical mechanics, and the endpoints that need to be fixed (boundary conditions). Please, take note that I'm not interested in answers with the hamiltonian, which isn't the point here. I want to stay within the Lagrangian formalism. Suppose we have a general Lagrangian $L(q, \dot{q},t)$, with standard action \begin{equation}\tag{1} S[q] = \int_{t_1}^{t_2} L(q, \dot{q},t) \, dt. \end{equation} If I vary this action in the usual way with Dirichlet boundary conditions $\delta q^i(t_1) = \delta q^i(t_2) = 0$, then I get the usual Euler-Lagrange (EL) equations as is usually shown everywhere. This is all nice. But now I want to let the variations $\delta q^i$ to stay arbitrary at the boundary, but fix the canonical momentum $$ p_i(q,\dot{q},t)~:=~\frac{\partial L(q,\dot{q},t)}{\partial\dot{q}^i} $$ instead: $\delta p_i(t_1) = \delta p_i(t_2) = 0$. In this case, varying (1) can't give back the EL equations: \begin{align} \delta S &= \int_{t_1}^{t_2} \biggl( \frac{\partial L}{\partial q^i} \: \delta q^i - \frac{d}{dt} \Bigl( \frac{\partial L}{\partial \dot{q}^i} \Bigr) \delta q^i + \frac{d}{dt} \Bigl( \frac{\partial L}{\partial \dot{q}^i} \: \delta q^i \Bigr) \biggr) dt \\ &= \int_{t_1}^{t_2} \biggl( \frac{\partial L}{\partial q^i} - \frac{d }{d t} \Bigl( \frac{\partial L}{\partial \dot{q}^i} \Bigr) \biggr) \delta q^i \, dt + p_i \, \delta q^i \Bigr|_{t_1}^{t_2}. \tag{2} \end{align} Since $\delta q^i \ne 0$ at $t_1$ and $t_2$ (and in general $p_i \ne 0$ at the boundary), the last term doesn't cancel and we can't get the EL equations. If I really want to impose $\delta p_i(t_1) = \delta p_i(t_2) = 0$ (not $p_i(t_1) = p_i(t_2) = 0$ !), then I need to modify the Lagrangian. We're allowed to add a total time derivative: \begin{equation}\tag{3} \tilde{L} = L + \frac{dQ}{dt}, \end{equation} where $Q(q, \dot{q}, t)$ must be chosen wisely. In this case: \begin{equation}\tag{4} \tilde{S} = \int_{t_1}^{t_2} \tilde{L} \, dt = \int_{t_1}^{t_2} L \, dt + Q \Bigr|_{t_1}^{t_2}. \end{equation} But then, this is where I feel confused. If I use \begin{equation}\tag{5} Q(q, \dot{q}, t) = - q^i \, p_i, \end{equation} where $p_i = \partial L / \partial \dot{q}^i = p_i(q, \dot{q})$ is the canonical momentum from the "old" Lagrangian $L$, then the "new" lagrangian (3) have second order terms, i.e $\ddot{q}^i$ (from the total time derivative and $\dot{p}_i$). I don't think this really gives an issue since these second order terms are coming in a special way, i.e from a total time derivative. Varying the "new" action (4) give \begin{align} \delta\tilde{S} &= \int_{t_1}^{t_2} \biggl( \frac{\partial L}{\partial q^i} - \frac{d }{d t} \Bigl( \frac{\partial L}{\partial \dot{q}^i} \Bigr) \biggr) \delta q^i \, dt + p_i \, \delta q^i \Bigr|_{t_1}^{t_2} - (p_i \, \delta q^i + q^i \, \delta p_i ) \Bigr|_{t_1}^{t_2} \\ &= \int_{t_1}^{t_2} \biggl( \frac{\partial L}{\partial q^i} - \frac{d }{d t} \Bigl( \frac{\partial L}{\partial \dot{q}^i} \Bigr) \biggr) \delta q^i \, dt - q^i \, \delta p_i \Bigr|_{t_1}^{t_2}, \tag{6} \end{align} which is the desired result to use the boundary conditions $\delta p_i(t_1) = \delta p_i(t_2) = 0$ and get back the EL equations from the "old" Lagrangian.

So what is wrong with this? Why am I confused here? Is there something important that I'm missing? I tried to find something about this is Goldstein's book on Classical Mechanics, and also in Classical Dynamics by José-Saletan, but didn't found anything. I guess that if the procedure above was valid, then it would have been described in these books and elsewhere! So something must be wrong in the procedure above.

EDIT: I'm perplexed by the possibility that the imposed conditions may be incompatible with the Lagrangian or the equations of motions (EOM), without knowing the EOM in advance. For example, it's possible that the imposed positions $q_1^i$ at time $t_1$ and $q_2^i$ at time $t_2$ may be incompatible with the general solution to the EOM, so that we may need to use the momentum instead (or other conditions). Of course, the reverse is also true (incompatible momentum conditions, so need to use the coordinates instead). I don't remember that I saw this discussed before.

EDIT 2: The following arXiv paper confirms that the procedure shown above is right: https://arxiv.org/abs/0809.4033. In particular, from pages 15-17:

The bulk equations of motion are always unaffected by adding a total derivative, even one that contains higher derivatives of the fields. However, the addition of a total derivative may render the variational problem inconsistent, or require different boundary data in order to remain well-posed. ... As a general rule of thumb, if an action contains higher derivatives which appear only as total derivatives, a boundary term will need to be added.

  • $\begingroup$ If we want to fix $p_i$ in the boundary conditions, it seems more natural to introduce the set $\{ q_i , p_i \}$ as independent variables. This will lead to the 1st order formalism or the Hamiltonian formalism you're not interested in. $\endgroup$
    – Dexter Kim
    Apr 24 at 9:18
  • $\begingroup$ @DexterKim, I'm not interested in the hamiltonian answer because I already know in details how it's working there. In this case, you need to fix both the $q^i$ and the $p_i$ at the endpoints. My point is you don't need to fix the coordinates at $t_1$ and $t_2$ to get back the EL equations. You may fix the momentum alone at the endpoints, by using a modified lagrangian. $\endgroup$
    – Cham
    Apr 24 at 12:59

3 Answers 3


Normally one studies

  1. weak essential/Dirichlet BC $\quad q(t_i)~=~q_i\quad\text{and}\quad q(t_f)~=~q_f,$

  2. strong essential/Dirichlet BC $\quad q(t_i)~=~0\quad\text{and}\quad q(t_f)~=~0,$

  3. strong natural BC: $\quad p(t_i)~=~0\quad\text{and}\quad p(t_f)~=~0,$

  4. combinations thereof,

cf. e.g. my related Phys.SE answer here.

OP wants to study

  1. weak natural BC: $\quad p(t_i)~=~p_i\quad\text{and}\quad p(t_f)~=~p_f.$

OP correctly adds boundary terms to the action so that the variational principle works. The only fishy parts seem to be that

  • the boundary terms look non-geometric, and

  • if there is any actual situation in Nature where a weak natural BC is required.

  • $\begingroup$ 1. Can we say that the "weak natural BC" is a Neumann condition ? 2. And do you agree that my procedure is valid? $\endgroup$
    – Cham
    Apr 19 at 13:17
  • $\begingroup$ 1. In this context the Neumann BC fixes the velocity rather than the momentum, which needs not be the same. $\endgroup$
    – Qmechanic
    Apr 19 at 13:27
  • $\begingroup$ I agree that the momentum and the velocity are different (in general). What about Robin conditions, which is a mix of Dirichlet and Neumann? Can we say that your "weak natural BC" is a Robin condition? $\endgroup$
    – Cham
    Apr 19 at 13:37
  • 1
    $\begingroup$ The Robin BC is linear in $q$ and $\dot{q}$, while the weak natural BC could be non-linear. $\endgroup$
    – Qmechanic
    Apr 19 at 13:50
  • $\begingroup$ Ok, thanks. One last thing: do you agree that the procedure that I exposed is valid and that the variationnal problem is well posed, if we want to fix the momentum on the boundary? If so, then why it isn't shown in the standard textbooks? $\endgroup$
    – Cham
    Apr 19 at 13:53

I think part of the issue is notation, so let's write $\dot{q}$ as $v$. The Lagrangian is a function $L(q,v,t)$, where $q, v, t$ are independent variables. The principle of least action says that the path $t\mapsto q(t)$ minimises the functional $$ S[q] = \int_{t_1}^{t_2}L(q(t),\dot{q}(t),t)\,dt. $$ Now when you say you add a time derivative to $L$, i.e. $L'=L+\frac{dQ}{dt}$, what's really meant is that you are adding a function to $L$ of the form $$\tag{*} L'(q,v,t) = L(q,v,t)+\frac{\partial Q}{\partial q}(q,t)\,v+\frac{\partial Q}{\partial t}(q,t), $$ where $Q(q,t)$ is any function. Then the action gets replaced by $$ S'[q] = \int_{t_1}^{t_2}\left[L(q(t),\dot{q}(t),t)+\frac{\partial Q}{\partial q}(q(t),t)\,\dot{q}(t)+\frac{\partial Q}{\partial t}(q(t),t)\ \right] \, dt \\ = \int_{t_1}^{t_2}\left[L(q(t),\dot{q}(t),t)+\frac{d}{dt}Q(q(t),t) \right]\,dt = \int_{t_1}^{t_2}L(q(t),\dot{q}(t),t)\,dt + Q(q(t),t)\big\vert_{t_1}^{t_2}, $$ using the chain rule in the second step.

Hopefully it's now clear what's going wrong with your example. You're attempting to add $\frac{dQ}{dt}$, where now $Q(q,v,t)$. But this doesn't correspond to any equivalent of (*), since one would now need $L'$ to also depend on a new variable $a$ (or in original notation, $\ddot{q}$).

You've alluded to this in your original answer by saying "I don't think this really gives an issue since these second order terms are coming in a special way, i.e from a total time derivative." In fact, it does, and you would need to work with the EL-equations for Lagrangians of the form $L(q,\dot{q},\ddot{q},t)$ in order to make sense of what you are doing.

  • 1
    $\begingroup$ Your answer doesn't address the issue. The term that is added to the Lagrangian is a "boundary" term which isn't a standard $Q(q, t)$. While it seems to give $\tilde{L}(q, \dot{q}, \ddot{q})$ (superficially), it doesn't since the second order terms are removed under the standard variation (see equation (6)). $\endgroup$
    – Cham
    Apr 19 at 13:14
  • $\begingroup$ I'm pointing out that what you're doing doesn't in fact make any sense, since it doesn't define a new Lagrangian $L'(q,\dot{q},t)$. So variations of $S'[q]$ are not well-defined, unless you consider variations of more general Lagrangians $L(q,\dot{q},\ddot{q},t)$. And obviously the Euler-Lagrange equations for the latter will be different than the standard ones. $\endgroup$
    – user17945
    Apr 19 at 14:32
  • $\begingroup$ The added term is trivially canceling in the third order EL equation that we get from a general $L(q, \dot{q}, \ddot{q}, t)$, so we're back to the original second order EL equation! And your answer appears to be in conflict with Qmechanics's. $\endgroup$
    – Cham
    Apr 19 at 14:57
  • $\begingroup$ The third order EL equations are $\frac{d^2}{dt^2}\left(\frac{\partial L}{\partial \ddot{q}}\right) - \frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}}\right) + \frac{\partial L}{\partial q} = 0$, so I don't know what you mean when you say the added term is cancelling in this to get back the second order EL equations. The boundary terms in this case become more complicated (they're no longer just $p_i\delta q^i$). $\endgroup$
    – user17945
    Apr 19 at 16:03
  • $\begingroup$ I disagree with Qmechanic's statement that "OP correctly add boundary terms to the action, so that the variational principle works". If you're unconvinced, just consider the trivial case $L=\frac{1}{2}m\dot{q}^2$. Are there any solutions of the EL-equations with $p(t_1) = 0, p(t_2)=1$, say? $\endgroup$
    – user17945
    Apr 19 at 16:06

I submit that the treatment that you produced amounts to a Rube Goldberg machine

In the case of application of Calculus of Variations: in order to obtain an equation of motion: introducing a variation space introduces degrees of freedom; the imposed conditions narrow things down to a single equation of motion.

General property of applying conditions: if the supplied conditions provide insufficient constraint the problem is underdetermined, if there are too many constraints you get conflict; the problem is overdetermined.

So: we supply conditions such that the problem has a uniquely determined solution. Here the unique solution consists of a single equation of motion.

The point is:
It is to be expected that there are more ways than one to supply conditions such that the problem has a uniquely determined solution.

In mathematics in general: any theorem can be proved in multiple ways.

A particularly vivid example of that is Pythagoras' theorem. The count of total number of independent proofs somewhat depends on what one counts as being different, but it's in the hundreds.

Returning to application of calculus of variations in classical mechanics:

You express surprise at finding out there is another way of supplying conditions such that the solution to the problem is uniquely determined. I submit: what you found is what is expected.

Presumably there is no upper limit; I expect that it will always be possible to find more elaborate ways to supply the necessary constraints.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.