I have a function,
$Q(b) = 1/2||y-Xb||_2^2$,
and want to find directional derivative, defined as
$\lim_{t\to 0}(f(b+tu)-f(b))/t$.
I am having difficulty showing that
$Q(\hat{b} + tu) - Q(\hat{b}) = -t<y-Xb, Xu> + o(|t|)$,
and then that the directional derivative of $Q$,
$D_Q(\hat{b},u) = -\sum_{j\in[p]}u_jx_j^T(y-X\hat{b}).$
Use the fact that
$$ ||x||_2^2 = \langle x | x \rangle $$
And then if all the quantities are real
\begin{eqnarray} Q(b + t u) &=& \frac{1}{2}|| y - X(b + tu) ||^2_2 = \frac{1}{2}\langle y - X(b + tu)|y - X(b + tu)\rangle \\ &=&\frac{1}{2} \langle y - Xb - tXu | y - Xb - tXu \rangle \\ &=&\frac{1}{2}\langle y - Xb | y - Xb \rangle -t \langle y - Xb | Xu\rangle + \frac{1}{2}t^2\langle Xu | Xu\rangle \\ &=& Q(b) -t \langle y - Xb | Xu\rangle + \frac{1}{2}t^2\langle Xu | Xu\rangle \end{eqnarray}
The directional derivative is then
\begin{eqnarray} D_Q(b, u) &=& \lim_{t\to 0} \frac{Q(b + tu) - Q(b)}{t} = \lim_{t\to 0}\left[ - \langle y - Xb | Xu\rangle + \frac{1}{2}t\langle Xu | Xu\rangle \right] \\ &=& - \langle y - Xb | Xu\rangle \end{eqnarray}