Weakly Harmonic Functions (Weak Solutions to Laplace's Equation $\Delta u=0$) and Logic of Test Function Techniques.
In analysis we often use test functions $\phi\in C_{0}^{\infty}(U)$ in order to make some kind of deduction about another function $u:U\mapsto\mathbb{C}$.
For example, if one can obtain the conclusion $\int_{U}u\phi\;dx=0$ for every $\phi$, then we can conclude $u\equiv0$ in $U$.
I have a couple of questions though. Integration by parts very often comes up in situations involving test functions, and the fact that they are compactly supported allows you to throw out the boundary integrals. I can see why this is justified when the set $U$ is open, but if $U$ is closed or compact, can we use test functions in the same way? Or do we really need to restrict ourselves to open domains?
My other question has to do with an exercise I'm working on. It asks us to define a weakly harmonic function as one which satisfies $$\int_{U}u\Delta\phi\;dx=0,$$ and asks us to prove that this condition is equivalent to being harmonic: $\Delta u=0$. Actually, we are allowed to assume $u$ is continuous in $U$, even though the result is true for more general $u\in L^{1}_{loc}(U)$. But after proving this, it struck me that the above logic that I've used in various other instances seems contradictory to the present situation. Applying that logic to the weakly-harmonic condition should imply that $u=0$, since $\Delta\phi$ is more or less an arbitrary function anyway, right? How do you resolve this?
With the above questions resolved by Jose's answer (see below), I figured I would go ahead and post a proof to the claim that weak solutions to Laplace's equation are indeed classical solutions, at least under the hypothesis that the weak solution is $\mathscr{C}^{2}(\bar{U})$, and later merely $\mathscr{C}(U)$. Of course, much of what is presented in the proof generalizes. Indeed, the first part of the proof is to show that the ''standard'' mollification of a weak harmonic solution is in fact harmonic; by using the concept of an adjoint, it is not difficult to extend my argument to general linear PDE, provided certain conditions are satisfied. Of course, what follows from there is unique to Laplace's equation $\Delta u=0$; in particular due to the standard mollifier $$\eta_{\epsilon}=\frac{C}{\epsilon^{n}}e^{\frac{1}{|x|^{2}-1}}$$ being radial symmetric and harmonic functions satisfying the important mean-value properties. Going one step further, one can easily deduce the theorem for arbitrary weak solutions in $L^{1}(\mathbb{R}^{n},\mathscr{L},\mu)$, at least after redefining such a function on a set of measure zero.
(Note that any arcane reference's to "appendix," "text," etc. refers to Evan's PDE text, though this particular theorem does not appear in the text; not even as an exercise.)
Proof.
Let's first assume $u\in\mathscr{C}^{2}(\bar{U}).$ Then integration by parts (or Green's identity) shows \begin{align*} 0 &=\int\limits_{U}u\Delta\phi\;dx\\ &=\int\limits_{\partial U}u\frac{\partial\phi}{\partial\nu}\;dS-\int\limits_{U}\nabla u\cdot\nabla\phi\;dx\\ &=-\int\limits_{\partial U}\phi\frac{\partial u}{\partial\nu}\;dS+\int\limits_{U}\phi\Delta u\;dx\\ &=\int\limits_{U}\phi\Delta u\;dx. \end{align*} Conversely, it is easy to see from the above that if $u$ is harmonic in $U$, then $u$ is also weakly harmonic. Thus, being a weak solution to $\Delta u=0$ is equivalent to being a classical solution, at least when $u\in\mathscr{C}^{2}(\bar{U}).$ We now strengthen the assertion by assuming only $u\in\mathscr{C}(U)$ and mollifying $u$ (with the standard radial mollifier $\eta_{\epsilon}$ as defined in the appendix) in order to work again with a sufficiently smooth function. To that end, let $\epsilon>0$ be given and define the set $$U_{\epsilon}:=\{x\in U\;:\;\text{dist}(x,\partial U)>\epsilon\}.$$ (The set $U_{\epsilon}$ is obtained by cutting out a wedge of width $\epsilon$ along the perimeter of $U$). Since the function $\eta_{\epsilon}(y)$ is supported on $B(0,\epsilon)$, we find that for any $x\in U_{\epsilon}$ fixed, $\eta_{\epsilon}(x-y)$ is compactly supported in $U$ (in particular, on $B(x,\epsilon)$) and as such (as a function of $y$), $$\psi(y):=\eta_{\epsilon}(x-y)\in\mathscr{C}^{\infty}_{0}(U).$$ For fixed $x\in U_{\epsilon}$, we then compute \begin{align} \Delta u_{\epsilon}(x) &=\Delta_{x}(\eta_{\epsilon}\star u)\\ &=\Delta_{x}\int\limits_{\mathbb{R}^{n}}\eta_{\epsilon}(x-y)u(y)\;dy\\ &=\Delta_{x}\int\limits_{U}\eta_{\epsilon}(x-y)u(y)\;dy\\ &=\int\limits_{U}\Delta_{x}\Big[\eta_{\epsilon}(x-y)\Big]u(y)\;dy\\ &=\int\limits_{U}(-1)^{2}\Delta_{y}\Big[\eta_{\epsilon}(x-y)\Big]u(y)\;dy\\ &=\int\limits_{U}u\Delta\psi\;dy\\ &=0. \end{align} Line 3 follows from $\text{supp}\{\eta_{\epsilon}(x-y)\}\subset U$ as discussed above. Differentiation under the integral sign in line 4 is justified by continuity of both $u$ and continuous differentiability of $\eta_{\epsilon}(x-y)$ as a function of $x$. Line 5 follows from the chain rule, and finally line 7 follows from $u$ being a weak solution to $\Delta u=0$ and the previous remarks. We have just proved that the mollified version of the weak solution to $\Delta w=0$ is a classical solution in the restricted domain $U_{\epsilon}$: $$\int\limits_{U}u\Delta\phi\;dx=0\;\forall\;\phi\in\mathscr{C}^{\infty}_{0}(U)\Longrightarrow \Delta u_{\epsilon}=0\;\text{in}\;U_{\epsilon}$$ for all $\epsilon>0$. We now show that this fact actually implies $\Delta u=0$ in $U$.
Now choose $\epsilon'>0$ and put $$u_{\epsilon\epsilon'}:=\eta_{\epsilon'}\star u_{\epsilon}.$$ Note that $\eta_{\epsilon'}(x-y)$ is supported on $U_{\epsilon}$ whenever $x\in U_{\epsilon+\epsilon'}$; in particular, for a fixed $x\in U_{\epsilon+\epsilon'}$, $\eta_{\epsilon'}(x-y)$ is supported on $B(x,\epsilon')$. Since $\eta_{\epsilon'}$ is radial and $u_{\epsilon}$ is harmonic in $U_{\epsilon+\epsilon'}$ (and thus satisfies the mean-value properties there), for such $x$ fixed we compute in polar coordinates (as in Theorem 6 in the text) \begin{align*} u_{\epsilon\epsilon'}(x) &=\int\limits_{U_{\epsilon}}\eta_{\epsilon'}(x-y)u_{\epsilon}(y)\;dy\\ &=\frac{1}{\epsilon'^{n}}\int\limits_{B(x,\epsilon')}\eta\left(\frac{|x-y|}{\epsilon'}\right)u_{\epsilon}(y)\;dy\\ &=\frac{1}{\epsilon'^{n}}\int\limits_{0}^{\epsilon'}\eta\left(\frac{r}{\epsilon'}\right)\left(\int\limits_{\partial B(x,r)}u_{\epsilon}(y)\;dS(y)\right)dr\\ &=\frac{u_{\epsilon}(x)n\alpha(n)}{\epsilon'^{n}}\int\limits_{0}^{\epsilon'}r^{n-1}\eta\left(\frac{r}{\epsilon'}\right)\;dr\\ &=\frac{u_{\epsilon}(x)}{\epsilon'^{n}}\int\limits_{B(x,\epsilon)}\eta\left(\frac{x-y}{\epsilon'}\right)\;dy\\ &=u_{\epsilon}(x)\int\limits_{B(0,\epsilon)}\eta_{\epsilon}(y)\;dy\\ &=u_{\epsilon}(x). \end{align*} Since convolution is associative, we find that for $x\in U_{\epsilon+\epsilon'}$, $$u_{\epsilon'\epsilon}(x)=u_{\epsilon\epsilon'}(x)=u_{\epsilon}(x)\to u(x)\;\text{uniformly as}\;\epsilon\to0,$$ or $$u(x)=u_{\epsilon'}(x).$$ From what was proven above, $u_{\epsilon'}$ is harmonic in $U_{\epsilon'}$, and therefore so is $u(x)$. Sending $\epsilon'\to0$, we obtain the result for all $x\in U$, and conclude that weak solutions to Laplace's equation are in fact smooth solutions in the classical sense. QED
(Here is an alternative argument to finish off the proof that $\Delta u=0$ in $U$, though it is not quite rigorous and may actually be incorrect):
Now, $\Delta u_{\epsilon}\to0$ uniformly as $\epsilon\to0$ in any compact subset of $U$, and therefore, $\nabla u_{\epsilon}$ and $\nabla^{2}u_{\epsilon}$ must both converge uniformly to some limit in the same compact subset. Consequently, since $u_{\epsilon}\to u$ pointwise for at least one $x\in U$ (in fact, uniformly for all $x$ in any $V\subset\subset U$), we find $\Delta u$ exists, and $$\Delta u=\lim_{\epsilon\to0^{+}}\Delta u_{\epsilon}=0$$ as required.
For the first question consider the case of a compact set with empty interior $K$, how do you define a differentiable function there? On the other hand if $K=\bar{U}$ the closure of an open set with some properties then the space $C_c^\infty(K)= \{ f : K \to \mathbb{C} : \text{supp}(f) \subset K \text{ and is compact }\}$ is completely analogous to the case of $U$, with the not-so-minor detail that functions in this space might be non-zero arbitrarily close to the boundary.
The second question is a somewhat subtle one: Indeed for every $\psi \in C_c^\infty(U)$ we can find $\phi$ such that $\Delta \phi =\psi$ in $U$, but we can't assert that $\phi$ has compact support. Think of the case $U=\mathbb{R}^n$ and $\psi\geq 0$ then the usual way to obtain a (bounded) solution is to take $\phi = \psi* \Phi$ where $\Phi$ is the fundamental solution of the Laplacian and you can check that if $\psi$ is positive in an open ball then $\phi$ never vanishes.
To see this more clearly think of the case $n=1$ and the derivative instead of the Laplacian: Prove that if $u$ is a continuous function such that for every $\varphi \in C_c^\infty(\mathbb{R}) $ $$ \int_{\mathbb{R}} u\varphi' =0 $$ then $u$ is constant. (The argument in this case being that, unless $\varphi$ has zero average, the usual way of building the antiderivative $\psi=\int_{-\infty}^x \varphi(t)dt $ will not produce an admissible function, i.e. $\psi\notin C_c^\infty(\mathbb{R})$.)
I guess what I'm trying to get at is that $\Delta \phi$ is not so arbitrary.
Hope this helps.