# Boundary conditions for calculus of variations in phase space and under canonical transformations

This might be a stupid question, but I just don't get it. In Hamiltonian mechanics when examining conditions for a $$(\boldsymbol{q},\boldsymbol{p})\rightarrow(\boldsymbol{Q},\boldsymbol{P})$$ transformation to be canonical one starts with $$\dot{q}_ip^i-H(\boldsymbol{q},\boldsymbol{p},t)= \dot{Q}_iP^i-\bar{H}(\boldsymbol{Q},\boldsymbol{P},t)+\frac{d}{dt}W(\boldsymbol{q},\boldsymbol{Q},t)$$ where $$\bar{H}$$ is the transformed Hamiltonian, and $$W$$ is the generating function (now a function of $$\boldsymbol{q}$$ and $$\boldsymbol{Q}$$). This term shouldn't break Hamilton's principle, since $$\delta\int_{t_1}^{t_2} dt\frac{d}{dt}W(\boldsymbol{q},\boldsymbol{Q},t)=\delta W(\boldsymbol{q},\boldsymbol{Q},t)|_{t_2}-\delta W(\boldsymbol{q},\boldsymbol{Q},t)|_{t_1}=0-0=0 .$$ But I don't see why the variation of $$W$$ should disappear at the endpoints (say at $$t_1$$). Expanding leads to: $$\delta W(\boldsymbol{q},\boldsymbol{Q},t)|_{t_1}=\left(\frac{\partial W}{\partial q_i}\right)_{t_1}\underbrace{\delta q_i(t_1)}_{=0}+ \left(\frac{\partial W}{\partial Q_i}\right)_{t_1}\delta Q_i(t_1)=\left(\frac{\partial W}{\partial Q_i}\right)_{t_1}\delta Q_i(t_1).$$ $$\boldsymbol{Q}$$ is itself a function of $$\boldsymbol{q}$$ and $$\boldsymbol{p}$$, so $$\delta Q_i(t_1)=\left(\frac{\partial Q_i}{\partial q_k}\right)_{t_1}\underbrace{\delta q_k(t_1)}_{=0}+\left(\frac{\partial Q_i}{\partial p_k}\right)_{t_1}\delta p_k(t_1)=\left(\frac{\partial Q_i}{\partial p_k}\right)_{t_1}\delta p_k(t_1).$$ It seems as if we also needed the variation of $$\boldsymbol{p}$$ to vanish at the endpoints, and I don't get this because (at least in cartesian coordinates) $$\boldsymbol{p}=m\dot{\boldsymbol{q}}$$ and the velocity can be different along the original and the varied orbitals even at the endpoints (they can point in totally different directions), so in general $$\delta \dot{\boldsymbol{q}}(t_1)\neq 0$$. What am I doing wrong? Can someone help me with this, please?

• Endpoints are held fixed during the path variation, so the variation of any function at the endpoints is zero. – Trevor Kafka Sep 30 '18 at 20:56
• Endpoints are fixed indeed ($\delta q(t_1)=\delta q(t_2)=0$), but for some function $f(\boldsymbol{q,p})$, $\delta f(\boldsymbol{q,p})=0$ would require $\delta p(t_1)=\delta p(t_2)=0$ too and I can't see how fixing the endpoints only (and not the derivatives!) guarantees this condition. – dennismoore94 Sep 30 '18 at 21:54
• I think you're confusing $\delta p$ and $p$. We're varying both $q$ and $p$ when we work in a variational principle but hold both $q$ and $p$ fixed at the endpoints of the path. $\delta q = \delta p = 0$ at the endpoints, even if the values of $q$ and $p$ are nonzero themselves. – Trevor Kafka Sep 30 '18 at 22:15
• OK, I think this is, what I actually don't understand: here $\delta p(t_1)=\delta p(t_2)=0$ is the same as $\delta \dot{q}(t_1)=\delta \dot{q}(t_2)=0$ would be in Lagrangian mechanics (again, thinking in cartesian coordinates), but in Lagrangian mechanics we don't have this kind of condition for the velocity. Or do we? – dennismoore94 Sep 30 '18 at 22:45

These are very good questions.

1. Let us start with the old phase space variables $$(q^k,p_{\ell})$$. The Hamiltonian action is $$S_H~=~\int_{t_i}^{t_f} \! dt ~L_H, \qquad L_H~:=~\dot{q}^j p_j - H(q,p,t).\tag{A}$$ Its infinitesimal variation reads $$\delta S_H ~=~ \text{bulk-terms} ~+~ \text{boundary-terms},\tag{B}$$ where $$\text{bulk-terms}~=~\int_{t_i}^{t_f} \! dt \left(\frac{\delta S_H}{\delta q^j}\delta q^j + \frac{\delta S_H}{\delta p_j}\delta p_j \right)\tag{C}$$ yield Hamilton's equations, and where $$\text{boundary-terms}~=~\left[p_j\underbrace{\delta q^j}_{=0} \right]_{t=t_i}^{t=t_f}~=~0\tag{D}$$ vanish as they should because of, say$$^1$$, essential/Dirichlet boundary conditions (BCs) $$q^j(t_i)~=~0\qquad\text{and}\qquad q^j(t_f)~=~0. \tag{D}$$ Notice that the momenta$$^2$$ $$p_j$$ are unconstrained at the boundary.

2. Next let us consider new phase space variables $$(Q^k,P_{\ell})$$. The action of type 1 reads$$^3$$ $$S_1~:=~\int_{t_i}^{t_f} \! dt ~L_1~=~S_K+\left[ F_1(q,Q,t) \right]_{t=t_i}^{t=t_f}, \qquad S_K~:=~\int_{t_i}^{t_f} \! dt ~L_K,$$ $$L_1~:=~L_K+\frac{dF_1(q,Q,t)}{dt}, \qquad L_K~:=~ \dot{Q}^j P_j - K(Q,P,t),\tag{F}$$ where the old positions $$q^j=q^j(Q,P,t)$$ are implicit functions of the new phase space variables $$(Q^k,P_{\ell})$$. Its infinitesimal variation reads $$\delta S_1 ~=~ \text{bulk-terms} ~+~ \text{boundary-terms},\tag{G}$$ where $$\text{bulk-terms}~=~\int_{t_i}^{t_f} \! dt \left(\frac{\delta S_1}{\delta Q^j}\delta Q^j + \frac{\delta S_1}{\delta P_j}\delta P_j \right)\tag{H}$$ yield Kamilton's equations, and where $$\text{boundary-terms}~=~\left[\underbrace{\left(P_j+\frac{\partial F_1}{\partial Q^j}\right)}_{=0}\delta Q^j +\frac{\partial F_1}{\partial q^i}\underbrace{\delta q^j}_{=0} \right]_{t=t_i}^{t=t_f}~=~0\tag{I}$$ vanish as they should.

--

$$^1$$ Alternatively, one could impose natural BCs, or perhaps some mixture thereof.

$$^2$$ Note that in QM it would conflict with the HUP to simultaneously impose BCs on a canonical conjugate pair.

$$^3$$ Notation conventions: Kamiltonian $$K\equiv\bar{H}$$ and type 1 generating function $$F_1\equiv G_1\equiv W$$.

• Ah, now I see! It is not $\delta Q^i$ (and thus not $\delta p_k$) which must vanish (and which could not happen anyway), but it's "coefficient", leading you to the well-known canonical conditions for the generating function. Thank you, nice answer :) – dennismoore94 Oct 1 '18 at 21:47