Let's say I have a matrix, $A$:
\begin{pmatrix} a_{11} & a_{12} \\\ a_{21} & a_{22} \end{pmatrix}
vector $p$: \begin{pmatrix} p_{1} \\\ p_{2} \end{pmatrix}
and vector $q$: \begin{pmatrix} q_{1} \\\ q_{2} \end{pmatrix}
If I have some function, $f(....) = \sum_{1\leq i, j \leq n}a_{ij}p_{i}q_{j} $, how can I go about determining what $\frac{\partial{f}}{p_1}$ for instance?
If I do this by hand I get $a_{11}q_{1} + a_{12}q_{2} + 0 + 0$ but how do I do this without evaluating it manually?
Write the function using explicit dot products $$f=(A\cdot q)\cdot p$$ and consider how $f$ changes when $p$ is perturbed $$\eqalign{ df &= (A\cdot q)\cdot dp \quad\implies\quad \frac{df}{dp} &= (A\cdot q) \\ }$$ The same result as obtained by manual component-wise computation. However the new equation works not only for $2\times 2$ matrices, but for $n\times n$ matrices.