Let v be a vector $v = (a + bc_1, …, a + bc_n)$. Thus, we can say $v = a1 + bc$, where $1 = (1,…, 1)$ and $c = (c_1,…c_n)$.
Let $M$ be a symmetric and quadratic matrix of proportions $n * n$, which elements we note $m_{ij}$.
What is the derivative with respect to $a$ of $v^TM v$? What is the derivative with respect to $b$ of $v^TM v$?
Context for the interested
I have tried to optimize the following problem in finance (specifically modern portfolio theory)
min $w^TΣw$ s.t. $w^T1 = 1$, $w^Tμ = μ_*$, $w^Tθ \geq θ_*$, where θ is ESG-score.
The problem is the basic mean-variance optimization with an added θ-inequality. From this problem I reduced it to a simpler form using KKT-conditions, and now use Lagrange multipliers (a and b in the problem above are the multipliers) to finally optimize the problem.
Best Answer
Let's use Greek letters for the scalar variables, lowercase Latin for vectors, and uppercase Latin for matrices.
First, calculate the differential of $v$ $$\eqalign{ \def\a{\alpha} \def\b{\beta} \def\c{c} \def\O{{\large\cal\Omega}} \def\o{{\tt1}} v &= \o\a + \c\b \\ dv &= \o\,d\a + c\:d\b \\ }$$ Then the differential of the quadratic form $$\eqalign{ \O &= v^TMv \\ d\O &= v^TM\,dv + dv^TMv \\ &= 2v^TM\:dv \\ &= 2v^TM\,(\o\,d\a + c\:d\b) \\ &= 2v^TM\o\,d\a \;+\; 2v^TMc\,d\b \\ }$$ From this, one can identify the desired derivatives $$\eqalign{ \frac{d\O}{d\a} &= 2v^TM\o, \qquad \frac{d\O}{d\b} = 2v^TMc \\ }$$