# How to use comparison principle to prove the following inequality about Laplace equation?

Assume that $$\Omega$$ is a bounded connected domain and $$\partial \Omega \in C^{\infty}$$. Denote $$\Gamma_1,\Gamma_2,\cdots,\Gamma_n$$ are $$n$$ connected components of $$\partial\Omega$$. This notation leads to $$\partial \Omega=\cup^n_{i=1}\Gamma_i$$. Consider the following problem. $$\begin{cases} \Delta \phi&=0\\ \phi|_{\partial \Omega}&=g(x),\quad g\in C^{\infty} \end{cases}$$ Denote $$\mathcal{S}$$ is subset of $$\{1,2,\cdots,n\}$$ and $$\mathcal{S}^c$$ is $$\{1,2,\cdots,n\}\setminus \mathcal{S}$$. If we know that $$\min_{i\in \mathcal{S}}\inf_{x\in \Gamma_i}\phi(x)\ge \max_{i\in \mathcal{S}^c} \sup_{x\in \Gamma_i} \phi(x)+\delta,$$ where $$\delta$$ is a positive constant, how to prove that \begin{align*} \sum_{i\in \mathcal{S}}\int_{\Gamma_i}\nabla \phi\cdot \vec{n}d\sigma>0? \end{align*} where $$\vec{n}$$ denotes the outer normal of $$\partial \Omega$$.

My effort: I meet this question when I read a paper. This paper say that it is a standard comparison principle exercise, but I still don't know how to solve this question. When $$g(x)$$ is a step function, we may consider Hopf Lemma or strong maximum principle. However, $$g$$ is a function. Any comments will be welcome. the equation (2.51) of page 2992 in this paper

Let $$\psi$$ be harmonic in $$\Omega$$, with $$\psi=\phi$$ on $$\cup _{i \in S} \Gamma_i$$, $$\psi=m$$ on $$\cup_{i \not \in S}\Gamma_i$$, where $$m=\max_{i \not \in S} \max_{\Gamma_i} \phi$$. By comparison, $$\psi \geq \phi$$ and then $$\nabla \psi \cdot n \leq \nabla \phi \cdot n$$ on $$\cup _{i \in S} \Gamma_i$$. Then $$0=\int_{\partial \Omega}\nabla \psi\cdot n=\sum_{i \in S}\int_{\partial \Gamma_i} \nabla \psi\cdot n+\sum_{i \not \in S}\int_{\partial \Gamma_i} \nabla \psi\cdot n.$$ The function $$\psi$$ attains its minimum at any point of $$\cup_{i \not \in S} \Gamma_i$$, hence Hopf's lemma gives $$\nabla \psi\cdot n<0$$ and each integral on $$\partial \Gamma_i, i \not \in S$$ is negative. Then $$\sum_{i \in S}\int_{\partial \Gamma_i} \nabla \phi\cdot n \geq \sum_{i \in S}\int_{\partial \Gamma_i} \nabla \psi\cdot n >0.$$