Q:

Harmonic function --- Application of Divergence Theorem

Suppose $f$ is a harmonic function on $D=\{(x,y)\in\mathbb{R}^2: x^2+y^2<1\}$. Assume $f$ is twice continuously differentiable on $cl(D)=\{(x,y)\in\mathbb{R}^2: x^2+y^2\leq 1\}$.
How do we express $\int_D |\nabla f|^2\,dv$ ($dv$ is the Lebesgue measure on $\mathbb{R}^2$) as a line integral of $g$ on $[0,2\pi]$ (possibly with other terms) where $g(\theta)=u(e^{i\theta})$?
Hint: Use divergence theorem.

I am quite lost on how to proceed for this question. I know of this form of the Divergence Theorem $\int_U \nabla\cdot F\,dV_n=\oint_{\partial U}F\cdot n\,dS_{n-1}$, however in the question there is a square, so I am unsure of how to proceed.
Thanks for any help!
Update: I managed to do some slight "simplification": $\int_D|\nabla f|^2\,dv=\int_D f_x^2+f_y^2\,dv$.

A:

Let's rewrite the integral a bit as
$$
\int_{D_1(0)}\left|\nabla f\right|^2\;dv = 
\int_{D_1(0)}\nabla f\cdot\nabla f\;dv.
$$
I note the unit disk centered at the origin as $D_1(0)$.
Okay, so that integrand should look familiar. I've seen in before in the product rule for the divergence of a scalar times a vector:
$$
\nabla\cdot(f\mathbf{v}) = \nabla f\cdot\mathbf{v} + f\nabla\cdot\mathbf{v}
$$
If I set $\mathbf{v}=\nabla f$, then I get the integrand in a formula
$$
\nabla\cdot(f\nabla f) = \nabla f\cdot\nabla f + f\nabla\cdot\nabla f = 
\nabla f\cdot\nabla f + f\nabla^2 f,
$$
and now solve for that integrand 
$$
\nabla f\cdot\nabla f = \nabla\cdot(f\nabla f) - f\nabla^2 f.
$$
Now substitute that into the integral:
$$
\int_{D_1(0)}\nabla f\cdot\nabla f\;dv = \int_{D_1(0)}\left(\nabla\cdot(f\nabla f) - f\nabla^2 f\right)\;dv
$$
We were given that $f$ is harmonic on the disk though, which means that $\nabla^2f=0$, leaving us with 
$$
\int_{D_1(0)}\nabla f\cdot\nabla f\;dv = \int_{D_1(0)}\nabla\cdot(f\nabla f)\;dv
$$
This now is amenable to your form of the divergence theorem. As a final note, this exercise is closely related to a proof of one of "Green's identities".

