Let $S$ be a bounded region of $\mathbb R^2$ and $\partial S$ be its boundary. Let $u$ be the unique solution to Laplace’s equation in $S$, subject to the boundary condition $u=f$ on $\partial S$, where $f$ is a specified function. Let $w$ be any smooth function with $w=f$ on $\partial S$. By writing $w=u+\delta$ show that $$\int_S|\nabla w|^2 \operatorname{dA}\ge\int_S|\nabla u|^2 \operatorname{dA}$$
To start all I could think to do is to write $$\int_S|\nabla w|^2 \operatorname{dA}=\int_S \nabla w\cdot\nabla w \operatorname{dA}=\int_S|\nabla u|^2+2\nabla\delta\cdot\nabla u+|\nabla\delta|^2 \operatorname{dA}$$ but I don't know how to use the given conditions.
Any help wuld be appreciated, thanks
We are given that $u=w=f$ on $\partial S$. Hence, if $w=u+\delta$, then $\delta=0$ on $\partial S$.
In addition, since $\nabla^2 u=0$ in $S$, then in $S$ we have
$$\nabla u\cdot \nabla \delta=\nabla \cdot (\delta\, \nabla u)-\delta \,\nabla^2 u=\nabla \cdot (\delta \,\nabla u)$$
Equipped with these observations, we can write
$$\begin{align} \int_S \nabla w\cdot \nabla w\,dA&=\int_S |\nabla u|^2\,dA+2\int_S \nabla u\cdot\nabla \delta\,dA+\int_S |\nabla \delta|^2\,dA\\\\ &=\int_S |\nabla u|^2\,dA+2\oint_{\partial S} \underbrace{\delta}_{=0\,\text{on}\,\partial S} (\hat n\cdot \nabla)\,dA+\int_S |\nabla \delta|^2\,dA\\\\ &=\int_S |\nabla u|^2\,dA+\underbrace{\int_S |\nabla \delta|^2\,dA}_{\ge 0}\\\\ &\ge \int_S |\nabla u|^2\,dA \end{align}$$
as was to be shown!