# How to deal with explicit time dependence of the Lagrangian?

Clearly, if the Lagrangian in explicitly time dependent, the Euler-Lagrange equations being satisfied does not extremise the action. I am unclear as to how to deal with systems with an explicitly time-dependent Lagrangian. We would need a condition of the sort

$$\delta q_i (\frac{\partial L}{\partial q_i}-\frac{d^r}{dt^r}\frac{\partial L}{\partial q_i^{(r)}}) + \frac{\partial L}{\partial t}\delta t=0$$

to be satisfied, where here the $$q-i$$ are the generalised coordinates and as many time derivatives of them are taken (i.e. r is a function of i) as needed. Summation convention is used.

Is it possible to find the 'phase space' (with a less strict definition) trjectory like this? It seems that the changes in the generalised coordinates are now coupled...

I consdered maybe splitting the action integral up into time steps over which $$\frac{\partial L}{\partial t}\delta t=0$$, but then we cannot guarantee that the boundary conditions (which are given only for the end points of the whole time interval) make the additional terms from integrating by parts vanish, or indeed we cannot even slve for the evolution of the generalised coordinates over the small time interval without the boundary conditions....

• What do you mean? The Euler-Lagrange (EL) equations also work if the Lagrangian $L$ depends explicitly on time $t$. See e.g. this Phys.SE post. Oct 27 '18 at 10:08
• @Qmechanic If your goal is to find a Lagrangian which extremises the action, then using the straghtforward variational principle it is clear that the Euler Lagrange equations being satusfied no longer extremise the action. You have an additional $\frac{\partial L}{\partial t}\ldelta t}$ term in the variational principle that remains uncancelled and is non-zero. This means that $\delta S$ is non-zero.
– Meep
Oct 27 '18 at 10:48

The Euler-Lagrange equations in the case of explicitly time dependent Lagrangian are the same as the ones without explicit time dependence. You are getting mixed up with what is getting varied and how the variation should be carried out.

Approach 1. You do not vary time. This is because you want to find how the configuration $$q \in \mathbb{R}^n$$ of your system evolves in time $$t \in \mathbb{R}$$, so you are looking for a map $$q : [t_1, t_2] \to \mathbb{R}^n$$ that describes this time evolution, starting at point $$q_1$$ and ending at point $$q_2 \in \mathbb{R}^n$$. So Lagrangian mechanics tells you that you want to find a curve of the form $$\gamma = \Big\{ \, \big(\,t, \,q(t) \,\big) \, \in \, \mathbb{R} \times \mathbb{R}^n\,\, :\, \, t \in [t_1, t_2] \Big\}$$, such that $$q(t_1) = q_1$$ and $$q(t_2) = q_2$$, that optimizes the action functional $$S[\gamma] = \int_{t_1}^{t_2}\, L\Big( q(t), \, \frac{d q}{dt}(t), \, t\Big) \,dt$$ defined for any smooth curve $$\gamma$$ of the form written above. Then if you get any two such curves $$\gamma = \Big\{ \, \big(\,t, \, q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ and $$\tilde\gamma = \Big\{ \, \big(\,t, \, \tilde q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ between the points $$q_1$$ and $$q_2$$, then there exist one parameter family of such curves $$\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ where $$q(t, 0) = q(t)$$ and $$q(t,1) = \tilde q(t)$$. So basically this tells you that any two curves of the form $$\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$, among which is the solution you are interested in, can be included into a one parameter family (a variation) of the type $$\gamma_{\epsilon} = \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ So the curves that optimize the action $$S[\gamma]$$ are among the critical points of $$S[\gamma]$$. The critical points of $$S[\gamma]$$ are the zeroes of its derivative. To find the derivative of $$S[\gamma]$$ you have to take an arbitrary family $$\gamma_{\epsilon}= \Big\{ \, \big(\,t, \, q(t, \epsilon)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ that connects $$q_1$$ to $$q_2$$ and take $$\frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0}$$ i.e. first differentiate with respect to $$\epsilon$$ and then set $$\epsilon = 0$$. Thus, in order to find the critical curves $$\gamma$$ of the functional $$s[\gamma]$$, you want to find those $$\gamma = \Big\{ \, \big(\,t, \, q(t)\, \big) \, : \, t \in [t_1, t_2] \, \Big\}$$ between $$q_1$$ and $$q_2$$ for which \begin{align} 0 = \delta S[\gamma] =& \frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0} = \frac{\partial}{\partial \epsilon}\, \int_{t_1}^{t_2}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \frac{\partial}{\partial \epsilon}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial}{\partial \epsilon} \frac{d q^k}{dt} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ \end{align} By the product rule of derivatives $$\frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) = \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon}$$ and therefore $$\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} = - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right)$$ Also, when you set $$\epsilon =0$$ then $$\delta q^k(t) = \frac{\partial q^k}{\partial \epsilon}(t, \epsilon)\Big|_{\epsilon =0}$$ and you get the expression \begin{align} 0 = \delta S[\gamma] =& \frac{\partial}{\partial \epsilon}\, S[\gamma_{\epsilon}] \Big|_{\epsilon = 0} = \frac{\partial}{\partial \epsilon}\, \int_{t_1}^{t_2}\, L\Big( q(t, \epsilon), \, \frac{d q}{dt}(t, \epsilon), \, t\Big) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} + \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{d}{dt} \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \right)\, \frac{\partial q^k}{\partial \epsilon} + \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \delta q^k(t) - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \right)\, \delta q^k(t) \right)\, dt +\\ &+ \int_{t_1}^{t_2}\, \frac{d}{dt}\left(\, \frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \dot{q}, \, t\Big) \frac{\partial q^k}{\partial \epsilon} \,\right) \,dt \, \Big|_{\epsilon = 0} = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \delta q^k(t) - \left(\, \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \right)\, \delta q^k(t) \right)\, dt + 0 = \\ =& \int_{t_1}^{t_2}\, \left( \,\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) - \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) \,\right)\,\delta q^k(t) dt \end{align} which has to hold for any arbitrary smooth curve $$\delta q(t)$$. This is possible if and only if $$\frac{\partial L}{\partial q^k}\Big( q(t), \, \dot{q}(t), \, t\Big) - \frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q(t), \, \dot{q}(t), \, t\Big) = 0$$ for all $$k=1, ..., n$$. In other words, a curve $$\gamma = \Big\{\,(\, t, \, q(t)\,) \, : \, t \in [t_1,t_2]\,\Big\}$$ connecting $$q_1$$ to $$q_2$$ is a critical curve for the action $$S[\gamma]$$, i.e. $$\delta S[\gamma] = 0$$ if and only if it satisfies the system of differential equations $$\frac{d}{dt}\,\frac{\partial L}{\partial \dot{q}^k}\Big( q, \, \frac{dq}{dt}, \, t\Big) = \frac{\partial L}{\partial q^k}\Big( q, \, \frac{dq}{dt}, \, t\Big)$$ for $$k=1, ..., n$$. The latter system of differential equations is exactly the system of Euler-Lagrange equations.

Approach 2. To find the evolution of your system, you may parametrize the curves $$\gamma = \Big\{\,(\, t, \, q(t)\,) \, : \, t \in [t_1,t_2]\,\Big\}$$ in terms of another parameter $$s \in \mathbb{R}$$ and so time becomes $$t=t(s)$$ your evolution becomes $$q(s) = q(t(s))$$. Consequently, the curves you are dealing with are of the more general form $$\gamma = \Big\{\,(\, t(s), \, q(s)\,) \, : \, s \in [s_1,s_2]\,\Big\}$$. But then $$\frac{dq^k}{dt}(t) = \frac{dq^k}{ds}(s)\frac{ds}{dt}(t) =\frac{\,\, \frac{dq^k}{ds}(s)\,\,}{\frac{dt}{ds}(s)} = \Big(\, \frac{dt}{ds}(s)\,\Big)^{-1} \frac{d q^k}{ds}(s)$$ and $$dt = \frac{dt}{ds}(s)\, ds$$ and therefore, the action becomes $$S[\gamma] = \int_{t_1}^{t_2}\, L\Big( q(t), \, \frac{d q}{dt}(t), \, t\Big) \,dt = \int_{s_1}^{s_2}\, L\left( q(s), \, \frac{d q}{ds}(s)\, \Big(\,\frac{dt}{ds}(s)\,\Big)^{-1}, \, t(s) \,\right) \,\frac{dt}{ds}(s)\, ds =$$ $$= \int_{s_1}^{s_2}\, \tilde{L}\left(\, q(s), \, t(s), \, \frac{d q}{ds}(s), \, \frac{d t}{ds}(s)\,\right) \,ds$$ where the new Lagrangian $$\tilde L$$ is $$\tilde{L}\left(\, q, \, t, \, \frac{d q}{ds}, \, \frac{d t}{ds}\,\right) = L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \,\frac{dt}{ds}$$ Observe that this last function $$\tilde L$$ is not explicitly dependent on the new variable $$s$$, so the critical curves should satisfy the usual Euler-Lagrange equations but this time with respect to the variable $$s$$ and with one extra equation for $$t$$. However, if you invert the function $$t=t(s)$$, turning it into $$s=s(t)$$, you will eliminate $$s$$ and you will end up with the same Euler-Lagrange equations which I derived in Approach 1 plus one extra equation for $$t$$, decoupled from them. So you drop it and you arrive at the same result as Approach 1.

Indeed, the Euler Lagrange equations for $$\tilde L$$ are \begin{align} &\frac{d}{ds}\, \frac{\partial \tilde{L}}{\partial q^{'k}}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) = \frac{\partial \tilde{L}}{\partial q^k}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big)\\ &\frac{d}{ds}\, \frac{\partial \tilde{L}}{\partial t'}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) = \frac{\partial \tilde{L}}{\partial t}\Big(\,q, t, \frac{d q}{ds}, \frac{dt}{ds} \,\Big) \end{align} for $$k = 1, ..., n$$. Now plug in the expression for $$\tilde L$$ in terms of $$L$$ and carefully carry out all the chain rule differentiation and you get \begin{align} &\frac{d}{ds}\left( \frac{\partial }{\partial q^{'k}} \,\left[L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds}\right] \right) = \frac{\partial }{\partial q^k}\left[ L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\right]\\ &\frac{d}{ds}\left( \frac{\partial }{\partial t'} \,\left[L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds}\right] \right) = \frac{\partial }{\partial t}\left[ L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\right] \end{align} where $$q^{'k}$$ is a short notation for $$\frac{dq^k}{ds}$$. First, by applying chain rule and carrying out the differentiation, we get \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \, \frac{\partial }{\partial q^{'k}}\left[\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}\right]\,\right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \frac{\partial}{\partial t'}\left[\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}\right] + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} and then the equations simplify to \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\frac{dt}{ds} \Big(\,\frac{dt}{ds}\,\Big)^{-2}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} and after that we get \begin{align} &\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds}\\ &\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds}, \, t \,\right) \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \frac{dt}{ds} \end{align} Since $$\Big(\frac{dt}{ds}\Big)^{-1} = \frac{ds}{dt}$$, we can multiply both side of the equations by $$\Big(\frac{dt}{ds}\Big)^{-1}$$ and obtain \begin{align} &\frac{ds}{dt}\frac{d}{ds}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\\ &\frac{ds}{dt}\frac{d}{ds}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^j}{ds} + L\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right)\,\right) = \\&= \frac{\partial L}{\partial t}\left( q, \, \Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q}{ds}, \, t \,\right) \end{align} Finally, invert the function $$t=t(s)$$ into $$s=s(t)$$ and recall that then $$\frac{ds}{dt} \frac{d}{ds} = \frac{d}{dt}$$ and $$\Big(\,\frac{dt}{ds}\,\Big)^{-1}\frac{d q^k}{ds} = \frac{d q^k}{dt}$$. Now, we arrive at the equations \begin{align} &\frac{d}{dt}\left( \frac{\partial L}{\partial \dot{q}^k}\left( q, \, \frac{d q}{dt}, \, t \,\right)\, \right) = \frac{\partial L}{\partial q^k}\left( q, \, \frac{d q}{dt}, \, t \,\right)\\ &\frac{d}{dt}\left(-\, \frac{\partial L}{\partial \dot{q}^j}\left( q, \, \frac{d q}{dt}, \, t \,\right) \frac{d q^j}{dt} + L\left( q, \, \frac{d q}{dt}, \, t \,\right)\,\right) = \frac{\partial L}{\partial t}\left( q, \, \frac{d q}{dt}, \, t \,\right) \end{align} The first system of equations are the Euler-Lagrange equations for $$k = 1, ..., n$$. The last equation is in fact the evolution of the total energy of the system. When $$L$$ does not depend on $$t$$ explicitly, the right hand side of this last equation is zero and we end up with the conservation of energy of the system.

1. The Euler-Lagrange (EL) equations also work if the Lagrangian $$L$$ depends explicitly on time $$t$$. See e.g. this Phys.SE post.

2. In the stationary action principle (which leads to EL eqs.), there is no variation $$\delta t=0$$ of the integration variable $$t$$ (usually time), and the integration region $$[t_i,t_f]$$ is kept fixed.

3. However, there does exist other variational principles where the integration region $$[t_i,t_f]$$ is not fixed, e.g. Maupertuis' principle aka. the principle of abbreviated action. (Of course this means that sometime else should be kept fixed, in this case the energy $$E$$.)