Derivative of $f(x) = \langle x, Qx\rangle$ 
Let $Q$ be a $n\times n$ symmetric matrix negative semi-definite, i.e., $\langle h, Qh\rangle\le 0$ for all $h\in\mathbb{R}^n$. Calculate the derivative of $f:\mathbb{R}^n\to\mathbb{R}$ given by $f(x) = \langle x, Qx\rangle$ for any $c\in\mathbb{R}^n$ by determining the matrix $Df(c)$ that represents the linear operator $Df(c):\mathbb{R}^n\to\mathbb{R}^n$ defined implicitly by the equation
$$
f(c+h) = f(c) + Df(c)h + r(h),
$$
where $r$ is such that $\lim_{\|h\|\to 0}\frac{r(h)}{\|h\|} = 0$.

Using the definition of $f$ I have
$$
\langle h, Qh\rangle = Df(c)h + r(h),
$$
but I don't really know how to advance from here. I'm not used to calculate derivatives like this. In an example in my texts it gives the calculation for the real quadratic function $f(x) = x^2$ in the following way:
$$
f(c+h) = (c+h)^2 = c^2 + 2ch + h^2 = f(c) + 2c\cdot h + h^2
$$
so we would have $Df(c) = 2c$ and $r(h) = h^2$ which makes sense, but I don't see how to reproduce this in my problem. I mean, we have
$$
f(c+h) = ,\langle c+h, Q(c+h)\rangle = \langle c,Qc\rangle + \langle h, Qh\rangle
$$
so we have $Df(c) = 0$ and $r(h) = \langle h, Qh\rangle$? Any hints?
 A: Perhaps you should explicitly use the expression for $f(x)$. Let $Q = (Q_{ij})_{ij}$ with $Q_{ij} = Q_{ji}$ for $i \neq j$. So for $x=(x_1, \cdots,x_n)$, $Qx = (\sum_{j=1}^{n}Q_{1j}x_j, \cdots, \sum_{j=1}^{n}Q_{nj}x_j)$. Therefore $$f(x) = \langle (\sum_{j=1}^{n}Q_{1j}x_j, \cdots, \sum_{j=1}^{n}Q_{nj}x_j)  , (x_1, \cdots , x_n) \rangle = \sum_{j=1}^{n}Q_{1j}x_jx_1+ \cdots+ \sum_{j=1}^{n}Q_{nj}x_jx_n .$$
Now we can get the partial derivatives (you need to drift very carefully) for example, taking the derivative with respect to $x_1$
$$  \dfrac{\partial f}{\partial x_1} = 2Q_{11}x_1 + \sum_{j=2}^{n}Q_{1j}x_j + \sum_{j=2}^{n}Q_{j1}x_j = 2Q_{11}x_1 + 2\sum_{j=2}^{n}Q_{1j}x_j = 2  \sum_{j=1}^{n}Q_{1j}x_j $$
note that in the penultimate equality we use the fact that the matrix $Q$ is symmetric. So in general:
$$ \dfrac{\partial f}{\partial x_i} = 2  \sum_{j=1}^{n}Q_{ij}x_j , \,\,\, i=1, \cdots,n.$$
So the Jacobian matrix of $f$ is
$$ Df(x) = \left( 2  \sum_{j=1}^{n}Q_{1j}x_j \,\, \cdots \,\, 2  \sum_{j=1}^{n}Q_{nj}x_j \right) $$
Now you can use this expression constructed for the derivative and evaluate in the definition $
f(c+h) = f(c) + Df(c)h + r(h)
$ that $\lim_{\|h\|\to 0}\frac{r(h)}{\|h\|} = 0$.
