Given different vectors $x_1,\dots,x_n$ and $n^2$ matrices $A^{11}\dots,A^{nn}$ with $A^{ij}=A^{ji}$, I would like to calculate the derivative with respect to $x_k$ of
$$\sum_{i,j}^n \langle A^{ij}x_i,x_j \rangle$$
Am I right that this should be $\sum_{i\not= k}\langle A^{ik}x_i,x_k\rangle + 2\langle A^{kk}x_k,x_k\rangle$
Define $g:(\mathbb{R}^n)^n\rightarrow\mathbb{R}$ as $$g(x_1,\ldots,x_n)=\sum_{1\leq i,j\leq n}\langle A^{ij}x_i,x_j\rangle$$ where $A^{i,j}\in\operatorname{Mat}_{n\times n}(\mathbb{R})$, $1\leq i,j\leq n$. Then $$\begin{align} g(x_1+h_1,\ldots, x_n+h_n)&=\sum_{1\leq i,j\leq n}\langle A^{ij}(x_i + h_i,x_j+h_j\rangle\\ &=\sum_{1\leq i,j\leq n}\langle A^{ij}x_i,x_j\rangle + \sum_{1\leq i,j\leq n}\langle A^{ij} x_i,h_j\rangle + \sum_{1\leq i,j\leq n}\langle A^{ij} h_i,x_j\rangle + \sum_{1\leq i,j\leq n}\langle A^{ij} h_i, h_jx\rangle\\ &= g(x) +\sum_{1\leq i,j\leq n}\langle A^{ij} x_i,h_j\rangle + \sum_{1\leq i,j\leq n}\langle A^{ij} h_i,x_j\rangle + r(h) \end{align}$$ where $\frac{|r(h)|}{\|h\|}\xrightarrow{h\rightarrow0}0$ where $\|h\|=\|h_1\|+\ldots+\|h_n\|$. This means that $g'(x)$, $x=(x_1,\ldots,x_n)$ is the linear operator $$\begin{align} g'(x)[h_1,\ldots,h_n]&= \sum^n_{i=1}\sum^n_{j=1}\langle A^{ij} x_i,h_j\rangle +\sum^n_{i=1}\sum^n_{j=1}\langle A^{ij} h_i,x_j\rangle \\ &=\sum^n_{i=1}\sum^n_{j=1}\langle A^{ij} x_i,h_j\rangle + \sum^n_{i=1}\sum^n_{j=1}\langle (A^{ij})^*x_j,h_i\rangle \\ &=\sum^n_{i=1}\sum^n_{j=1}\big\langle \big(A^{ij}+(A^{ji})^*\big)x_i,h_j\big\rangle \end{align} $$ where, for any matrix $A^*$ is the adjoint of $A$ relative to the inner product $\langle\cdot,\cdot\rangle$.
If $A^{ij}=A^{ji}$ then $$ \begin{align} g'(x)[h_1,\ldots,h_n]&=2\sum^n_{i=1}\sum^n_{j=1}\langle \frac{1}{2}(A^{ij}+(A^{ij})^*)x_i,h_j\rangle \end{align} $$ The matrix $\frac12(A_{ij}+A^*_{ij})$ are the symetrization of $A^{ij}$ with respect to the inner product $\langle\cdot,\cdot\rangle$.