Linear algebra derivative

74 Views Asked by At

I have two given vectors $u \in \mathbb{R}^n$ and $v \in \mathbb{R}^n$. I have the following application $f(X) = u^TXv $. I want to calculate its gradient w.r.t to X (which is supposed to be symmetric definite positive). So i did the following : $$u^TXv = trace(u^TXv)= trace((uv^T)^T X) $$Hence I get the following : $$\nabla f(X) = uv^T$$ But since $u^TXv= v^TXu$, I could also have obtained $$\nabla f(X) = vu^T $$

So what is the right answer ?

2

There are 2 best solutions below

0
On BEST ANSWER

The convention you choosed for the gradient w.r.t. X need not to change once fixed . First you considered $\nabla_X f(X)=(\nabla_{x_{i,j}} f(X))_{i,j}$ and then you changed $\nabla_{X^T} f(X)=(\nabla_{x_{j,i}} f(X))_{i,j}$ .

0
On

No this is not the answer. I supposed X to be symmetric. Read the whole problem. In fact we have : $\mathcal{A}_n$ and $S_n$ which are orthogonal complementary in $\mathcal{M}_n(\mathbb{R})$ hence : $$trace(uv^TX)=trace((\frac{1}{2}(uv^T+vu^T)+\frac{1}{2}(uv^T-vu^T))X)=trace(\frac{1}{2}(uv^T+vu^T)X)$$ Because remember $\frac{1}{2}(uv^T-vu^T)$ belongs to $\mathcal{A}_n$ and $X$ belongs to $S_n$ hence the trace (which is the inner product is equal 0) hence the good answer was : $$\nabla f = \frac{1}{2}(uv^T+vu^T)$$