The excercise states:
Let $D\subseteq\mathbb{R}^{2}$ a convex region. Prove that if $f:D\longrightarrow{\mathbb{R}}$ is differentiable and $\nabla f(P)=0$,$\forall P\in D$ then $f(P)=k\hspace{.2cm}$ ($k$ constant) $\hspace{.2cm}\forall p\in D.$
Hint: Fix a point $P_{0}\in D$ and let $P$ be some other, use the convexity and the chain rule.
$\hspace{30cm}$
I have tried using the definition of convexity but I'm stuck on the last part of chain rule: $\hspace{30cm}$
$\lambda P_{0} + (1-\lambda)P\hspace{.2cm}$ with $\hspace{.2cm} 0\leq\lambda\leq1$
Let $v=\lambda P_{0} + (1-\lambda)P$
${f(v)}'=\nabla f(v)\cdot {v}'$ $\hspace{30cm}$ $\hspace{1.1cm}=(\lambda \nabla f( P_{0}) + (1-\lambda)\nabla f(P))\cdot {v}'$ $\hspace{30cm}$ $\hspace{1.1cm}=(\lambda \nabla f( P_{0}))\cdot {v}'$
Continuing from where you left:
For the sake of better formality, I shall denote $v$ as $v(\lambda)$.
Note that $\nabla f(P_0) = 0$ and hence, your equation becomes: $$\dfrac{d}{d\lambda}f(v(\lambda)) = 0.$$
Thus, $f\circ v$ is a constant function. (This follows from one-variable calculus. Use Lagrange's Mean Value Theorem and note that the function $f \circ v$ is defined on an interval, $[0, 1]$.)
In particular, you have $f(v(0)) = f(v(1))$ or $f(P) = f(P_0)$. As $P$ was arbitrary, you are done.