# Confusion of variable vs path in Euler-Lagrange equation, Hamiltonian mechanics, and Lagrangian mechanics

In Lagrangian mechanics we have the Euler-Lagrange equations, which are defined as $$\frac{d}{dt}\Bigg(\frac{\partial L}{\partial \dot{q}_j}\Bigg) - \frac{\partial L}{\partial q_j} = 0,\quad j = 1, \ldots, n.$$

In Hamiltonian mechanics we have that $$\dot{q}_j = \frac{\partial H}{\partial p_j}, \quad \dot{p}_j = -\frac{\partial H}{\partial q_j}, \quad j = 1,\ldots n,$$ where $$p_i = \frac{\partial L}{\partial \dot{q}_i}.$$

What has been confusing me is that the coordinates $$p,\,\dot{p},\,q,\,\dot{q}$$ are all actually paths, meaning they are functions of time. Thus the Lagrangian $$L$$ and the Hamiltonian $$H$$ are actually functionals, and I would suspect that we need to use a variational derivative instead of an ordinary one above.

However despite this some textbooks on classical mechanics treat $$p,\,\dot{p},\,q,\,\dot{q}$$ as coordinates and not as paths, so they take derivatives and partial derivatives and not variational derivatives.

I am getting confused between these two viewpoints. How is it justified to take derivatives as if $$p,\,\dot{p},\,q,\,\dot{q}$$ were coordinates and not functions? When should one use the variational derivative instead?

• Notation is a mess; people often use the same thing to mean different things. But for a first pass through: no, we have many different coordinate functions (that too on different manifolds, eg $Q,TQ,T^*Q$). To get functions of time, you compose these coordinate functions with curves in the appropriate manifold. By abuse of language, this composition with the curve is omitted in the notation. I’ve written several answers about this sort of thing; look them up. Sep 19, 2023 at 0:44
• To get you started, see Derivatives of Lagrangian for relativistic massive point particle, then Help with geometric view of conjugate momenta and Legendre transformation. I know you didn’t ask about Legendre transforms specifically, but the differential geometry basics I explain there will help you out. After that, follow the many links in the answers. That will surely keep you busy for a while, and address the various subtleties regarding curves vs coordinates etc. Sep 19, 2023 at 0:46

The Lagrangian is a function, not a functional. The action is a functional, and is defined as

$$S[q; t_0,t_1] = \int_{t_0}^{t_1} L\big(q(t), \dot q(t), t\big) \mathrm dt$$ The partial derivatives which appear in the Euler-Lagrange equations are slot derivatives. One might write $$\big(\partial_1 L\big) (a,b,c) = \lim_{\epsilon\rightarrow 0} \frac{L(a+\epsilon,b,c)-L(a,b,c)}{\epsilon}$$ $$\big(\partial_2 L\big) (a,b,c) = \lim_{\epsilon\rightarrow 0} \frac{L(a,b+\epsilon,c)-L(a,b,c)}{\epsilon}$$ $$\big(\partial_3 L\big) (a,b,c) = \lim_{\epsilon\rightarrow 0} \frac{L(a,b,c+\epsilon)-L(a,b,c)}{\epsilon}$$

Demanding that the action be stationary for arbitrary smooth perturbations $$\eta$$ which vanish at $$t_0$$ and $$t_1$$ is to demand that $$\frac{d}{d\epsilon} S[q+\epsilon\eta;t_0,t_1] \bigg|_{\epsilon=0}$$ $$= \int_{t_0}^{t_1} \left[ \big(\partial_1L\big)(q(t), \dot q(t),t) -\frac{d}{dt} \big(\partial_2 L\big)(q(t),\dot q(t), t)\right]\eta(t)\ \mathrm dt = 0$$ which implies that the integrand must vanish - hence the EL equations.

From a terminology standpoint, if we can write $$\frac{d}{d\epsilon}S[q+\epsilon \eta;t_0,t_1] = \int_{t_0}^{t_1}\bigg(\ldots\bigg) \eta(t) \mathrm dt$$ then we call $$\big(\ldots\big)$$ the variational (or functional) derivative of $$S$$, and typically write it as $$\delta S/\delta q$$ or something similar.

The confusion arises when we write $$\big(\partial_1L\big)(q(t),\dot q(t), t) \equiv \frac{\partial L}{\partial q}$$ This is confusing, but as the number of "slots" of $$L$$ increases, there is really no viable alternative that isn't notationally horrific. You just have to understand what's being talked about.

• Thank you. I think it comes down to me getting confused with the abuse of notation between a path and a coordinate. Sep 19, 2023 at 2:33

All the problem, in my view, arises form the fact that the EL equations are introduced in a too sloppy way. (The variational approach makes even more obscure an obscure setup.)

Actually,

1. The coordinates $$\dot{q}^k$$ and $$q^k$$ are independent and they become dependent only "on-shell", i.e., on the curve that solvese the equations of motion. Only then $$\dot{q}$$ becomes the time derivative of $$q$$ and this should be expliticly stated!

2. The EL equations are 2n not n: in coordinatess one looks for a curve $$\gamma : I \ni t \mapsto (t, q(t),\dot{q}(t)) \in \mathbb{R}\times \mathbb{R}^n\times \mathbb{R}^n$$ such that (notice the order of the various operations, the partial derivatives are computed before evaluating the Lagrangian on the curve) $$\left \{ \begin{array}{rl} \left.\frac{d}{dt}\right|_{\gamma(t)} \frac{\partial L(t,q, \dot{q})}{\partial \dot{q}^k} -\left.\frac{\partial L(t,q, \dot{q})}{\partial q^k}\right|_{\gamma(t)}&=0\\ \left.\frac{d}{dt}\right|_{\gamma(t)} q^k &= \left.\dot{q}^k\right|_{\gamma(t)} \end{array} \right.$$ I stress that these equations are 1st order ordinary differential equations.

In particular the Lagrangian is a function of $$2n+1$$ independent variables: $$t, q^1,\ldots, q^n, \dot{q}^1, \ldots, \dot{q}^n$$

A natural way to globally fix all this approach is the use of a jet bundle viewing the spacetime of kinetic states, locally determined by natural coordinates $$(t, q^1,\ldots, q^n, \dot{q}^1, \ldots, \dot{q}^n)$$ a as a fiber bundle over the real line.

In natural charts over the spacetime of kinetic states the transformation maps are

$$\overline{t} = t+c$$ $$\overline{q}^k = \overline{q}^k(t,q)$$ $$\dot{\overline{q}}^k =\frac{\partial \overline{q}^k}{\partial t}+ \sum_{j=1}^n \frac{\partial \overline{q}^k }{\partial q^j} \dot{q}^j$$ These charts form a preferred atlas on the spacetime of kinetic states and define it. Notice that, in the transformation laws above, there is no given curve to use just because $$\dot{q}^k$$ is not the derivative, along a curve, of $$q^k$$. It is an independent variable, the said relation holds on the solutions of the motion equations however.

The EL equations written as above, when assuming that the Lagrangian is a scalar field on the spacetime of kinetic states, are invariant under the transformation laws written above.

A less elaborate way is to use the tengent bundle of the configuration space, but this approach is limitative, because also the configuration space does not exist individually, but is a canonical fiber of a fiber bundle: the configuration spacetime.

This approach, as it removes all notational ambiguities, makes very clear the passage to the Hamiltonian formalism.

The Hamiltonian formalism assumes tha there is a space, the spacetime of phases whose local coordinates are, in fact, $$(t,q,p)$$. These natural charts form a preferred atlas on the spacetime of phases and define it.

These local coordinates are associated to the Lagrangian local coordinates $$(t,q,\dot{q})$$ by means of the Legendre diffeomorphism when a Lagrangian $$L(t,q,\dot{q}))$$ is given

$$Leg: (t,q,\dot{q}) \to (t(t,q,\dot{q}), q((t,q,\dot{q})), p((t,q,\dot{q}))$$ defined as $$t=t$$ $$q^k= q^k$$ $$p_k = \frac{\partial L(t,q,\dot{q})}{\partial \dot{q}^k}\:.$$

The basic fact is now that $$\gamma : I \ni t \mapsto (t, q(t),\dot{q}(t)) \in \mathbb{R}\times \mathbb{R}^n\times \mathbb{R}^n$$ satisfies the EL equations written above if and only if $$\hat{\gamma}(t) := Leg(\gamma(t))$$ satisfies the Hamiltonian equations $$\left.\frac{d}{dt}\right|_{\hat{\gamma}(t)}q^k = \left.\frac{\partial H(t,q,p)}{\partial p_k}\right|_{\hat{\gamma}(t)}$$ $$\left.\frac{d}{dt}\right|_{\hat{\gamma}(t)} p_k= -\left.\frac{\partial H(t,q,p)}{\partial q^k}\right|_{\hat{\gamma}(t)}$$ Notice that I accurately avoided to indicate the temporal derivatives with the dot, since the dot denotes a Lagrangian coordinate! For instance $$\dot{p}$$ simply does not exist in this formalism: in particular it is not a Hamiltonian coordinate!

The Hamiltonian function $$H(t,q,p)$$ is constructed out of $$L(t,q, \dot{q})$$ by inverting $$Leg$$ in particular so that $$\dot{q}^k=\dot{q}^k(t,q,p)$$ is a known function: $$H(t,q,p) := \sum_{k=1}^np_k \dot{q}^k(t,q,p)- L(t,q, \dot{q}(t,q,p))$$

The spacetime of phases has a nature that is independent of any Lagrangian one uses. Natural local coordinate systems are connected by the transformation laws

$$\overline{t} = t+c$$ $$\overline{q}^k = \overline{q}^k(t,q)$$ $$\overline{p}_k =\sum_{j=1}^n \frac{\partial q^j }{\partial \overline{q}^k} p_j\:.$$

These relations guarantee that the Legendre transformation is actually global and not only local.

1. On one hand, the Lagrangian $$L(q,v,t)$$ is a function of the position$$^1$$ $$q$$, the velocity $$v$$ and the time $$t$$.

2. On the other hand, the Lagrangian action $$S[q] ~:=~ \int_{t_i}^{t_f}\mathrm{d}t \ L(q(t),\dot{q}(t),t)$$ is a functional of the whole whole (perhaps virtual) path$$^1$$ $$q:[t_i,t_f]\to\mathbb{R}^n$$.

For more details, see e.g. my related Phys.SE answer here. There is a similar story for the Hamiltonian formulation.

--

$$^1$$ Notabene: Be aware that in the physics literature the same notation is often used for a function, a value of a function, and the codomain variable.