I have doubts on my solution of a problem in Zorich's book Mathematical Analysis (10.4.3.4). I will copy the problem here and then provide my solution.
Problem:
The partial derivative $\frac{\partial f}{\partial y}$ of a smooth function $f : D \to R$ defined in a domain $D \subset \mathbb{R}^2$ of the xy-plane is identically zero. Is it true that $f$ is then independent of $y$ in this domain? For which domains $D$ is this true?
my idea:
Not true. Although the function itself doesn't include y anywhere, the value of y can still play a role through the intervals of the subfunctions of a piecewise function. And the other post on the same question contains an example. My suggestion for the second part is then that the domain has to be convex. But I feel this could be too strong a condition.
If convexity is the answer, then I have the following statement to prove
$f:D \to \mathbb{R}$ , D is a convex domain in $\mathbb{R}^2$, f is smooth, and $\frac{\partial f}{\partial y}p = 0 \;\forall p \in D \Longrightarrow \forall p,q \in D,p_x = q_x, f(p) = f(q)$)
Since the function is a real-value function, and the domain is convex, I can use the mean value theorem, which states that for any two points p and q that have the same x variable, there is a point $c \in \overline{pq}^{\circ} \subset D$ so that
$f(q) - f(p) = f'(c)(q-p) = (\frac{\partial f}{\partial x}(c), \frac{\partial f}{\partial y}(c))(q_x-p_x,q_y-p_y)^T = \frac{\partial f}{\partial x}(c)(q_x-p_x)+\frac{\partial f}{\partial y}(c)(q_y-p_y)=0 $
This shows that f is independent of y.
I'm suspicious of my answer also because I haven't used the continuity of $Df$ in my proof.
Comments and suggestions are appreciated. ;)
Let $\phi(t) = \begin{cases} e^{-1 \over t},& t>0 \\ 0, & \text{otherwise}\end{cases}$, and define $f(x,y) = ( \operatorname{sgn}x ) \phi(y)$ on $D = \{ (x,y) \mid y \ge |x| \}^c$.
Then $f$ is smooth on $D$ but for $y>0$ $f(x,y) = -f(-x,y) \neq 0$.
On the other hand, if $D$ is convex, then $D_y = \{ y \mid (x,y) \in D \}$ is connected (an interval, in fact) and $f$ is constant on $D_y$, hence independent of $y$