TITLE: Differentiating a function of a variable with respect to the variable's derivative
QUESTION [6 upvotes]: 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).

REPLY [11 votes]: 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.