# On differentiating an integral with respect to a function

Let $f,g:\mathbb{R}^n \rightarrow \mathbb{R}$, and let

$$Q = \int \! g(\mathbf{x})f(\mathbf{x}) \, \mathrm{d}\mathbf{x}$$

What is the result of the following differentiation?

$$\frac{\partial}{\partial g}Q = \frac{\partial}{\partial g} \int \! g(\mathbf{x})f(\mathbf{x}) \, \mathrm{d}\mathbf{x}$$

I think that the answer is just $\int \! f(\mathbf{x}) \, \mathrm{d}\mathbf{x}$ [EDIT: I'm Wrong!], but I am afraid that there's something tricky around. Besides, what if I have to find $\partial Q/\partial g$ but the integral is defined over a region of $\mathbb{R}^n$? Is everything as before?

• What does $\partial /\partial g$ mean? For example, let $g(x,y)=x^2+\sin(x^2+y)$. – Pedro Tamaroff Nov 25 '13 at 20:25
• @PedroTamaroff, it just means the derivative of $Q$ with respect to the function $g$. I think this could be useful. – nullgeppetto Nov 25 '13 at 20:30
The answer is $f$. Or more correctly $h \mapsto \int f(x)h(x) dx$. Its a linear map, and the derivative of a linear map is itself.
• Thanks @Stephen! Very enlightening! Could you help me about the other question? What about the case where the integral if over a region $\Omega$? – nullgeppetto Nov 25 '13 at 20:58
• Its the same. Remember $F(f+h) = F(f) + F'(f)(h) + o(|h|)$. Of course, you have to define what you mean by $|h|$ when the space is infinite dimensional (e.g. as in the case of the space of functions on $\Omega$). – Stephen Montgomery-Smith Nov 25 '13 at 21:39