Let $A:=\{q\in M_1 \ | d_qf_1=d_qf_2\}$, then it's a closed subset of $M_1$ and it is non-empty (since $p\in A$). We just need to prove that it is open and then conclude by using that $M_1$ is connected. Let's begin with an observation.
Let $q\in M_1$ and $v\in T_qM_1$ such that $\gamma_v(1)$ is defined (where $\gamma_v$ is the unique geodetic such that $\gamma_v(0)=q$ and $\gamma_v'(0)=v$) and $f_1\circ\gamma_v$ is still a geodetic. Notice that this can always be done since the condition of being a geodetic is a local one and it depends only on the metric (recall that $f_1$ is a local isometry). Then, \begin{equation*}d_qf_1(v)=w\in T_{f_1(q)}M_2 \ \Longrightarrow \ \gamma_w=f_1\circ\gamma_v
\end{equation*} by uniqueness of the geodetic. Then, $exp(w)=\gamma_w(1)=f_1\circ\gamma_v(1)=f_1\big(exp(v)\big)$, where $exp:\Omega\subset TM_1\to M_1$ is given by $exp(v):=\gamma_v(1)$ and $\Omega:=\{X\in TM_1 \ | \ \gamma_X(1) \ \text{is defined} \ \}$ open subset of $TM_1$. Now we are ready to prove that $A$ is open.
Let $q\in A$ and let $U$ be an open neighborhood of $q$ with normal coordinates centered at $q$. Let $x\in U$, so by definition there exists a unique $v\in T_qM_1$ such that $x=exp_q(v)=\gamma_v(1)$ and \begin{equation*} f_1(x)=f_1(exp(v))=\gamma_{d_qf_1(v)}(1)=\gamma_{d_qf_2(v)}(1)=f_2(\gamma_v(1))=f_2(x)
\end{equation*} But this implies that $f_1$ and $f_2$ coincide on $U$, which implies that $d_qf_1=d_qf_2$ for all $q\in U$. Then, $U\subset A$ and $A$ is open.
Let:
- $p_1,q_1$ be two points in $M_1$.
- $p_2,q_2$ be two points in $M_2$.
- $c_1: [0,l_1] \rightarrow M_1$ be any parametrized by arc-length piecewise regular smooth curve in $M_1$ connecting $p_1$ and $q_1$.
- $c_2: [0,l_2] \rightarrow M_2$ be any parametrized by arc-length piecewise regular smooth curve in $M_2$ with unit-speed connecting $p_2$ and $q_2$.
- $\hat{c}=(\hat{c}_1,\hat{c}_2): [0,1] \rightarrow M_1 \times M_2$ be any piecewise regular smooth curve in $M_1\times M_2$ connecting $(p_1,p_2)$ and $(q_1,q_2)$.
Clearly $c: [0, 1] \ni t \mapsto \left( c_1(l_1t), c_2( l_2t) \right) $ is a piece-wise smooth connecting $(p_1,p_2)$ with $(q_1,q_2)$ and $\text{length}(c)=\sqrt{l_1^2+l_2^2}$. Hence, $d_{g_1 \oplus g_2}\left( (p_1,p_2),(q_1,q_2) \right) \le \sqrt{l_1^2+l_2^2}$. In consequences,$$d_{g_1 \oplus g_2}\left( (p_1,p_2),(q_1,q_2) \right) \le \sqrt{ d_{g_1}\left( p_1,q_1 \right)^2+d_{g_2}\left( p_2,q_2 \right)^2}.$$
Now, consider $\hat{c}$. We see that $\hat{c}_1,\hat{c}_2$ must also be piecewise smooth curves. Let $\hat{l_1},\hat{l_2}$ be the length of $\hat{c}_1$ and $\hat{c}_2$, respectively. We have:
\begin{align}
\mathrm{length}(\hat{c}) &= \int_0^1 \sqrt{ |\hat{c}'_1(t)|^2+|\hat{c}'_2(t)|^2 } \mathrm{d}t \\
&\ge \frac{1}{ \sqrt{ \hat{l}_1^2+\hat{l}_2^2}} \left( \hat{l}_1\int_0^1 |\hat{c}'_1(t)| \mathrm{d}t+\hat{l}_2\int_0^1 |\hat{c}'_2(t)| \mathrm{d}t \right)
=\sqrt{ \hat{l}^2_1+\hat{l}_2^2}
\end{align}
Thus, $\text{length}(\hat{c}) \ge \sqrt{ d_{g_1}\left( p_1,q_1 \right)^2+d_{g_2}\left( p_2,q_2 \right)^2}$. Therefore,
$$d_{g_1 \oplus g_2}\left( (p_1,p_2),(q_1,q_2) \right) \ge \sqrt{ d_{g_1}\left( p_1,q_1 \right)^2+d_{g_2}\left( p_2,q_2 \right)^2}.$$
Hence, the desired conclusion.
Best Answer
If you want to be precise, some $\pi_i$'s should appear. Here's a full computation: for $f_i\colon M_i \to \Bbb R$, $i=1,2$, and $f\colon M_1\times M_2 \to \Bbb R$ given by $f(x,y) = f_1(x) + f_2(y)$, we have that $${\rm d}f_{(x,y)}(v,w) = {\rm d}(f_1)_x(v) + {\rm d}(f_2)_y(w),$$so if $g$ denotes the product metric, this becomes $$g_{(x,y)}(\nabla f(x,y), (v,w)) = (g_1)_x(\nabla f_1(x), v) + (g_2)_y(\nabla f_2(y), w) = g_{(x,y)}((\nabla f_1(x), \nabla f_2(y)), (v,w)).$$Since $(v,w)$ is arbitrary, we have that $\nabla f(x,y) = (\nabla f_1(x),\nabla f_2(y))$. Without points, this reads $$\nabla f = ((\nabla f_1)\circ \pi_1, (\nabla f_2)\circ \pi_2),$$where $\pi_i\colon M_1\times M_2 \to M_i$, $i=1,2$, are the projections.