Convention for the derivative of a diagonal matrix

48 Views Asked by At

Simple question: $A$ is an $n\times n$ diagonal matrix: $$A = \left(\begin{array}{cccc} a_{11} & 0 & \cdots & 0 \\ 0 & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & a_{nn} \end{array}\right)$$ How is the derivative of $A$ wrt to the diagonal components $\mathrm dA/\mathrm da$ defined? Is it: $$\left(\begin{array}{cccc}1 & 0 & \cdots & 0 \\ 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 1 \end{array}\right),$$ i.e. the $n\times n$ identity matrix, or: $$\left(\begin{array}{c} 1 \\ 1 \\ \vdots \\ 1\end{array}\right)$$ (equivalently, as row vector).