Maximum principle proof clarification 
Maximum Principle: Let $\Omega$ be a bounded connected region of $\mathbb{R}^m$ with $u$ defined and continuous in $\bar{\Omega}, \,
 \Delta u = 0$. Then $u$ achieves its maximum (and minimum) on
  $\partial \Omega$.

Proof:
$$
\Delta u = 0, \, \Omega
$$
$$
\exists \, x^0: \max_{x \in \bar{\Omega}}u(x)=u(x^0)=M < +\infty
$$


*

*If $x^0 \in \partial \Omega$: The principle holds true.

*If $x^0 \in \Omega$: Using the mean value property:
$$
u(x^0) = \frac{1}{4 \pi \delta^2} \int_\limits{S(x^0,\delta)} u(x) \, ds = M
$$
$$
\Rightarrow u(x) = M, \, \forall x \in S(x^0,\delta) \Rightarrow u(x) = M, \, \forall x \in \Omega. \quad\square 
$$
I don't get the last line of this proof. Why $u(x) = M, \, \forall x \in S(x^0,\delta)$ follows from the mean value property and why $u(x) = M$ holds for every $x$ in $\Omega$ ?
 A: It's due to continuity and connectedness. Let's write this a tiny bit cleaner and fill in the gaps explicitly. 
Suppose that there exists $x_0\in \Omega$, with $u(x_0)=M=\max_{\bar{\Omega}}u,$ and let $S=\{x\in \Omega: u(x)=M\}.$ We will show that this set is non-empty and both open and closed in $\Omega$. If we can show this, then connectedness will imply that $S$ is all of $\Omega.$ Clearly, it is non-empty, as we assumed that $x_0\in S.$ Note $S=u^{-1}\left(\{M\}\right)\cap\Omega$, and since $u$ is continuous, this is relatively closed.
Next,  take any $x_0\in S.$ By the MVP, we have that for any $r>0$ so that $B(x_0,r)\subset\Omega$ holds, we have that 
$$M=u(x_0)=\frac{1}{|B(x_0,r)|} \int\limits_{B(x_0,r)}u\, dy\leq M,$$ since $u\leq M$ on $\bar{\Omega}.$ 
We claim that the above can only be equal if $u=M$ on all of $B(x_0,r)$. Suppose not. Then, there exists $x_1\in B(x_0,r)$ so that $u(x_1)<M.$ By the continuity of $u$, this holds on a neighborhood, which will contradict the equality given by the MVP. Thus, $u(x)=M$ for all $x\in B(x_0,r),$ which shows that $B(x_0,r)\subset S.$ So, $S$ is open in $\Omega$, as well.
