Mean Value Property of Harmonic Function on a Square A friend of mine presented me the following problem a couple days ago:
Let $S$ in $\mathbb{R}^2$ be a square and $u$ a continuous harmonic function on the closure of $S$.  Show that the average of $u$ over the perimeter of $S$ is equal to the average of $u$ over the union of two diagonals.
I recall that the 'standard' mean value property of harmonic functions is proven over a sphere using greens identities.  I've given this one some thought but I haven't come up with any ideas of how to proceed.  It's driving me crazy! Maybe it has something to do with the triangles resulting from a diagonal?  Any ideas?
 A: This is a re-interpretation of Ray Yang's answer, which also shows how the result can be generalized to other polygons. Introduce the function
$$v(x,y)=(1-\max(|x|,|y|))^+ ,\qquad (x,y)\in\mathbb R^2$$
This is a compactly supported Lipschitz function with support $Q=[-1,1]\times [-1,1]$. Its graph is a pyramid with $Q$ as the base.
If $u$ is harmonic in a neighborhood of $Q$, then integration by parts yields
$$0=\int_{\mathbb R^2} v\,\Delta u = \int_{\mathbb R^2} u\,\Delta v \tag{1}$$
By considering $u(\alpha x,\alpha y)$ with $\alpha\to 1^-$, we extend (1) to functions continuous in $Q$ and harmonic in its interior. 
It remains to observe that $\Delta v$ is the distribution composed of 


*

*the linear measure on $\partial Q$ 

*$-\sqrt{2}$ times the linear measure on the diagonals of $Q$ 


This follows from considering the discontinuities of the normal derivative of $v$ across the aforementioned lines; elsewhere $v$ is harmonic. One can also save the trouble of calculating the factor of $-\sqrt{2}$ by using the fact that $\int_{\mathbb R^2}\Delta v=0$.

It should be clear that there is nothing special about the square and its diagonals: any piecewise linear compactly supported function gives rise to a similar identity. For example, one can build a pyramid on  top of any regular polygon $P$ and conclude that the average of a harmonic function along $\partial P$ is equal to its average over the union of segments connecting the vertices of $P$ to its center. No computations of slopes are necessary: it's clear that $(\Delta v)^+$ and $(\Delta v)^-$ are constant multiples of linear measure, and the identity $\int_{\mathbb R^2}\Delta v=0$ gives all the information we need.
A: Consider the isosceles right triangles formed from two sides of the square and a diagonal. 
Let's consider the first such triangle. Call the sides $L_1, L_2$ and $H_1$ for legs and hypotenuse; for sake of convenience, our square is the unit square, so we give the triangle $T_1$, legs $L_1$ from $(0,0)$ to $(1,0)$ and $L_2$ from $(1,0)$ to $(1,1)$; the hypotenuse $H_1$ clearly runs from $(0,0)$ to $(1,1)$. 
Now consider the function $\phi(x) = |x-y|$, and we're going to use integration by parts. 
$$ \int_{\partial T_1} u \phi_{\nu} = \int_{\partial T_1} \phi u_{\nu} $$
since $u$ and $\phi$ are both harmonic in the interior of the triangle $T$. Now,
$$ \int_{\partial T_1} u \phi_{\nu} = - \sqrt{2} \int_{H_1} u +  \int_{L_1} u + \int_{L_2} u = \int_{L_1} x u_\nu + \int_{L_2} (1-y) u_\nu = \int_{\partial T_1} \phi u_\nu $$
Perform the same construction on the other triangle $T_2$ with hypotenuse $H_1$, but with legs $L_3$ from (0,0) to (0,1) and $L_4$ from (0,1) to (1,1). We get
$$ \int_{\partial T_2} u \phi_{\nu} = - \sqrt{2} \int_{H_1} u +  \int_{L_3} u + \int_{L_4} u = \int_{L_3} y u_\nu + \int_{L_4} (1-x) u_\nu = \int_{\partial T_2} \phi u_\nu $$
Now consider the function $\psi(x) = |x+y-1|$ on the triangle $T_3$ formed by $L_1$ as above, $L_3$ from (0,0) to (0,1), and $H_2$ from (1,0) to (0,1).
$$ \int_{\partial T_3} u \psi_{\nu} = - \sqrt{2} \int_{H_2} u +  \int_{L_3} u + \int_{L_1} u = \int_{L_3} (1-y) u_\nu + \int_{L_1} (1-x) u_\nu = \int_{\partial T_3} \psi u_\nu $$
Finally, on the triangle $T_4$ formed by $L_4$, $L_2$, and $H_2$ we have 
$$ \int_{\partial T_4} u \psi_{\nu} = - \sqrt{2} \int_{H_2} u +  \int_{L_2} u + \int_{L_4} u = \int_{L_2} y u_\nu + \int_{L_4} x u_\nu = \int_{\partial T_4} \psi u_\nu $$
Summing all these terms together, we get 
$$ -2 \sqrt{2} \int_{H_1 \cup H_2} u + 2 \int_{\partial S} u = \int_{\partial S} u_\nu$$
Since $u$ is harmonic, this must equal 0, which tells us that the average over the diagonals is the average over the perimeter. 
