# Variation in Hamiltonian mechanics

I have a question about a property of variational calculus used in following bachelor thesis:

http://users.physik.fu-berlin.de/~pelster/Bachelor/fraessdorf.pdf

Here the excerpt:

Why it is possible to pull the variation $$\delta$$ into the integral? Namely why is

$$\delta \int dt[p_i \dot{q}^i -H(p,q)-\lambda^r\phi_r(p,q)] = \int dt \text{ }\delta [p_i \dot{q}^i -H(p,q)-\lambda^r\phi_r(p,q)]$$

a correct step?

I encountered often in other lectures treating Hamiltonian mechanics similar intergal-variation-interchange steps but they were never justified.

• – Qmechanic Apr 16 at 8:25

## 2 Answers

It is because the integral of the difference of two quantities is equal to the difference of the integrals:

If $$\delta f(x)= f_2(s) -f_1(x)$$ and $$\delta \int f(x) \,dx = \int f_2(x)dx-\int f_1(x) dx$$ then $$\delta \int f(x) \,dx = \int \left( f_2(x)-f_1(x)\right)dx =\int \delta f(x)\,dx.$$

• what me irritates is what are these functions $f_1(x), f_2(x)$ in $\delta f(x)= f_2(s) -f_1(x)$? How are they related to $f$? Or is it just symbolical matter, namely not concretely specified infinitesimal variation around $f$? So $f_1,f_2$ are just "represenentators" of two functions "being infinitesimally close to $f$" – Tim Grosskreutz Apr 16 at 10:43
• So if this is the correct interpretation of $\delta f$ then I guess that generally if I want to verify if an anylytic formula or rule holds for $\delta f$ Ihave just to verify that it holds for the difference of two arbitrary representants which are "close enough" to $f$,right? – Tim Grosskreutz Apr 16 at 10:44
• @tim grosskreutz It's the same as $\delta x=x_2-x_1$ i.e an arbitrary, but small, change in $x$ from $x_1$ to some other value. – mike stone Apr 16 at 12:27

The basic reason that it is justified is that the time integral is a linear operator.

So let's step way back into the abstract, what you really have is some configuration space $$\mathcal C$$ of possible configurations of some system, and some space of paths $$\mathcal P$$ through that, which is some subset of the functions $$[0,1]\to \mathcal C$$. Inside of this configuration space we may have a time coordinate, position coordinates, velocity or momentum coordinates...

Then we have some functions of these paths, $$X:\mathcal P \to \mathbb R.$$ Some of them have the format, $$\mathcal A[\mathbf P] = \int_0^1 ds~L\big(\mathbf P(s)\big).$$ We want to do calculus with whole paths, so we want to consider the difference $$\delta \mathcal A = \mathcal A[\mathbf P + \epsilon\mathbf p] - \mathcal A[\mathbf P],~~ \epsilon \approx 0$$ Note that this in theory depends on both the path big-$$\mathbf P$$ that we use to evaluate the action and the path little-$$\mathbf p$$ that we use to perturb it, but we're typically going to take the approach of trying to find the big-$$\mathbf P$$ such that this $$\delta \mathcal A$$ is zero to first order in $$\epsilon$$ or so, irrespective of little-$$\mathbf p$$.

Just putting those two together and using the linearity of the integral, we have $$\delta\mathcal A = \int_0^1 ds~\Big(L\big(\mathbf P(s) + \epsilon \mathbf p(s)\big) - L\big(\mathbf P(s)\big)\Big),$$and the internal term could meaningfully be called $$\delta L$$. It doesn't mean exactly the same thing as it is applied "pointwise" to the path, but if we were instead to write this as $$L[\mathbf P](s)$$ or some similar notation then it would indeed be $$\delta L[\mathbf P](s)$$.

The rest of your expression then follows from the Leibniz property of this $$\delta$$ operator, which depends on understanding that we are taking a limit etc., which is nontrivial of course.

• so this rule might be interpreted as definition for variation of functionals of the shape $\mathcal A[\mathbf P] = \int_0^1 ds~L\big(\mathbf P(s)\big)$? – Tim Grosskreutz Apr 16 at 10:46
• @TimGrosskreutz Yes, the “motivating definition” for $\delta$ is “let’s study the difference between what this does on some path $\mathbf P$ and some path $\mathbf P + \delta \mathbf P$ that is nearby, with some constraints on the form of $\delta\mathbf P$ (e.g. $\delta \mathbf P(0) = \delta \mathbf P(1) = 0$, if there is a time-coordinate often $t[\mathbf P](s)\propto s$, etc.) and with the assumption that for all $s$ the variation $\delta \mathbf P$ is tiny so I only want it to first-order.” The expression of this theme is slightly different in different contexts, of course. – CR Drost Apr 16 at 14:23
• So with a function $F(\vec r, t)$ this definition would manifest as $\delta F = \nabla F\cdot\delta \vec r$, but with $F(\vec r, \vec v, t)$ you would instead have something more like $\delta F = \nabla_r F \cdot \delta \vec r + \nabla_v F \cdot \delta \vec v$ and then often we would integrate that second term by parts in some action-integral, to become $-\sum_i \left(\frac d{dt} \frac{\partial F}{\partial v_i} \right)\delta r_i,$ assuming that the boundary term vanishes. – CR Drost Apr 16 at 14:28