Let $f,g:\mathbb{R}^n\to\mathbb{R}$ be such that $\nabla f=\nabla g$.
I believe this implies that $f$ and $g$ only differ by a constant, like in the one-dimensional case. But I'm not sure how to prove it. If it's indeed true, can you give me a hint?
Thanks!
[Spoiler warning, this is more than a hint. I wanted to show this method because it avoids working with components.]
First suppose that $h:\mathbb R^n \to \mathbb R$ is differentiable and that $\nabla h(x) = 0$ for all $x \in \mathbb R^n$. I'll prove that $h$ is constant. Suppose (for a contradiction) that there exist points $a$ and $b$ in $\mathbb R^n$ such that $h(a) \neq h(b)$. Let $z:[0,1] \to \mathbb R$ be the function defined by $$ z(t) = h(a + t(b - a)). $$ Note that $z$ is continuous on $[0,1]$ and differentiable on $(0,1)$ and that $z(0) \neq z(1)$. By the mean value theorem, there exists a number $c$ such that $0 < c < 1$ and $$ z'(c) = z(1) - z(0) \neq 0. $$ But, by the chain rule, $$ z'(c) = \langle \nabla h(a + c(b -a)), b - a \rangle $$ which is $0$ because we are assuming that $\nabla h(x) = 0$ for all $x$ in $\mathbb R^n$. This is a contradiction. Therefore $h$ is constant.
Next, to solve the original problem, let $h = f - g$ and apply the above result.