Derivative of diagonal matrix with respect to vector composed of some elements of the diagonal

2.3k Views Asked by At

Let $n\times1$ vector $\vec{a}$ and $A=\mathrm diag(a)$. Let $\vec{a}_i$ $k\times 1$ subvector of $\vec{a}$ ($k<n$), given by the relation $\vec{a}=K\vec{a}_i$, where $K$ is an $n\times k$ matrix ($n,k\in\mathbb{N}$). I would like to compute the derivative $\dfrac{dA}{d\vec{a}_i}$.

2

There are 2 best solutions below

0
On BEST ANSWER

To find $\frac{d\mathbf{A}}{d\mathbf{a}_{\mathrm{i}}}$, notice that the diagonal matrix $\mathbf{A}$ can mathematically be written as a function of vector $\mathbf{a}$ \begin{equation} \mathbf{A}=\sum_{i=1}^n\mathbf{E}_{\mathrm{i}}\mathbf{a}\mathbf{e}_{\mathrm{i}}^{\mathrm{T}}, \end{equation} where $\mathbf{E}_{\mathrm{i}}$ an $n\times n$ matrix with all its entries zero except for identity in $(i,i)$, and $\mathbf{e}_{\mathrm{i}}$ an $n\times1$ vector with identity on the $i^{\mathrm{th}}$ element and zero everywhere else. This derivative then becomes $$ \frac{d\mathbf{A}}{d\mathbf{a}_{\mathrm{i}}}=\frac{\sum_{i=1}^n\mathbf{E}_{\mathrm{i}}\mathbf{a}\mathbf{e}_{\mathrm{i}}^{\mathrm{T}}}{d\mathbf{a}_{\mathrm{i}}}= \frac{\sum_{i=1}^n\mathbf{E}_{\mathrm{i}}\mathbf{K}\mathbf{a}_{\mathrm{i}}\mathbf{e}_{\mathrm{i}}^{\mathrm{T}}}{d\mathbf{q}_{\mathrm{id}}}= \sum_1^n\mathbf{e}_{\mathrm{i}}\otimes \mathbf{E}_{\mathrm{i}}\mathbf{K}\\=\sum_1^n\mathbf{I}_{n^2\times n}(n(i-1)+i,i)\mathbf{K}=\mathbf{\Omega}\mathbf{K}, $$ where the matrix $\mathbf{\Omega}$ is constructed by adding ones in the aformentioned slots $\forall i$, $1\leq i\leq n$ of the $n^2\times n$ matrix $\mathbf{I}$.

0
On

There are too many $A$'s in this question for my taste, so allow me to denote the subvector as $x$. Then we have $$ A = {\rm Diag}(Kx) $$ the differential of which is $$ dA = {\rm Diag}(K\,dx) $$ The derivative will be a $3^{rd}$ order tensor, so let's look at the derivative with respect to the $j^{th}$ component of $x$, which is merely a matrix $$\eqalign{ dA &= {\rm Diag}(Ke_j)\,dx_j \cr &= {\rm Diag}(k_j)\,dx_j \cr \frac{\partial A}{\partial x_j} &= {\rm Diag}(k_j) \cr }$$ where $k_j$ is the $j^{th}$ column of $K$.