We need to show that \(f\left(x_{1}^{0}, x_{2}, \ldots, x_{n}\right)=f\left(x_{1}^{1}, x_{2}, \ldots, x_{n}\right)\) whenever \(\mathbf{x}^{0}=\left(x_{1}^{0}, x_{2}, \ldots, x_{n}\right)\) and \(\mathbf{x}^{1}=\left(x_{1}^{1}, x_{2}, \ldots, x_{n}\right)\) both belong to \(E\). Since \(E\) is convex, the line segment joining \(\mathrm{x}^{0}\) and \(\mathrm{x}^{1}\) is contained in \(E\). The meanvalue theorem applies on this line segment, showing that \(f\left(\mathbf{x}^{0}\right)-f\left(\mathbf{x}^{1}\right)=\left(x_{1}^{0}-\right.\) \(\left.x_{1}^{1}\right)\left(D_{1} f\right)(\mathbf{x})\) for some point \(\mathbf{x}\) on this interval. Hence the result now follows from the hypothesis.

Note that convexity is needed only on each line segment through \(E\) parallel to the \(x_{1}\)-axis. Thus if the intersection of \(E\) with each line parallel to the \(x_{1}\)-axis is an interval and \(\left(D_{1} f\right)(\mathbf{x})=0\) for all \(\mathbf{x} \in E\), then \(f\) is independent of \(x_{1}\).

If we define \(f(x, y)\) on all of \(R^{2}\) except the nonnegative portion of the \(y\)-axis by specifying

\[

f(x, y)= \begin{cases}0 & \text { if } y<0 \text { or } x<0, \\ y^{2} & \text { if } y \geq 0 \text { and } x>0,\end{cases}

\]

then \(f(x, y)\) is continuously differentiable on its domain, \(\left(D_{1} f\right)(x, y)=0\) everywhere on that domain, yet \(f(-1,1)=0 \neq 1=f(1,1)\), so that \(f\) is not independent of \(x\).