Anyone Understand how the chain rule was applied here? 
Just start from the top with how they applied the chain rule. 
What have I tried: 


*

*Google (googling chain rule multivariate function didn't help. Clearly $\frac{df}{dt}=\sum \frac{\partial x_i}{\partial t}\frac{\partial f}{\partial x_i} $ but how they reached their conclusion is beyond me.)

 A: I don't know if this helps. Observe
\begin{align}
f(x_1, \ldots, x_n)
\end{align}
and
\begin{align}
x_i = p_i+t(x_i-p_i)
\end{align}
then by chain rule, we have
\begin{align}
&\frac{d}{dt}f(p_1+t(x_1-p_1), p_2+t(x_2-p_2), \ldots, p_n+t(x_n-p_n)) \\
=& \frac{\partial f}{\partial x_1} \frac{d x_1}{d t}+ \frac{\partial f}{\partial x_2} \frac{dx_2}{dt}+\ldots + \frac{\partial f}{\partial x_n}\frac{dx_n}{dt}\\
=&\ \frac{\partial f}{\partial x_1} (x_1-p_1) + \frac{\partial f}{\partial x_2}(x_2-p_2) + \ldots +\frac{\partial f}{\partial x_n}(x_n-p_n)\\
=&\ \nabla f(p+t(x-p)) \cdot (x-p).   
\end{align}
A: First of all, they are not differentiating $f$, they are differentiating the function $g(t)=f(p+t(x-p))$.  The function $g$ is the composition of the function $f$ with the function $h(t)=p+t(x-p)$ (this is a function $\mathbb{R}\to\mathbb{R}^n$).  So by the chain rule, $$\frac{dg}{dt}(t)=\sum \frac{dh^i}{dt}(t)\frac{\partial f}{\partial x_i}(h(t)),$$ where $h^i$ is the $i$th component of $h$.  Since $h^i(t)=p^i+t(x^i-p^i)$, $\frac{dh^i}{dt}$ is just $x^i-p^i$, so this gives the formula shown.
