Derivative of $\text{trace}(U^T x y^T V)$ with respect to $x$

184 Views Asked by At

I'm trying to compute the derivative of $\text{trace}(U^T x y^T V)$ with respect to $x$, where $U \in \mathbb{R}^{d_x \times k}$, $V \in \mathbb{R}^{d_y \times k}$, $x \in \mathbb{R}^{d_x}$, and $y \in \mathbb{R}^{d_y}$.

I have so far computed the derivative regarding $U$ and $V$, which are:

$$\frac{\partial \text{trace}(U^T x y^T V)}{\partial U} = x y^T V$$ $$\frac{\partial \text{trace}(U^T x y^T V)}{\partial V} = y x^T U$$

For this other derivative, I tried to use rule 101 from Matrix Cookbook, but the shapes aren't matching.

$$\frac{\partial \text{trace}(U^T x y^T V)}{\partial U} = V^T y U$$

whose shapes are $(k \times d_y) (d_y \times 1) (d_x \times k)$.

Wolfram|Alpha gave me $V U^T y^T \cdot \text{trace}(V x U^T y^T)$, in which if I pick the first term, shapes are correct, $(d_y \times k) (k \times d_x) (d_x \times 1)$.

What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

The trace of a matrix equals the trace of its transpose $${\rm tr}(M)={\rm tr}(M^T)$$ Cyclically permuting the arguments of a trace does not change its value $${\rm tr}(ABC)={\rm tr}(CAB)={\rm tr}(BCA)$$ Apply these two facts to your third expression $$\eqalign{ {\rm tr}(U^Txy^TV) &= {\rm tr}(V^Tyx^TU) = {\rm tr}(x^TUV^Ty) \cr }$$ This has the same form as your first expression, therefore its derivative must be $$UV^Ty$$