Fix $a_i, b_i \in \mathbb R^q$ for $i=1, \ldots, n$. Consider the map $$ \varphi:\mathbb R^q \to \mathbb R, g \mapsto \sum_{i=1}^n \langle g-b_i, a_i\rangle^2. $$ I would like to compute the Fréchet derivative of $\varphi$. Could you have a check on my attempt?
I post my proof separately as below answer. This allows me to subsequently remove this question from unanswered list.
Let $\phi(\mathbf{x})=\sum_{n=1}^N s_n^2$ where $s_n=\mathbf{a}_n:(\mathbf{x}-\mathbf{b}_n)$.
Taking differential yields $ds_n = \mathbf{a}_n:d\mathbf{x}$, and thus $$ d\phi = \sum_{n=1}^N 2 s_n ds_n = \left[ \sum_{n=1}^N 2 s_n \mathbf{a}_n \right]:d\mathbf{x} $$ It follows $ d\phi(\mathbf{x})[\mathbf{v}] = \left[ 2 \sum_{n=1}^N s_n \mathbf{a}_n \right]:\mathbf{v} $.
Write the gradient as $\mathbf{g}=2\sum_{n=1}^N s_n \mathbf{a}_n$ Taking the differential yields the Hessian \begin{eqnarray} d\mathbf{g} &=& 2 \sum_{n=1}^N (ds_n) \mathbf{a}_n \\ &=& \color{red}{2 \sum_{n=1}^N \mathbf{a}_n \mathbf{a}_n^T} d\mathbf{x} = \color{red}{\mathbf{H}} d\mathbf{x} \end{eqnarray}