# Error in evaluating $\int \left( \frac{df}{dx} \right)^2 dx$.

I am playing around with some integrals and I am in need of helping to spot an error in my manipulations.

Let $$f:\mathbb R \rightarrow \mathbb R$$ be an arbitrary $$C^\infty$$ (infinitely differentiable) and consider the task of integrating $$\int ( \frac{df}{dx} )^2 dx$$.

Note: I use the abbreviations WLOG (without loss of generality) and COI (constant of integration) below.

\begin{align} \int dx\ \left( \frac{df}{dx} \right)^2 & = \int df\ \frac{df}{dx} \\ &= \int df \int dx\ \frac{d^2f}{dx^2} \\ &= \int dx \int df\ \frac{d^2f}{dx^2} & \text{let u=\frac{df}{dx}, so du = \frac{d^2 f}{dx^2}\ \frac{dx}{df}\ df} \\ &= \int dx\ \int du\ u \\ &= \int dx\ \left[ \frac{u^2}{2} + \frac{C}{2} \right] & \text{WLOG let \frac{C}{2} \in \mathbb R be COI} \\ &= \int dx\ \left[ \frac{1}{2} \left( \frac{df}{dx} \right)^2 + \frac{C}{2} \right] \\ &= \frac{Cx}{2} + \frac K2 +\frac{1}{2} \int dx\ \left( \frac{df}{dx} \right)^2 & \text{WLOG let \frac{K}{2} \in \mathbb R be COI} \\ &= Cx + K \end{align}

It is obviously nonsense to state that $$\int ( \frac{df}{dx} )^2 dx$$ must be a linear function in $$x$$ for all functions $$f$$, so where did I go wrong here?

• Hard to say, since everything here is informal in the first place, and pure symbolism. Maybe if you replaced indefinite integrals with definite ones, it'd make more sense. In my opinion, it's the second line when it all crumbles. When you introduce an indefinite integral under another indefinite integral. – Jakobian Sep 23 '18 at 0:08
• Hmm interesting. Somehow it never occurred to me that multiple indefinite integrals weren't valid. I can try to see what will happen if I try to rephrase this proof in terms of definite integrals instead of indefinite ones. – Trevor Kafka Sep 23 '18 at 0:25
• I'm confused at $∫ (f')^2 dx = ∫ f' df$, is this substitution? – Calvin Khor Sep 23 '18 at 0:37
• @TrevorKafka Don't see how you justify the $\,3^{rd}\,$ $\,=\,$ sign. Try it with a simple case like $\,f(x)=e^{2x}\,$. – dxiv Sep 23 '18 at 2:40
• @dxiv I think you've spotted it. I naïvely treated it as a multi integral where you can just swap the order of integration without issue. I think this only works when the differentials are independent of each other. $df$ and $dx$ are dependent. It's clearer to see that $\int df \int dx \ne \int dx \int df$ if one notes that clearly $\int dx\ f' \int dx \ne \int dx\ \int dx\ f'$. – Trevor Kafka Sep 23 '18 at 3:00

Suppose $$f$$ is increasing on $$[0,1]$$, is in $$C^2[0,1]$$, and $$f'(x) = u(f(x))$$ for some $$u\in C^1[f(0),f(1)]$$. Then for $$y\in [0,1]$$, \begin{align} \int_0^y (f'(x))^2 dx &= \int_0^yu(f(x))f'(x)dx = \int_{f(0)}^{f(y)}u(\tilde f)d\tilde f \\&= \int_{f(0)}^{f(y)} u(f(0)) + \int_{f(0)}^\tilde f u'(z) dz d\tilde f\end{align} So we see that we need $$u(f(0)) = 0$$. Note $$f''(x) = u'(f(x)) f'(x)$$ which means that $$u'(z) = \frac{f''(f^{-1}(z))}{f'(f^{-1}(z))}$$ Attempting to proceed with $$u(f(0)) = 0$$, we can invert the change of variables $$z = f(\tilde x)$$ $$\int_0^y (f')^2 dx = \int_{f(0)}^{f(y)}\int_0^{f^{-1}(\tilde f)}f''(\tilde x) d\tilde x d\tilde f$$ which is similar to what you have. the exchange of integrals now gives $$\int_{f(0)}^{f(y)}\int_0^{f^{-1}(\tilde f)}f''(\tilde x) d\tilde x d\tilde f = \int_{0}^{y} f''(\tilde x) \int_{f(\tilde x)}^{f(y)} d\tilde f d\tilde x$$ where $$f''$$ is written as a function of $$\tilde x$$, not of $$\tilde f$$, so it doesn't seem like it can be meaningfully involved in another change of variables for the $$d\tilde f$$ integral.
\begin{align} \|f'\|_{L^2}^2 & \le |f'(0)||f(1) - f(0)| + \int_0^1 |f''(x)| |f(1) - f(x)| dx \\ &\le 2\|f'\|_{L^\infty}\|f\|_{L^\infty}+ 2\|f''\|_{L^1} \|f\|_{L^\infty}\end{align}
• @TrevorKafka Its FTC, note that $f(x) = \int_0^x f'$ only if $f(0) = 0$. cf. $\int_a^b f'(x) dx = f(b) - f(a)$ – Calvin Khor Sep 23 '18 at 3:10