Does the domain of integration have to be convex?

The theorem does not remain true if you remove the word "convex", because then that allows for a disconnected region $R$.

Counter-example:

$$R = ([-2,-1] \cup [1,2]) \times [0,1]$$

$$ g(x,y) = \begin{cases} 0 & \mathrm{if\ } x < 0 \\ 1 & \mathrm{if\ } x > 0 \end{cases} $$ Then both $R$ and $S$ have area 2, but $g$ is not constant.

Okay, then what if we replace the word "convex" with the word "connected"? Then the theorem is still not true, because you can have line-like pieces with no area connecting components with different values of $g$.

Counter-example:

$$ \begin{align*} R_1 &= [-1,0] \times [0,1] \\ R_2 &= (0,1) \times \{0\} \\ R_3 &= [1,2] \times [0,1] \\ R &= R_1 \cup R_2 \cup R_3 \end{align*} $$ $$ g(x,y) = \begin{cases} 0 & \mathrm{if\ } x \leq 0 \\ 3x^2-2x^3 & \mathrm{if\ } 0 < x < 1 \\ 1 & \mathrm{if\ } x \geq 1 \end{cases} $$

Then $g$ has continuous bounded partial derivatives, and again $R$ and $S$ both have area 2, but $g$ is not constant.

But if we know $R$ is convex (and has a well-defined area per your favorite set measure theory), we can prove the theorem something like this:

Form a set $R'$ by subtracting from $R$ all points $(x,y)$ that can be enclosed in some small box $B_{xy}$ such that the set $R \cap B_{xy}$ has measure zero. Then $R'$ is also convex, and the area of $R'$ is the same as the area of $R$, and the area of the curve $S'$ with support $R'$ is the same as the area of $S$. A slight change to your argument shows the partial derivatives $g_x$ and $g_y$ are always zero on $R'$ (just not necessarily all of $R$). If we choose any two points $a, b \in R'$, then there must be a point $c$ arbitrarily close to $a$ and a point $d$ arbitrarily close to $b$, neither of them on the line through $a$ and $b$ (by construction of $R'$). The convex hull of these four points is in $R'$, and contains a path of horizontal and vertical segments joined end-to-end, with endpoints within the small box containing $a$ and $c$ and the small box containing $b$ and $d$. So the absolute difference $|g(a)-g(b)|$ can be shown to be as small as desired, so it must always be zero.


The key property you need is that $R$ is connected. Indeed, you use this to conclude your proof when you write:

$$f_x = f_y = 0 \Leftrightarrow f = \mathit{const}$$

The general fact that we are using here is:

Theorem A. Let $f \colon \Omega \to \mathbb{R}$ be a differentiable function, where $\Omega$ is an open connected set in $\mathbb{R}^n$. Then $\nabla f = 0$ in $\Omega$ if and only if $f$ is constant.

It is easy to give a counter-example to this when $\Omega$ is not connected: take a function which is piecewise constant, with a different value for the constant on each connected component of $\Omega$. For instance take $\Omega = D_1 \cup D_2$ where $D_1$ and $D_2$ are two disjoint open disks, and define $f \colon \Omega \to \mathbb{R}$ by $f = 1$ on $D_1$ and $f = 2$ on $D_2$.

Your problem probably assumes that $R$ is convex instead of merely connected because it is easier to prove Theorem A. In fact, the outline of the proof of the theorem is as follows:

  1. Prove the theorem in the case where $R$ is convex. Hint: use the mean value theorem.
  2. Prove the theorem in the general case where $R$ is connected (and nonempty): let $x_0 \in \Omega$, show that $\{x\in \Omega ~\colon~ f(x) = f(x_0)\}$ is nonempty, open and closed in $\Omega$. Hint: to show openness, use the fact that $\Omega$ is locally convex, and use 1.

Remark: Note that you can also relax the hypothesis that $f$ has continuous and bounded partial derivatives: it is enough to assume that $f$ is differentiable. The reason that your problem makes this extra assumption is probably to easily guarantee that the area of the surface is well-defined and finite. In fact they probably forgot to also say that $R$ is bounded.