Derivative of a trace norm or a Frobenius norm of a matrix wrt to a vector

384 Views Asked by At

I have a Frobenius norm of a multiplication of two matrices

$||U^TL^\frac{1}{2}||_F^2$

the $L$ matrix is a symmetric matrix, so it can be written as

$tr(U^TLU)$

Now I want to get the derivative of this norm wrt a row vector in $U$, which is $U_i.$ as a vector. Note $U$ is $m \times n$, and $L$ is $m\times m$.

2

There are 2 best solutions below

2
On BEST ANSWER

Hint: With block matrix multiplication, we can rewrite $$ U^TLU = \pmatrix{U_1^T & \cdots & U_m^T}\pmatrix{L_{11} & \cdots & L_{m1}\\ \vdots & \ddots & \vdots\\ L_{m1} & \cdots & L_{mm}} \pmatrix{U_1\\ \vdots \\U_m} = \sum_{i,j = 1}^m L_{i,j} U_i^T U_j $$ So, we have $$ \operatorname{Tr}(U^TLU) = \operatorname{Tr}\left[\sum_{i,j = 1}^m L_{i,j} U_i^T U_j\right] = \sum_{i,j = 1}^m L_{i,j} \operatorname{Tr}(U_i^T U_j) = \sum_{i,j = 1}^m L_{i,j} U_j U_i^T $$

1
On

The inner/Frobenius product is a convenient infix notation for the trace, i.e. $$A:B={\rm tr}(A^TB)$$ With this notation the function can be written in a form which is easy to differentiate $$\eqalign{ f &= {\rm tr}(LUU^T) = L:UU^T \cr df &= L:(dU\,U^T+U\,dU^T) = 2L:dU\,U^T = 2LU:dU \cr \frac{\partial f}{\partial U} &= 2LU \cr }$$ This is the gradient with respect to the full matrix. To isolate the contribution of the $k^{th}$ row multiply by the corresponding base vector $e_k$ to get $$\eqalign{ \frac{\partial f}{\partial U_k} &= e_k^T\frac{\partial f}{\partial U} \,= 2e_k^TLU \cr\cr }$$