# Gradient of a function on product $(U\times R, g_M \oplus ds^2)$

Consider $U$ an open subset of $\mathbb{R}^n$. It is clear that $U$ is a smooth submanifold of $\mathbb{R}^n$. Now, consider that $U$ is equipped with a Riemannian smooth metric $g$. The pair $(U,g)$ is a Riemannian manifold. Define a smooth function $f : U \times \mathbb{R} \to \mathbb{R}$. Consider that $\mathbb{R}$ is seen as a Riemannian manifold too, equipped with the canonical metric. The product $U \times \mathbb{R}$ can be equipped with the product metric $\tilde{g}$ defined as follows :

Let $(p,t) \in U \times \mathbb{R}$. Then we have the following identification : $$\mathrm{T}_{(p,t)}\big( U \times \mathbb{R} \big) \simeq \mathrm{T}_pU \oplus \mathrm{T}_{t}\mathbb{R} \simeq \mathrm{T}_pU \oplus \mathbb{R}$$ since $\mathrm{T}_{t}\mathbb{R} \simeq \mathbb{R}$. For all $(p,t) \in U \times \mathbb{R}$, for all $(u_{1}+v_{1},u_{2}+v_{2}) \in \mathrm{T}_{(p,t)}\big( U \times \mathbb{R} \big)$, $$\tilde{g}_{(p,t)}(u_{1}+v_{1},u_{2}+v_{2}) = g_{p}(u_{1},u_{2}) + v_{1}v_{2}$$

My question is : what is the gradient of $f$ (at a point $(p,t)$) ?

Since $g$ is a smooth Riemannian metric on $M$, it is necessarily of the form : $\forall p \in U, \, \forall (u,v) \in \mathrm{T}_{p}U, \, g_{p}(u,v) = u^{\top}G(p)v$, with $G$ a smooth function such that $G(p)$ is a $n \times n$ symmetric positive definite matrix for all $p$. For $(p,t) \in U \times \mathbb{R}$, is the gradient $\nabla_{(p,t)}f$ of $f$ of the following form ? $$\nabla_{(p,t)}f = \begin{bmatrix} G(p)^{-1}\mathbf{A} \\ a \end{bmatrix}$$ with : $$\mathbf{A} = \begin{bmatrix} \frac{\partial f}{\partial x_{1}}(p,t) \\ \vdots \\ \frac{\partial f}{\partial x_{n}}(p,t) \end{bmatrix} \quad \text{and} \quad a = \frac{\partial f}{\partial x_{n+1}}(p,t).$$

$$df = d_U f + \frac{\partial f}{\partial t} dt$$ where $d_U f$ denotes the derivative of $f$ restricted to a slice $U\times \{z\}$.
$$\bar g = \left[\begin{matrix} g & 0 \\ 0 & 1 \end{matrix}\right],$$
raising the index on $df$ using $\bar g$ simply raises the index on $d_Uf$ using $g$ and leaves the last component untouched. Thus your suggestion is correct: we have $$\nabla f = \left[\begin{matrix} \nabla_U f \\ \partial f/\partial t \end{matrix}\right]$$
where $\nabla_U f$ is the gradient of $f$ restricted to a slice, i.e. your $G^{-1}A$.