$A\in\mathbb{R}^{M\times N}, b\in\mathbb{R}^{M\times 1},$ and $\Lambda\triangleq\text{diag}(\lambda),$ where $\lambda\triangleq[\lambda_1,\ldots,\lambda_M]$.
I would need to compute the following derivative: $$\frac{d}{d\lambda}[(A^\text{T}A+\Lambda)^{-1}A^\text{T}B].$$
I worked on it and I got this, $\forall i=1,\ldots,M$:$$-\frac{\partial}{\partial\lambda_i}[(A^\text{T}A+\Lambda)^{-1}A^\text{T}B]=$$$$(A^\text{T}A+\Lambda)^{-1}E_i(A^\text{T}A+\Lambda)^{-1}A^{T}B,$$ where $E_i$ is a matrix with all $0$'s except the $i$th diagonal element which is equal to 1.
Is this correct? I feel like something is missing or incorrect.