Derivation of 2nd derivative of directional derivative I have a small problem with directional derivatives $-$ finding the 2nd derivative of a directional derivative.
Consider $z=f(x,y)$, $x = x(t)=x_0+th$ and $y=y(t) =y_0+tk$. I am required to prove that the 2nd derivative is $\frac{d^2z}{dt^2}=f''_{xx}h^2+2f''_{xy}hk+f''_{yy}k^2$. 
I have worked until the first derivative, $\frac{dz}{dt}$, by:
$$
\begin{align*}
\frac{dz}{dt}&=f'_x \cdot\frac{dx}{dt} + f'_y \cdot\frac{dy}{dt}
\\&=hf'_x + kf'_y
\end{align*}
$$
From here, how do you do the 2nd derivative? I attempted it with:
$$
\begin{align*}
\frac{d^2z}{dt^2}&=\frac{d}{dt}\begin{bmatrix}hf'_x + kf'_y\end{bmatrix}
\\&= h\begin{bmatrix}f''_{xx} + f''_{xy}\end{bmatrix} + k\begin{bmatrix}f''_{yx} + f''_{yy}\end{bmatrix} 
\end{align*}
$$
I can't continue from here. 
 A: $$
\begin{align*}
\frac {dz}{dt} &= f_x x' + f_y y' \\
\frac {d^2z}{dt^2} &= \frac d{dt} \left(\frac {dz}{dt} \right) \\&= \left ( f_x x'\right )_xx' + \left ( f_x x'\right )_yy' + \left ( f_y y'\right )_xx' + \left ( f_y y'\right )_yy' \\&=
  f_{xx} \left (x' \right)^2 + f_{xy} x'y' + f_{yx}y'x'+f_{yy}\left ( y'\right)^2 \\&= f_{xx}h^2+2f_{xy}hk + f_{yy}k^2
\end{align*}
$$
Update
Just in case if above is too vague. 
For any differentiable function $z = f\left (x(t),y(t) \right))$ ($x(t)$ and $y(t)$ are also differentiable w.r.t $t$)it's true that
$$
\frac {dz}{dt} = f_x x' + f_y y'
$$
But if you do it, you also get $z_1 = f_1 \left( x(t),y(t) \right) = f_xx'$ and $z_2 = f_2 \left( x(t),y(t) \right) = f_yy'$ s.t.
$$
\frac {dz}{dt} = z_1 + z_2
$$
Now, when you differentiate $\frac {dz}{dt}$ itself you should differentiate $z_1$ and $z_2$ and add them up, according to the principle of superposition. But $z_1$ and $z_2$ should be differentiated in the same manner as $z$ was. So
$$
\frac {dz_1}{dt} = f_{1x} x' + f_{1y}y' \\
\frac {dz_2}{dt} = f_{2x} x' + f_{2y}y'
$$
All you have to do is differentiate $f_1$ and $f_2$ w.r.t $x$ and $y$ by simply using chain rule. For example $f_{1x}$
$$
f_{1x} = \left ( f_xx'\right)_x = f_{xx}x' x' + f_{x}\left(x'\right)_x
$$
But if you recall that $x'$ is a function of $t$ not $x$, so $\left(x'\right)_x = 0$ and you get
$$
f_{1x} = f_{xx} \left ( x'\right)^2
$$
Same for other partial derivatives.
