Link between two gradient definitions Let $M$ a $n$ dimensional embedded Riemannian manifold of $\mathbb{R}^{n+1}$. There are two definitions of $\nabla_M f$ that seem different, but I think they should be related:
Def 1: $\nabla_M f = \nabla f - \langle\nabla f, n\rangle n$, where $n$ is the outer unit normal.
Def 2: Definition through parametrization.
By Def 1, one sees that $\nabla_M f \in \mathbb{R}^{n+1}$, while using Def 2 (in practice), we get $\nabla_M f \in \mathbb{R}^{n}$.
How to relate this two definitions? (Maybe, behind my confusion there is some hidden identification).
Edit 1:
Take, e.g., $f(x,y,z)=\frac{1}{2}x^2$ on $\mathbb{R}^3$. Then
by Def 1: $\nabla_{S^2} f(x,y,z)=(x-x^3, -x^2y,-x^2z)$ and by Def 2: $\nabla_{S^2} f(\phi(\theta,\varphi))=(-\frac{1}{2} \sin(2\theta),\frac{1}{2} \sin(2\varphi) \cos^2 \theta)$.
But in Riemannian geometry, they said that they are the same, they even prove one from the other.
Mind that $Def. 1$ is like all derivatives and gradients only define at a given point on $M$ where $f$ is sufficiently steady otherwise there is need to derive from directions towards the selected points. If there is set in $M$ where all the gradients exist then the gradient can be written in the abstracted form of Your question set. This inherent in the definition of gradients.
There very same is true is the definition of $f$ is some kind of path on $M$. The point matters not any paths along which the gradient is taken. The gradient exists if it is independent of the path of differentiation.
Your example is not so suitable since $f:\Bbb R^{3} \rightarrow \Bbb R$. This is not like in Your definition $\Bbb R^{3}$ with $n=2$ and Your $n$ is $1$.
Your $S^{2}$ is meant the surface of the unit sphere in $\Bbb R^{3}$ which has the dimension 2 but You forgot that $n$ from the $Def.1 $s is a unit vector. It has to have the form
$$\vec n=\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
So
$\vec \nabla f(x,y,z)=(x,0,0)$
without any restriction to the sphere $S^{2}$.
An example normal on the $S^{2}$ is:
$\vec n=\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$
$$\vec \nabla_{S^{2}} f(x,y,z)=(x,0,0)-&lt;\vec \nabla f,\vec n&gt;\vec n$$
$$=(x,0,0)-&lt;(x,0,0),\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}&gt;\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
$$=(x,0,0)-\frac{x^2}{\sqrt{x^2+y^2+z^2}}\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
$$=\frac{(x(x^2+y^2+z^2)-x^2,-x^{2}y,-x^2z)}{x^2+y^2+z^2}$$
Your results is rather different!
$\vec n$ is directed outwards. The same is true is $-\vec n$ is used but oriented inwards. There are other normals on $S^{2}$.
This shows up that the normal has to be specified in the definition before calculating the gradient. And the normal has to be assigned to a point on the unid sphere centered around zero for example the point (0,0,1) where the gradient becomes (0,0,-1).
I in the second example the same $f$ is used why are there only two components of the gradient? $r=1$ is only the definition of the unit sphere in spherical coordinates is not allowed to ignore the $r$ derivatives.
As a check transform the function $f$ properly. $x=r sin(\theta) cos(\phi)$ so
$$f(r,\phi,\theta)=\frac{r^2 sin(\theta)^2 cos(\phi)^2}{2}$$
The gradient is now with the projection on the normal:

Form this point with use the unit sphere restriction for our example normal. The example normal is the $\vec e_{r}$ unit vector of the coordinate system. $r=1$.
So the second term is
$$-(cos(\phi)cos(\theta))^2\vec e_{r}$$
The $\vec e_{r}$ is simply $cos(\theta)^2$. The others remain unchanged at $r=1$.
Mind that $Def. 1$ is like all derivatives and gradients only define at a given point on $M$ where $f$ is sufficiently steady otherwise there is need to derive from directions towards the selected points. If there is set in $M$ where all the gradients exist then the gradient can be written in the abstracted form of Your question set. This inherent in the definition of gradients.
There very same is true is the definition of $f$ is some kind of path on $M$. The point matters not any paths along which the gradient is taken. The gradient exists if it is independent of the path of differentiation.
Your example is not so suitable since $f:\Bbb R^{3} \rightarrow \Bbb R$. This is not like in Your definition $\Bbb R^{3}$ with $n=2$ and Your $n$ is $1$.
Your $S^{2}$ is meant the surface of the unit sphere in $\Bbb R^{3}$ which has the dimension 2 but You forgot that $n$ from the $Def.1 $s is a unit vector. It has to have the form
$$\vec n=\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
So
$\vec \nabla f(x,y,z)=(x,0,0)$
without any restriction to the sphere $S^{2}$.
An example normal on the $S^{2}$ is:
$\vec n=\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$
$$\vec \nabla_{S^{2}} f(x,y,z)=(x,0,0)-&lt;\vec \nabla f,\vec n&gt;\vec n$$
$$=(x,0,0)-&lt;(x,0,0),\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}&gt;\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
$$=(x,0,0)-\frac{x^2}{\sqrt{x^2+y^2+z^2}}\frac{(x,y,z)}{\sqrt{x^2+y^2+z^2}}$$
$$=\frac{(x(x^2+y^2+z^2)-x^2,-x^{2}y,-x^2z)}{x^2+y^2+z^2}$$
Your results is rather different!
$\vec n$ is directed outwards. The same is true is $-\vec n$ is used but oriented inwards. There are other normals on $S^{2}$.
This shows up that the normal has to be specified in the definition before calculating the gradient. And the normal has to be assigned to a point on the unid sphere centered around zero for example the point (0,0,1) where the gradient becomes (0,0,-1).
I in the second example the same $f$ is used why are there only two components of the gradient? $r=1$ is only the definition of the unit sphere in spherical coordinates is not allowed to ignore the $r$ derivatives.
As a check transform the function $f$ properly. $x=r sin(\theta) cos(\phi)$ so
$$f(r,\phi,\theta)=\frac{r^2 sin(\theta)^2 cos(\phi)^2}{2}$$
The gradient is now with the projection on the normal:

Form this point with use the unit sphere restriction for our example normal. The example normal is the $\vec e_{r}$ unit vector of the coordinate system. $r=1$.
So the second term is
$$-(cos(\phi)cos(\theta))^2\vec e_{r}$$
The $\vec e_{r}$ is simply $cos(\theta)^2$. The others remain unchanged at $r=1$.