Frobenius norm derivative for a quadratic form

derivativesmatricesmatrix-calculusnormed-spaces

I have the following loss function:

$\vert\vert Y – XBX^{\top} \vert\vert_F^2$

where $Y, X$ and $B$ are square and symmetric matrices and $\vert \vert \cdot \vert \vert$ denotes the Frobenius norm. Which is the derivative of the loss function with respect to $X$?

Best Answer

$$\begin{aligned} &\frac{𝖽 ‖ Y - XBX^⊤ ‖_F^2}{𝖽 X} \\ &=\frac{𝖽 ‖ Y - XBX^⊤ ‖_F^2}{𝖽(Y - XBX^⊤)} ∘ \frac{𝖽 (Y - XBX^⊤)}{𝖽 X} \\ &= [{∆Z}↦2⟨Y - XBX^⊤∣{∆Z}⟩_F] ∘ [{∆X} ↦ XB{∆X}^⊤ + {∆X}BX^⊤] \\ &= [{∆X} ⟼ 2⟨Y - XBX^⊤∣XB{∆X}^⊤ + {∆X}BX^⊤⟩_F] \\ &\text{To get the derivative in tensorial form, we need to move everything except ${∆X}$ to the left.} \\ &= [{∆X} ⟼ 2⟨Y - XBX^⊤∣XB{∆X}^⊤⟩_F + 2⟨Y - XBX^⊤∣{∆X}BX^⊤⟩_F] \\ &= [{∆X} ⟼ ⟨2B^⊤X^⊤(Y - XBX^⊤)∣{∆X}^⊤⟩_F + ⟨2(Y - XBX^⊤)XB^⊤∣{∆X}⟩_F] \\ &= [{∆X} ⟼ ⟨2(Y - XBX^⊤)^⊤XB∣{∆X}⟩_F + ⟨2(Y - XBX^⊤)XB^⊤∣{∆X}⟩_F] \\ &= [{∆X} ⟼ ⟨4(Y - XBX^⊤)XB∣{∆X}⟩_F] \end{aligned}$$

Related Question