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).
 A: 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}$. 
A: 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.
A: 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.
A: 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.
