I know that there are a lot of question where the differential is found. Before i checked out those answered i tried myself, and i can't quite figure out if the results are the same. Here is what i tried.
We have the following $$ \begin{array}{c}{f(x)=x^{T} A x} \\ {x=\left(\begin{array}{c}{x_{1}} \\ {\vdots} \\ {x_{n}}\end{array}\right) \quad \text { , } A=\left[\begin{array}{ccc}{a_{11}} & {\dots} & {a_{1 n}} \\ {\vdots} & {\ddots} & {\vdots} \\ {a_{n 1}} & {\dots} & {a_{n n}}\end{array}\right]}\end{array} $$
Find $$\frac{\partial f(x)}{\partial x_i}$$ This can be rewritten in the following way $$ f(x)=\sum_{k=1}^{n} \sum_{r=1}^{n} a_{r k} \cdot x_{r} \cdot x_{k} $$
We can divide this into the following cases $$ \left\{\begin{array}{ll}{x_{k} \cdot \sum_{r=1}^{n}\left(x_{k} \cdot a_{r k}\right)=\sum_{r=1}^{n} a_{r k} \cdot x_{k}^{2}} & {\text { for } k=i} \\ {x_{k} \cdot \sum_{r=1}^{n}\left(x_{k} \cdot a_{r k}\right)=c_{k}} & {\text { for } k \neq i}\end{array}\right. $$
Since we have to find the partial with respect to $x_i$ and constants will disapear we have to find the parital derivative of the following, $$ \begin{array}{c}{f(x)=\sum_{r=1}^{n} a_{r i} \cdot x_{i}^{2}} \\ {f_{x_{i}}^{\prime}(x)=2 \cdot \sum_{r=1}^{n} a_{r i} \cdot x_{i}}\end{array} $$
Is this method correct, or am i making an error somewhere? I understand the way other answers on here solves it, but i dont see why this is wrong - if it is.
Your equation $f(x)=\sum_{k=1}^{n} \sum_{r=1}^{n} a_{r k} \cdot x_{r} \cdot x_{k}$ is, of course, correct.
The partial derivative with respect to $x_i$ is, by the product rule, $\sum_{r=1}^{n} a_{r i} \cdot x_{r} +\sum_{r=1}^{n} a_{i k} \cdot x_{k}$.
So there is no need for any extra algebra!