Pick an integer $n\geq 3$, a constant $r>0$ and write $B_r = \{x \in \mathbb{R}^n : |x| <r\}$. Suppose that $u \in C^2(\overline{B}_r)$ satises \begin{align} -\Delta u(x)=f(x), & \qquad x\in B_r, \\ u(x) = g(x), & \qquad x\in \partial B_r, \end{align} for some $f \in C^1(\overline{B}_r)$ and $g \in C(\partial B_r)$
I have to show that $$ u(0) = \frac{1}{n \alpha(n) r^{n-1}} \int_{\partial B_r} g(x) dS(x) + \frac{1}{n(n-2)\alpha(n)} \int_{B_r} \left( \frac{1}{|x|^{n-2}} - \frac{1}{r^{n-2}} \right) f(x) dx, $$ Where $\alpha(n)$ is the volume of the unit ball and $n\alpha(n)$ is the surface area of its boundary, the unit sphere.Then I'm given the hint to modify the proof of the mean value theorem. With the final remark to remember that $\vec{\nabla} \cdot (v \vec{w}) = (\vec{\nabla}v) \vec{w} + v\vec{\nabla}\cdot \vec{w}$.
Now the mean value theorem from the book Partial Differential Equations by Evans states that
$$ u(x) = \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(x,r)} u \, dS = \frac{1}{\alpha(n)r^n}\int_{B(x,r)} u \, dy, $$ which is valid for harmonic functions. Thus in case $f(x)=0$ we seen that the statement holds.
For the proof of the mean value theorem defines the function $$ \phi(r) := \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(x,r)} u(y) dS(y) = \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(0,1)} u(x+rz) dS(z). $$
Then it is shown that $\phi'(r)=0$, and so $$ \phi(r) = \lim_{t\rightarrow 0} \phi(t) = \lim_{t\rightarrow 0} \frac{1}{n \alpha(n) t^{n-1}}\int_{\partial B(x,t)} u(y) dS(y) = u(x). $$
The proof that $\phi'(x)$ is indeed constant is done with Green's formulas \begin{align} \phi'(r) &= \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(0,1)} D u(x+rz)\cdot z \, dS(z) \\ &= \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(x,r)} D u(y)\cdot \frac{y-x}{r} \, dS(y) \\ &= \frac{1}{n \alpha(n) r^{n-1}}\int_{\partial B(x,r)} \frac{\partial u}{\partial \nu} \, dS(y) \\ & = \frac{1}{n \alpha(n) r^{n-1}}\int_{B(x,r)} \Delta u \, dy =0. \end{align}
However for the non harmonic problem I'm given the last equation becomes $$ \frac{1}{n \alpha(n) r^{n-1}}\int_{B(x,r)} \Delta u \, dy = \frac{1}{n \alpha(n) r^{n-1}}\int_{B(x,r)} f(x) \, dy. $$
What I probably should do is change the function $\phi$, but I can't seem to figure out how.
Any help will be much appreciated.