# Functional derivative of the square of a functional

How should I compute the functional derivative of the following functional:

$$F(p(x)) = \left[\int\cos(x)p(x)dx - \int\cos(y)q(y)dy\right]^2$$

I know that the functional derivative $$\frac{\delta F}{\delta p(x)}$$ is defined as

$$\left[\frac{d}{d\epsilon}F(p +\epsilon\phi)\right]_{\epsilon=0} = \int \frac{\delta F}{\delta p(x)}\phi(x)dx$$

but I am not sure how the chain rule is defined here in the case of a function of a functional, i.e., what's the functional derivative of $$F = g(H(p(x)))$$ where $$g$$ is a differentiable function and $$H$$ is a functional.

• What is $q(y)$? Is it some fixed function? Commented Nov 29, 2020 at 7:55
• Yes, it can be assumed to be fixed. Commented Nov 29, 2020 at 8:11

The problem you found in the application of the formula for functional derivatives above is due the fact that it is not correct, since it is valid only for particular classes of functionals: the general definition of functional derivative is exactly the right side of the one you tried to use, i.e. $$\frac{\delta F}{\delta p} [p](\phi)\triangleq \left[\frac{\mathrm{d}}{\mathrm{d}\epsilon}F(p +\epsilon\phi)\right]_{\epsilon=0} = \lim_{\epsilon \to 0} \frac{F(p +\epsilon\phi) -F(p)}{\epsilon}\label{1}\tag{1}$$ Said that, applying the definition to the quadratic functional under analysis we get $$\frac{\delta F}{\delta p} [p](\phi) = 2\left[\int\cos(x)p(x)\mathrm{d}x - \int\cos(y)q(y)\mathrm{d}y\right] \int\cos(x)\phi(x)\mathrm{d}x$$ Edit following the comment of the Asker.

In order to clarify some of the doubts pointed out in the comment, I expanded a bit definition \eqref{1} above to analyze in a clearer way its meaning: it states that, in order to calculate the functional derivative of a functional $$F$$ at a "point" $$p$$, you should calculate the ordinary first order derivative of the functional applied to the variation $$p+\epsilon \phi$$, considered as a function of the real variable $$\epsilon$$. This implies that we should proceed in the calculations by using all the ordinary rules for differentiation including the chain rules: thus, when the functional $$F$$ is given by the composition of a ($$C^\infty$$-real valued) function of a real variable and a (real valued) functional $$H$$, i.e. $$F(p)=g\circ H(P)= g\big(H(p)\big),$$ we have that $$\begin{split} \frac{\delta F}{\delta p} [p](\phi) &= \left[\frac{\mathrm{d}}{\mathrm{d}\epsilon}g\big( H(p +\epsilon\phi)\big)\right]_{\epsilon=0} = \lim_{\epsilon \to 0} \frac{g\big( H(p +\epsilon\phi)\big) -g\big( H(p) \big)}{\epsilon}\\ & = \lim_{\epsilon \to 0} \frac{g\big( H(p +\epsilon\phi)\big) -g\big( H(p)\big)}{ {H(p +\epsilon\phi) -H(p)}}\cdot\frac{H(p +\epsilon\phi) - H(p)}{\epsilon}\\ &=\left. \frac{\mathrm{d}g(x)}{\mathrm{d} x}\right|_{x=H(p)}\cdot \left[\frac{\mathrm{d}}{\mathrm{d}\epsilon}H(p +\epsilon\phi)\right]_{\epsilon=0}\\ &=\left. \frac{\mathrm{d}g(x)}{\mathrm{d} x}\right|_{x=H(p)}\cdot \frac{\delta H}{\delta p} [p](\phi) \end{split}$$ which is basically an application (and the basic proof in disguise) of the chain rule formula.

Notes

• An analysis of the general definition of functional derivatives is offered in this Q&A, where you can have a look in order to have more information and some references on the concept.

• Regarding references: almost any book in the calculus of variation includes several examples of calculations of functional derivatives. However, they mostly (if not exclusively) deal with functional of integral type, which are not of the same kind of the functional studied here. Therefore my advice is to have a look at this, this, this and this Q&A which deal with functionals of non integral type. And, apart from consult the references given in the cited Q&A if needed, I advice to look at the first volume [1] of the monograph by Mariano Giaquinta and Stefan Hildebrandt, in my opinion a wonderful reference.

[1] Giaquinta, Mariano; Hildebrandt, Stefan (1996), Calculus of Variations I. The Lagrangian Formalism, Grundlehren der Mathematischen Wissenschaften, 310 (1st ed.), Berlin: Springer–Verlag, pp. xxix+475, ISBN 3-540-50625-X, MR 1368401, Zbl 0853.49001.

• Thanks @Daniele for your answer and thank you for the reference to your other answer. Coming from a non-Math background, I am not sure I understood everything in your other answer but I get the general idea why the representation on Wikipedia may not always be correct. That said, I am specifically interested in the case when it does hold. In that case, may I know how to apply the chain rule for the square of a functional or $F = g(H((p(x)))$ in general. It would be great if you could point me to a reference too, if any. Thanks again for your time! Commented Nov 29, 2020 at 8:09
• @AbdulFatir, I have expanded my answer in order to make things clearer. I have not been able to show you examples where the restricted definition you would like to use is valid, since they o not exist: that formula holds only for integral functionals of the type $$F(p)=\int f( x, p(x), \dot{p}(x), \ddot{p}(x),\ldots)\mathrm{d}x$$ and, in this respect, the third Q&A cited in second note above could be useful. Commented Nov 29, 2020 at 13:45
• Wow! Thanks a lot for the update and references. :) Commented Nov 29, 2020 at 14:48
• @AbdulFatir you are welcome: and an appreciation for your studies in engineering and computer science, which are leading you to deepen your mathematical knowledge, as it was for me and many other engineers. Commented Nov 29, 2020 at 14:57