How do I take derivative that involves double summation?

217 Views Asked by At

Suppose I have a function like this:

$$E(U,V) =\sum_{(u,i)\in M} (M_{u,i} -U^{\mathrm T}_u V_i)^2 = \sum_{(u,i)\in M} \left( M_{u,i} -\sum_{k=1}^r U_{u,k} V_{i,k} \right)^2.$$

How do I take the partial derivative of $E$ with respect to $U_{u, i}$?

Could anyone point me to some reference or give me some suggestion on how to solve this?

1

There are 1 best solutions below

0
On

Lets say you want the partial derivative with respect to $U_{mn}$. Most of the summands are treated as constants so derivation yields:

$$\frac{\partial E}{\partial U_{mn}}(U, V) = \frac{\partial}{\partial U_{mn}} \sum_{i} (M_{mi}-U_{mn}V_{in})^2$$

Using the linearity of the derivation operator and the chain rule we have:

$$=\sum_{i}\frac{\partial}{\partial U_{mn}} (M_{mi}-U_{mn}V_{in})^2 = \sum_{i} 2(M_{mi}-U_{mn}V_{in})(-V_{in}).$$ Which can be written as $$=-2(MV)_{mn} + 2U_{mn} ||V_n||^2$$ where $(MV)_{mn}$ is the $mn$-th entry of the matrix product $MV$ and $||V_n||$ is the euclidean norm of the $n$-th column of $V$.