Proving the mean value property for harmonic functions using Green's second identity Suppose that $\phi:\mathbb R^3\to\mathbb R$ is a harmonic function. I am asked to show that for any sphere centered at the origin, the average value of $\phi$ over the sphere is equal to $\phi(0)$. I am also directed to use Green's second identity: for any smooth functions $f,g:\mathbb R^3\to \mathbb R$, and any sphere $S$ enclosing a volume $V$, $$\int_S (f\nabla g-g\nabla f)\cdot dS=\int_V (f\nabla^2g-g\nabla^2 f)dV.$$
Here is what I have tried: left $f=\phi$ and $g(\mathbf r)=|\mathbf r|$ (distance from the origin).  Then $\nabla g=\mathbf{\hat r}$, $\nabla^2 g=\frac1r$, and $\nabla^2 f=0$. Note also that $\int_Sg\nabla f\cdot dS=r\int_S\nabla f\cdot dS=0.$ Then $$\frac{1}{4\pi r^2}\int_S f(x)\,dA=\frac{1}{4\pi r^2}\int_S f(x)\nabla g(x)\cdot dS=\frac{1}{4\pi r^2}\int_S (f\nabla g-g\nabla f)\cdot dS.$$ Using Green's identity, this is equal to $$\frac{1}{4\pi r^2}\int_V (f\nabla^2g-g\nabla^2 f)\,dV=\frac{1}{4\pi r^2}\int_V\frac{f}{r}\,dV.$$ This reminds me of the Cauchy integral formula. If there is indeed some sort of identity that I can use to show that the last integral is equal to $f(0)$? Or is there another way to solve this problem?

There is a simple proof:
Because the region satisfies the Laplace's equation, the potential must be due to some charges outside the sphere. Consider a point charge $q$ at $\vec{r}$, where $r>R$. The average potential is
$$\langle \phi\rangle=\frac{1}{4\pi R^2}\int\frac{q}{4\pi\epsilon_0}\frac{1}{|\vec{r'}-\vec{r}|}da'$$
Write is as
$$\int\frac{q/4\pi R^2}{4\pi\epsilon_0}\frac{1}{|\vec{r}-\vec{r'}|}da'$$
One can readily observe that this is just the potential at $\vec{r}$ due to an amount of charge $q$ uniformly distributed on the spherical surface, which can be obtained easily by Gauss's law and the shell theorem to be
$$\frac{1}{4\pi\epsilon_0}\frac{q}{|\vec{r}|}$$
But this is just the potential due to $q$ at $\vec{r}$ at the center of the sphere.
So the property hold for one single charge outside the sphere. By superposition, it holds for arbitrary charge distribution outside the sphere.
