Partial Derivative of Hadamard Root (elements-wise square root)

derivativeslinear algebramatricesmatrix-calculuspartial derivative

Given $\mathbf{X} \in \mathbb{R}^{n \times 1}$, $\mathbf{A} \in \mathbb{R}^{n \times n}$, the function is $\mathbf{f}=\sqrt{\mathbf{A} \mathbf{X} \odot \mathbf{A} \mathbf{X}}$, where $\sqrt{(\cdot)}$ is Hadamard root (elements-wise square root), and $(\cdot) \odot (\cdot)$ is the Hadamard Product. How to compute $\frac{\partial \mathbf{f}}{\partial \mathbf{X}}$?


I have tried to follow this similar question and answer to solve my problem, but the function of that question is Frobenius inner product, which is different with mine so can not solve in that way.

Thanks in advance!

Best Answer

Define $$\eqalign{ b &= Ax \qquad\implies\quad &db = A\,dx \\ B &= {\rm Diag}(b) &F = {\rm Diag}(f) \\ }$$ Then calculate $$\eqalign{ f\odot f &= b\odot b \\ 2f\odot df &= 2b\odot db \\ F\,df &= B\,db = BA\;dx \\ \frac{\partial f}{\partial x} &= F^{-1}BA \\\\ }$$

Related Question