## Mean Value Theorem for Higher Dimensions

Let $f$ be differentiable on a connected set $E\subseteq \mathbb{R}^n$, then for any $x,y\in E$, there exists $z\in E$ such that $f(x)-f(y)=\nabla f(z)\cdot (x-y)$.

Proof: The trick is to use the Mean Value Theorem for 1 dimension via the following construction:

Define $g:[0,1]\to\mathbb{R}$, $g(t)=f(tx+(1-t)y)$. By the Mean Value Theorem for one variable, there exists $c\in (0,1)$ such that $g'(c)=\frac{g(1)-g(0)}{1-0}$, i.e.

$\nabla f(cx+(1-c)y)\cdot (x-y)=f(x)-f(y)$. Here we are using the chain rule for multivariable calculus to get: $g'(c)=\nabla f(cx+(1-c)y)\cdot (x-y)$.

Let $z=cx+(1-c)y$, then $\nabla f(z)\cdot (x-y)=f(x)-f(y)$ as required.