# Differentiating a function of a variable with respect to the variable's derivative

Suppose $x:\mathbb{R}\to \mathbb{R}$ is parameterised by $\lambda$. What does it mean to take a derivative of a function $f(x)$ with respect to $\dot{x} = \frac{dx}{d\lambda}$. i.e. what does $\frac{df(x)}{d\dot{x}}$ mean? How do we compute it?

Is $\frac{d}{d\dot{x}}=\frac{d}{d\frac{dx}{d\lambda}}=^{??} \frac{d\lambda}{dx}=^{??} 0$ ???

For example, how would one compute $\frac{d}{d\dot{x}} e^x$?

(This question has arisen from an undergraduate relativity course, in trying to compute the Euler-Lagrange equations, given a certain metric).

• As someone who studied both mathematics and physics to a master's degree: Don't expect correct formality when physicists use math. You need to see what is meant, not what is written. Here, as explained in juan arroyo's answer, $\dot x$ is meant as an variable (sort of) independent from $x$. It just happens to, as a function, equal to the derivative of $x$.:) Jan 5, 2017 at 20:29
• Jan 5, 2017 at 20:48
• Jan 24, 2017 at 19:54

I think many answers are missing the central point of confusion here. Your instincts are correct: in general the notation $\frac{\partial L}{\partial\dot{x}}$ makes absolutely no mathematical sense whatsoever. A mathematician would probably not use this notation given a choice.

But the Lagrangian is special because it is given as a function of $x$ and $\dot{x}$. So the notation you're seeing can be justified in this context, using the following protocol.

First, define

$$v(\lambda) = \dot{x}(\lambda)=\frac{dx}{d\lambda}$$

Then, think of the symbol $\dot{x}$ as the same thing as $v$; in other words, anywhere you see $\dot{x}$, replace it in your head or on paper with $v$.

Now, the Lagrangian is usually given as a function of two variables $L=L(x,\dot{x})$, which you can rewrite

$$L(x,v)$$

Thus $L$ is just a function of two independent variables $x$ and $v$, ie. it's a function $\mathbb{R}^2\to\mathbb{R}$. So rewriting $\frac{\partial L}{\partial \dot{x}}$ as

$$\frac{\partial L}{\partial v}$$

gives us something sensible.

To sum up, the only reason the notation $\frac{\partial f}{\partial \dot{x}}$ works is because $f$ is given as a function of $x$ and $\dot{x}$. This notation would not make sense for arbitrary smooth functions.

Be careful with your second line it's best practice to keep it like $\frac{d}{d\dot{x}}$. It is really as simple as it looks. Given some Langrangian say $L(x,\dot{x})=\frac{1}{2}m\dot{x}^2 - V(x)$. Then $\frac{\partial L}{\partial \dot{x}} = m\dot{x}$.

• Why is $\frac{\partial}{\partial \dot{x}} V(x) = 0$ ??
– vkan
Jan 5, 2017 at 13:40
• Ah, it's an arbitrary function of $x$ only i.e. it contains no terms that include $\dot{x}$. I could have left it out I just know that it is a common Langrangian that you might recognise. It's the potential energy function. Jan 5, 2017 at 13:45
• With that in mind, what do you think $\frac{d}{d\dot{x}}e^{x}$ would be now? Jan 5, 2017 at 13:46
• According to your explanation it would be zero. But, I'm still unsure, since couldn't one say that $\dot{x}$ is related to $x$ so there may be some dependence between them?
– vkan
Jan 5, 2017 at 13:49
• Well they are related by the parameter $\lambda$. But that's not the Q. If we define $f(x)=e^x$ and want to compute $\frac{d}{d\dot{x}}f(x)$, we are asking how $f(x)$ will vary with $\dot{x}$ and by it's definition it won't vary. It we asked the question how would it vary with the parameter $\lambda$ that would be different. Jan 5, 2017 at 13:53

In physics and more generally in functional analysis, when varying an action with respect to the derivative of a variable, say $\dot x$ in your case, we treat $x$ and $\dot x$ as entirely separate. That is,

$$\frac{d}{dx}f(\dot x) = 0.$$

Likewise, $\frac{d}{d \dot x}f(x)= 0$. This applies to more complicated cases, like for example,

$$\frac{\partial}{\partial \phi} f(\partial_\mu\phi) = 0$$

in field theory. It is only after we have derived the Euler-Lagrange equations that we identify, $$\dot x = \frac{d}{dt}x$$

in order to solve the equations of motion, or say, quantise the system.

• Why do you treat $x$ and $\dot{x}$ separately initially, which would give one the right to say $\frac{d}{d\dot{x}}f(x)=0$?
– vkan
Jan 5, 2017 at 14:29

This answer focus on the important issue of the question, which is explained in its body by OP.

Let me present an alternative way of thinking, which purges the "variable" mess, to clear up the confusion arising. Let's consider the Lagrangian $L=Kin-Pot.$

The Lagrangian, per se, is a function $L: \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$ (let's assume it doesn't depend on time, which would simply mean $L: \mathbb{R} \times \mathbb{R}^n \times \mathbb{R}^n \to \mathbb{R}$). No derivatives involved. In this case, it is $$L(p,q)=\frac{1}{2}mq^2-V(p).$$ Now, let $\widetilde{\gamma}$ be the function $t \mapsto (\gamma(t),\dot{\gamma}(t))$.

The Euler-Lagrange equations then state that $$(\nabla_1L) \circ \widetilde{\gamma} -\big((\nabla_2L)\circ \widetilde{\gamma}\big)'=0,$$ where $\nabla_1L$ means the first $n$ coordinates of the gradient and $\nabla_2L$ means the last $n$ coordinates.

Let's compute this in our case. It is clear that $\nabla_1L(p,q)=-\nabla V(p)$, and $\nabla_2 L(p,q)=mq$. Then the Euler-Lagrange equations say that $$(\nabla_1L) \circ \widetilde{\gamma} -\big((\nabla_2L)\circ \widetilde{\gamma}\big)'=0$$ $$\implies (\nabla_1L) (\gamma(t), \dot{\gamma}(t)) -\big((\nabla_2L)(\gamma(t),\dot{\gamma}(t))\big)'=0$$ $$\implies -\nabla V(\gamma(t)) -(m \dot{\gamma}(t))'=0$$ $$\implies -\nabla V(\gamma(t))=m\ddot{\gamma }(t),$$ which is what we would expect.

"Differentiating with respect to $\dot{x}$" is just a quicker way to think of the above process. However, it is naturally confusing, since the details of the process go down under the rug.

• Hi, although I am sure this makes sense, I am not familiar enough with the notation you have used to understand this easily. The form of Euler-Lagrange equations I have seen is the following: For coordinates $x^i$ parametrised by $\lambda$, Lagrangian $L=\left (\frac{ds}{d\lambda}\right )^2$, where $ds^2$ is the line element, the Euler Lagrange equation is given by $\frac{d}{d\lambda} \left(\frac{\partial L}{\partial \dot{x}^i} \right ) - \frac{\partial L}{\partial x^i} = 0$. Would you be able to explain the above in this context? Thank you.
– vkan
Jan 5, 2017 at 15:03