Proof explanation: Why is $(f \circ \gamma)'(t) = f'(\gamma(t))(\gamma '(t))$? I'm having some trouble understanding the proof that my teacher showed us to the following proposition:

Let $D\subseteq \mathbb R^3$, $f: D \to \mathbb R$ be a differentiable function, and $I \subseteq \mathbb R$ be an interval. let $\gamma:I\to \mathbb R^3$ be a differentiable function such that $\gamma(I) \subseteq N_c = \{p \in D: f(p)=c\}$, with $c \in \mathbb R$. Then:$$\forall t \in I: \nabla f(\gamma(t)) \cdot \gamma'(t) = 0$$
Where $\nabla f(p)$ is the gradient of $f$ at the point $p$.

The proof he gave is the following:
$\forall t \in I, f(\gamma(t)) = c$, so if we differentiate this we get: $(f \circ \gamma)'(t)=0$.
But if $t \in I, 0 = (f \circ \gamma)'(t) = f'(\gamma(t))(\gamma '(t)) =  \nabla f(\gamma(t)) \cdot \gamma'(t)$.

The part I don't understand of the proof is: Why is $(f \circ \gamma)'(t) = f'(\gamma(t))(\gamma '(t))$? I don't get why this expression would be true.
Thanks.
 A: The notation in your formula is inconsistent.

*

*$\gamma'(t)$ denotes the usual (componentwise) derivative of $\gamma$ at $t \in I$ which is a vector in $\mathbb R^3$. With $(f \circ \gamma)'(t)$ it is the same. We have $f \circ \gamma : I \to \mathbb R$, thus $(f \circ \gamma)'(t)$ denotes the usual derivative of $\gamma$ at $t \in I$ which is a real number.


*$f'(s)$ denotes the Fréchet derivative of $f$ at $s \in D$; it is a linear map $\mathbb R^3 \to \mathbb R$.
Let us now recall the chain rule. Given differentiable maps $g : U \to V$ and $h : V\to W$ between open subsets of Euclidean spaces, the Fréchet derivatives satisfy
$$(h \circ g)'(x) = h'(g(x)) \circ g'(x) . \tag{1}$$
On the RHS we have the composition of linear maps.
The problem in your formula is that the vector $\gamma'(t) \in \mathbb R^3$ does not denote the Fréchet derivative. For the sake of precision let us change notation and write $\overline\gamma'(t)$ for this vector and understand $\gamma'(t)$ as the Fréchet derivative $\gamma$ at $t \in I$ which is linear map $\mathbb R \to \mathbb R^3$. Similarly we write $\overline{(f \circ \gamma)}'(t) \in \mathbb R$ for the usual derivative and understand $(f \circ \gamma)'(t)$ as the Fréchet derivative which is linear map $\mathbb R \to \mathbb R$. Then we get
$$(f \circ \gamma)'(t) = f'(\gamma(t)) \circ \gamma'(t) . \tag{2}$$
What is relation between the Fréchet derivative $u'(t)$ of a map $u : I \to \mathbb R$ and its usual derivative $\overline u'(t) \in \mathbb R$? It is simply
$$\overline u'(t) = (u'(t))(1) ,\tag{3}$$
i.e. we evaluate the linear map $u'(x) : \mathbb R \to \mathbb R$ at $1 \in \mathbb R$. This can easily be verified by writing down the definitions. Note that linear maps $\phi : \mathbb R \to \mathbb R$ have the property $\phi(h) = h \phi(1)$. Therefore $(2)$ gives
$$\overline{(f \circ \gamma)}'(t) = ((f \circ \gamma)'(t))(1) =  (f'(\gamma(t)) \circ \gamma'(t))(1) = f'(\gamma(t))((\gamma'(t))(1)) \\=f'(\gamma(t))(\overline \gamma'(t)). \tag{4}$$
This is your formula. If you express the linear map $f'(\gamma(t))$ by the matrix $\nabla f(\gamma(t))$, then you get
$$f'(\gamma(t))(\overline \gamma'(t)) = \nabla f(\gamma(t)) \cdot \overline\gamma'(t). \tag{5}$$
The RHS is a matrix product.
