Let $f:\mathbb{R}^n\rightarrow\mathbb{R}$ be a sufficiently smooth function, let $M$ be a Riemmanian manifold embedded in $\mathbb{R}^n$ with metric $g$ and dimension $d$.
What I want to find is $\text{grad}f(x)|_M$, i.e. the gradient on the manifold for $x \in M$. To find it, I can project $\nabla f(x)$ onto $T_xM$, the tangential space of $M$ at $x$, but I am not sure if it is this straightforward. I understand that this is true if both the original manifold and the restricted domain has the same metric but can someone show if this is true even if two manifolds have different metrics?
If the metric on the submanifold $M$ is not induced by the Euclidean innner product on $\mathbb{R}^n$, with respect to which the Euclidean gradient $\nabla f$ is defined, then the answer is no: it is possible for the gradient (with respect to $g$) of the function $f|_{M}$ to be different than the projection of $\nabla f$ onto the tangent space of $M$.
A simple example is obtained as follows: consider the embedding of $M=\mathbb{R}$ into $\mathbb{R}^2$ as the $x$-axis: $ x_1\in M \mapsto (x_1,0) \in \mathbb{R}^2$; endow $M$ with the Riemannian metric $g = 2 dx_{1}^{2}$; Let $f$ be the function $f(x_1,x_2)=(x_{1})^{2}$.
With respect to the Euclidean metric $h = dx_1^2 + dx_2^2$ on $\mathbb{R}^2$, the gradient of $f$ at a point $(x,0) \in M$ is $\nabla f (x,0) = 2x\frac{\partial}{\partial x_1}$. Its projection to the tangent space of $M$ at $(x,0)$ is itself.
Meanwhile, the gradient of $f|_{M} (x_1) = (x_{1})^{2}$ at the point $x$, with respect to the metric $g$, is the vector field $x\frac{\partial}{\partial x_1}$.
By its simple nature this example might mislead one to think that a difference in scaling is perhaps all there is to it. This is not the case. In fact, using embeddings of surfaces in $\mathbb{R}^3$ it is possible to construct metrics on $M$ such that the intrinsic gradient $\nabla_M f|_M$ and the projection of the extrinsic gradient $\nabla f$ onto the tangent space of $M$ are linearly independent (try constructing such metrics on embeddings of the plane into $\mathbb{R}^3$ as the $x,y$-plane by yourself). This highlights the metric-dependent nature of the gradient.