In the book of Problem complexity and method efficiency in optimization, there
is an excerpt of deriving gradient from the integral making me really confused.
I summarize the short version as follows:
We consider the function $g$ obtained from $f$ on $x \in R^n$ by averaging:
$$g(x) = \int_{\|u\|\leq r}f(x+u) du$$
where $r$ is some fixed radius. Its gradient is found from the formula
$$\nabla g(x) = \int_{\|u\|= r}f(x+u) \frac{u}{\|u\|} ds_r(u)$$
$ds_r(u)$ is an element of a spherical surface of radius $r$ in $R^n$
The question is I do not fully understand how $\nabla g(x)$ is derived, my attempt to do the derivation is move the gradient operation $\nabla$ into the integral of $f$(assume $f$ fulfill the conditions so we can move the gradient operator). But I cannot get the desired gradient $\nabla g(x)$.
EDIT: include the figure.
Here's my short proof.
Consider the Gateaux variation of $f^\rho$ in the derivation $v$. Observe \begin{align} \frac{d}{dt}\ f^\rho(x+tv) \big|_{t=0} =& \frac{1}{|V_\rho|}\frac{d}{dt}\int_{\|\xi\| \leq \rho} f(x+tv+\xi)\ d\xi\ \bigg|_{t=0}\\ =&\ \frac{1}{|V_\rho|} \int_{\|\xi\|\leq \rho} \nabla f(x+\xi)\cdot v\ d\xi, \end{align} then by Green's identity (basically integration by parts) we have \begin{align} \frac{1}{|V_\rho|} \int_{\|\xi\|\leq \rho} \nabla f(x+\xi)\cdot v\ d\xi =&\ -\frac{1}{|V_\rho|} \int_{\|\xi\|\leq \rho} f(x+\xi)\cdot \operatorname{ div }[v]\ d\xi\\ &\ +\frac{1}{|V_\rho|} \int_{\|\xi\|=\rho} f(x+\xi) \frac{\xi \cdot v}{\|\xi\|} dS(\xi)\\ =&\ \frac{1}{|V_\rho|} \int_{\|\xi\|=\rho} f(x+\xi) \frac{\xi \cdot v}{\|\xi\|} dS(\xi). \end{align} Thus, it follows \begin{align} \nabla f^\rho(x)\cdot v = \frac{1}{|V_\rho|} \int_{\|\xi\|=\rho} f(x+\xi) \frac{\xi \cdot v}{\|\xi\|} dS(\xi) \end{align} which means \begin{align} \nabla f^\rho(x)=\frac{1}{|V_\rho|} \int_{\|\xi\|=\rho} f(x+\xi)\frac{\xi}{\|\xi\|} dS(\xi). \end{align}
Edit: To help you with Green's identity, we will use Gauss's divergence theorem which states \begin{align} \int_{\Omega}\nabla f\cdot v + f\operatorname{div}[v]\ dV=\int_{\Omega} \operatorname{div}[fv]\ dV =\int_{\partial\Omega}f\ v\cdot n\ dS \end{align} where $f$ is a function and $n$ is a normal vector to the surface $\partial \Omega$.