# Functional derivative of an integral

I don't quite understand the following functional derivative computation when I read a variational inference literature, can someone explain? $$L[q] = E_{q(Y)}[f(Y)]$$ $$\frac{\delta L[q]}{\delta q} = f(Y)$$ Here, $$q(Y)$$ is a probability density function. The original deduction is here, the relevant steps are equation (14) (17) (under assumption (11)).

I don't know why $$q \rightarrow 0 \Rightarrow \int f(Y)q(Y)dY \rightarrow f(Y)$$, it seems $$q$$ acts as a Dirac delta function in the limit case. Am I right? If so, how to argue? Any insights are welcome.

The paper you linked makes several abuses of notation. Here, since the considered functional doesn't contain any derivative of $$q$$, the functional differential is given by $$\delta L[q] = \delta\mathbb{E}_q[f(Y)] = \delta\int q(y)f(y) \,\mathrm{d}y = \int \frac{\partial}{\partial q}\left(q(y)f(y)\right)\delta q(y) \,\mathrm{d}y = \int f(y)\delta q(y) \,\mathrm{d}y,$$ hence $$\frac{\delta L[q]}{\delta q(x)} = \int f(y)\frac{\delta q(y)}{\delta q(x)} \,\mathrm{d}y = \int f(y)\delta(y-x) \,\mathrm{d}y = f(x).$$ The relation $$\frac{\delta q(y)}{\delta q(x)} = \delta(y-x)$$ is the functional analog of the more classical $$\frac{\mathrm{d}x_j}{\mathrm{d}x_i} = \delta_{ij}$$.
• @Abezhiko Found this great explanation today, and I have one question. Could you comment a bit more on why $\frac{\delta q(y)}{\delta q(x)} = \delta (y - x)$ true? Is $\frac{\delta q(y)}{\delta q(x)} = \delta (y - x)$ true for arbitrary function $q$ or is it because of some special property of $q$ being the probability mass function in this specific example? It seems to me that if, for instance, $q(x) = \cos x$, then for some values of inputs (e.g. $x = 0, y = 2\pi$), $\frac{\delta q(y)}{\delta q(x)} \neq 0$ even if $x \neq y$. Commented Jul 19, 2023 at 21:35