# Prove equality of two vectors if they have equal divergence and equal curls

I have following question:

Fields with equal divergence and equal curls $F_1$ and $F_2$ are two vectors fields, you may write them as $F_1 = M_1i+N_1j+P_1k$, $F_2 = M_2i+N_2j+P_2k$. Suppose that $\nabla \cdot F_1 = \nabla \cdot F_2$ and $\nabla \times F_1 = \nabla \times F_2$ over a region D enclosed by the oriented surface S with outward unit normal n and that $F_1 \cdot n = F_2 \cdot n$ on S. Prove that $F_1=F_2$ throughout D.

I came across this question when studying "Stokes's Theorem and Divergence Theorem" in Thomas Calculus, so I suppose we should use either of them to solve this, except I don't know how.
All I could figure out is $$F_1 \cdot n = F_2 \cdot n\Rightarrow\iint\limits_s F_1 \cdot n \, d\sigma = \iint\limits_s F_2 \cdot n \, d\sigma\Rightarrow\iiint\limits_D \nabla \times F_1\, dv = \iiint\limits_D \nabla \times F_2 \, dv,$$ the last step using divergence theorem. Or $$\nabla \times F_1 = \nabla \times F_2 \Rightarrow\iint\limits_s \nabla \times F_1\cdot n \, d\sigma= \iint\limits_s \nabla \times F_2 \cdot n \, d\sigma \Rightarrow \oint\limits_c F_1 \cdot dr =\oint\limits_c F_2 \cdot dr,$$ the last step using Stokes's theorem. This is all I get, then what? Am I on a wrong path? Can anyone solve this problem? Thanks.

Setting $F=F_1-F_2$, we're supposed to prove that: if $F \cdot n=0$ on $S$ and $\nabla\cdot F=0$, $\nabla\times F=0$ in $D$ then $F=0$ in $D$. We actually need one more assumption: $D$ is simply connected (the statement is not true e.g. for the solid torus). $\nabla\times F=0$ implies that there is a function $f$ such that $F=\nabla f$ (here we use that $D$ is simply-connected). The condition $\nabla\cdot F=0$ becomes $\Delta f=0$.
Now the standard trick is $\nabla\cdot(f\nabla f)=\nabla f\cdot\nabla f+f\Delta f=\nabla f\cdot\nabla f$, hence $$\iiint_D \nabla f\cdot\nabla f\, dV =\iiint_D\nabla \cdot (f\nabla f)\, dV=\iint_S f\nabla f \cdot n\,dS=0$$ as $\nabla f \cdot n=F \cdot n=0$. Since $\nabla f\cdot\nabla f\geq0$ and the integral is $0$, we get $\nabla f=0$, i.e. $F=0$.