What is the derivative of this operation
$A=Trace [(1U-W)\circ(1U-W)]$ with respect to $U$, when $\circ$ represents an element wise (hadamard) product. $1$ is a matrix with same size as $U$ where all elements are $1$.
What is the derivative of this operation
$A=Trace [(1U-W)\circ(1U-W)]$ with respect to $U$, when $\circ$ represents an element wise (hadamard) product. $1$ is a matrix with same size as $U$ where all elements are $1$.
We have for $U, H \in \def\Mat{\mathop{\rm Mat}\nolimits}\Mat_n(\def\R{\mathbb R}\R)$ that$\def\tr{\mathop{\rm Trace}}$ \begin{align*} A(U+H) &= \tr\bigl([1(U+H) - W]\circ [1(U+H)-W]\bigr)\\ &= \tr\bigl((1U - W + 1H)\circ (1U - W + 1H)\bigr)\\ &= \tr\bigl((1U - W)\circ(1U- W) + 2\cdot 1H\circ(1U-W) + 1H \circ 1H\bigr)\\ &= A(U) + 2 \tr \bigl(1H \circ (1U-W)\bigr) + \tr(1H \circ 1H) \end{align*} Now $\def\abs#1{\left|#1\right|}\def\norm#1{\left\|#1\right\|}$ $\tr(1H \circ 1H)$ is a finite sum of two-factor-products of entries of $H$, hence $\abs{\tr(1H \circ 1H)} \le C\norm{H}^2$ for some ($n$-dependent) constant $C$. So $\tr(1H \circ 1H) = o(\norm H)$ and as $H \mapsto 2\tr(1H \circ (1U-W))$ is linear in $H$, this is the derivative, giving $$ A'(U)H = 2\tr\bigl(1H \circ (1U- W)\bigr) $$