Strong maximum principle for subharmonic functions?

I think I just "proved" the Strong MP for subharmonic functions. But I don't know where things went wrong.

Suppose $U$ is a connected bounded region in $\Bbb R^n$, $u\in C^2(\bar U)$ and $\Delta u\ge 0$ in $U$. Then I try to prove in the following that if $u$ isn't constant, then $\max_{\bar U}u$ is only attained on the boundary $\partial U$.

Proof: for any $x\in U$ and $r>0$ such that $B_r(x)\subset U$, consider the spherical mean $$\phi(r):=\frac1{|\partial B_r(x)|}\int_{\partial B_r(x)} u(y)dS(y)=\frac1{|\partial B_1(0)|}\int_{\partial B_1(0)} u(x+rz)dS(z).$$ Then \begin{align} \phi'(r)&=\frac1{|\partial B_1(0)|}\int_{\partial B_1(0)} Du(x+rz)\cdot zdS(z)\\ &=\frac1{|\partial B_1(0)|}\int_{B_1(0)}\Delta u(x+rz)dz\ge 0 \end{align} Hence $\phi(r)$ is monotonously increasing and in particular $\ge \phi(0^+)=u(x)$ when $r>0$. Hence, if at $x\in U$ is attained the max $M$, then the above mean value inequality forces $u=M$ on a small ball centred at $x$. So $E:=\{x\in U\mid u(x)=M\}$ is open in $U$, but is also closed by continuity. So either $E$ is empty (max is only attained on the boundary) or $E$ is all of $U$ ($u$ is constant).

• Possibly related: math.stackexchange.com/questions/1489107/… – Chee Han Jun 25 '18 at 4:08
• @CheeHan so it is true indeed? My textbook says that whereas strong maximum principle holds for harmonic functions, for subharmonic we only have maximum principle in general. So my textbook is wrong? – Vim Jun 25 '18 at 4:14
• Yes I believe so. – Chee Han Jun 25 '18 at 4:25

I guess your source was referring to "a nonconstant harmonic function has no local maxima", which indeed does not generalize to subharmonic functions. E.g., $u(x) = \max(x_1, 0)$ is a nonconstant subharmonic function on the unit ball which has a local maximum at every point of the left half of the ball.