$\frac{\partial ||\mathbf{X}^T -\mathbf{A} ||_F^2}{\partial \mathbf{X}}$ is zero?

111 Views Asked by At

Let $\mathbf{X} \in \mathbb{R}^{n \times m}$, $\mathbf{A} \in \mathbb{R}^{m \times n}$, $(.)^T$ denotes the transpose operator and $||.||_F$ is the matrix Frobenius norm

What is the value of $\frac{\partial ||\mathbf{X}^T -\mathbf{A} ||_F^2}{\partial \mathbf{X}}$ ?

Is it zero?

Please, any help?

2

There are 2 best solutions below

7
On

Let $X$ and $A$ be two matrices of same dimensions, then $$\Vert X - A \Vert_F^2 = \text{trace}\big( X^T X - X^TA - A^TX + A^TA\big)$$ And using $$\frac{\partial}{\partial X} \text{trace} (X^TAX) = X^T(A + A^T)$$ and $$\frac{\partial}{\partial X} \text{trace} (X^TA) = A$$ we get $$\frac{\partial \Vert X - A \Vert^2}{\partial X} = 2X^T - A - A^T$$ You ask if it is zero. Let's equate it to zero, we get $$X = \frac{1}{2}(A + A^T)$$

1
On

The answer is $2(\mathbf{X} - \mathbf{A}^T)$.

You have $||\mathbf{X}^T - \mathbf{A}||_F^2 = trace((\mathbf{X}^T - \mathbf{A})(\mathbf{X}^T - \mathbf{A})^T) = trace((\mathbf{X}^T - \mathbf{A}) (\mathbf{X} - \mathbf{A}^T)) = trace(\mathbf{X}^T \mathbf{X} - \mathbf{X}^T \mathbf{A}^T - \mathbf{AX} + \mathbf{A}\mathbf{A}^T) = trace(\mathbf{X}^T \mathbf{X}) - trace(\mathbf{X}^T\mathbf{A}^T) - trace(\mathbf{AX}) + trace(\mathbf{A}\mathbf{A}^T) =trace(\mathbf{X\mathbf{X}^T}) - trace((\mathbf{AX})^T) - trace(\mathbf{AX}) + trace(\mathbf{A}\mathbf{A}^T) = trace(\mathbf{X\mathbf{X}^T}) - 2trace(\mathbf{AX}) + trace(\mathbf{A}\mathbf{A}^T)$.

Keep in mind that $trace(\mathbf{AB}) = trace(\mathbf{BA}))$, where $\mathbf{B}$ is a matrix, and $trace(\mathbf{A}^T) = trace(\mathbf{A})$.

Then we have:

$\frac{\partial (trace(\mathbf{X}\mathbf{X}^T))}{\partial \mathbf{X}} = 2\mathbf{X}$.

$\frac{\partial (trace(\mathbf{AX}))}{\partial \mathbf{X}} = \frac{\partial (trace(\mathbf{XA}))}{\partial \mathbf{X}} = \mathbf{A}^T$.

$\frac{\partial (trace(\mathbf{A}\mathbf{A}^T))}{\partial \mathbf{X}} = 0$

Therefore, $\frac{\partial ||\mathbf{X}^T - \mathbf{A}||_F^2}{\partial \mathbf{X}} = 2(\mathbf{X} - \mathbf{A}^T)$.