How to properly take derivatives in calculus of variations (Euler-Lagrange formula)

Why is it that, in calculus of variations (specifically Euler-Lagrange), we can take the derivative of a function with respect to a function $f$ and set this derivative to $0$ if only $f'$ appears in $L$? For example the standard distance formula:

$$D = \int dx \sqrt{1 + f'(x)^2}$$

The Euler-Lagrange formula is thus:

$\frac{\partial L}{\partial f} - \frac{d}{dx} \frac{\partial L}{\partial (\frac{\partial f}{\partial x})} = 0.$

In the Wikipedia example it asserts that "Since f does not appear explicitly in $L$, the first term in the Euler-Lagrange equation vanishes for all $f(x)$". I have a hard time understanding this because to me it feels like $f'(x)$ should depend on $f$, and so just setting the derivative to be $0$ goes against my intuition. Is there a way I could think about this to have it make more sense?

• It is obvious from the properties of the partial derivative that since $f$ does not appear explicitly in $L$, the first term in the Euler-Lagrange equation vanishes for all $f(x)$. Setting $f^{'}(x)=0$ gives a (maximum or a) minimum for the function $f$.
– user122283
Mar 3 '14 at 4:09
• Here you have $L(f,g) = \sqrt{1 + g^2}$. Hence $L_f(f,g) = 0$. It is true that there is a relationship between the function $t \mapsto f(t)$ and $t \mapsto \dot{f}(t)$, but that has nothing to do with the functional form of $L$. Mar 3 '14 at 4:12
• @SanathDevalapurkar It is not obvious to me why $df'/df$ is $0$. Mar 3 '14 at 4:14
• Just to remind you of a typo, the integrand should be $\sqrt{1+(f')^2}$ for distance. Mar 3 '14 at 4:14

The notation is really confusing. What it means is the following: the Lagrangian $L$ is a function $$\mathbb R \times \mathbb R\times \mathbb R\to \mathbb R,\ \ (x, p, q)\mapsto L(x, p, q).$$

If you have a function $f(x)$, then you come up with another function of $x$:

$$x\mapsto L(x, f(x), f'(x)).$$

The Euler-Lagrangian equation, to be clear, should be

$$\frac{\partial L}{\partial p} \big(x, f(x), f'(x)\big) - \frac{\partial }{\partial x}\bigg(\frac{\partial L}{\partial q} \big(x, f(x), f'(x)\big)\bigg)=0\ .$$

In your example, $L(x, p, q) = \sqrt{1+q^2}$. Hence it does not depend on $p$ (Or in your word, does not depend explicitly on $f(x)$). Hence $\frac{\partial L}{\partial p}=0$ and thus

$$\frac{\partial L}{\partial p} \big(x, f(x), f'(x)\big) =0 \ .$$

I think this would explain the Euler Lagrangian equation in a better way. People likes to write $\frac{\partial }{\partial f}$ as they do not want to introduce new variables $p, q$.