Functions where the total derivative is zero I came across the following problem:
Let $f: \mathbb{R}^n \to \mathbb{R}$ be partial differentiable to every variable and let $\nabla f(x)=0, \forall x \in \mathbb{R}^n $
Proof that  $f$ is constant.
Intuitively I understand that this is true and I sort of understand how to proof it. For a function from $\mathbb{R}$ to $\mathbb{R}$ I know this is true, but now I need to go to a N-dimensional function. 
My idea is as follows. Let $x,y \in \mathbb{R}^n$, now we need to show that $f(x)=f(y)$. For the one dimensional case this is already proven. So I would start by proving that $f(x_1,...,x_n) =f(y_1,x_2,...,x_n)$ and then the next step would be $f(y_1,x_2,...,x_n)=f(y_1,y_2,x_3...,x_n)$ etc.
How would I do this formally and is this the correct approach?
My second question is what would happen if we have a function $g : \mathbb{R}^n \to \mathbb{R}^p$ and the total derivative $Dg(x)=0, \forall x\in \mathbb{R}^n$. This function $g(x)$ should also be constant. How can I use this question to proof that? 
My thoughts on this case are that I should use a family of functions defined by:
$\phi _i: \mathbb{R}^n \to \mathbb{R}, x \mapsto g_i(x)$
Then by using the first question all $g_i(x)$ are constant, but can I than say that the composition of all $g_i(x)$ is also constant?
 A: Let $x_{0} \in \mathbb{R}^{n}$ and let $A := \{ x \in \mathbb{R}^{n} \mid f(x) = f(x_{0}) \}$. Since $f(x_{0}) = f(x_{0})$, so $A \neq \varnothing$. Since $f$ is differentiable by assumption, so $f$ is continuous, and hence $A$ is closed in $\mathbb{R}^{n}$. 
Let $x \in A$; let $U \subset \mathbb{R}^{n}$ be an open ball centered at $x$; and let $L(x,y)$ be the line segment joining $x$ and $y$ for all $y \in U$. Then $L(x,y) \subset U$ for all $y \in U$. Since $\nabla f = 0$ on $\mathbb{R}^{n}$ by assumption, so
$
| f(y) - f(x) | = 0
$
for all $y \in U$
by the mean-value theorem,
whence $f(y) = f(x) = f(x_{0})$ for all $y \in U$. This says that $A$ is open in $\mathbb{R}^{n}$. Since $\mathbb{R}^{n}$ is connected, and since $A \neq \varnothing$ and is clopen in $\mathbb{R}^{n}$, it follows that $A = \mathbb{R}^{n}$, so $f$ is constant on $\mathbb{R}^{n}$.
A: Your approach is correct and "formal" enough as it stands. But there is a more elegant solution: Since all partial derivatives are $\equiv0$ they are in particular continuous, which implies that $f$ is differentiable in the "proper" sense, so that we may apply the chain rule. Given any two points $x$, $y\in{\mathbb R}^n$ consider the auxiliary function
$$\phi(t):=f\bigl((1-t)x+ty\bigr)\qquad(0\leq t\leq1)\ .$$
Then 
$$\phi'(t)=\nabla f\bigl((1-t)x+ty\bigr)\cdot(y-x)\equiv0\ ,$$
and this implies $f(y)=\phi(1)=\phi(0)=f(x)$.
Concerning your second question: A vector valued function $g$ whose component functions $g_i$ are constant, is of course constant.
