Let $P = [P_1, P_2, \ldots, P_m]$ where $P_i$ is a $k$ dimensional vector.
I have this set $(u,w) \in \Phi$ and this matrix $D^{m\times m}$ and for each $(u,w) \in \Phi$ I have $D[u,w] = 1$, and now consider this summation: $$ \sum_{u = 1}^{m}\sum_{w \in D(u)} ||P_{u} - P_{w}||^2 $$
Where $P_i$ is a $k$ dimensional vector, and $D(u)$ is a set where for each element of this set we have: $D[u,i] = 1$, for each $i \in D(u)$, consider matrix $C$ where except for $C_{uu} = C_{ww} = 1$ and $C_{uw} = C_{wu} = -1$, all other elements are zero. How the above summation is equal to this: $$ Tr(CP^TP) $$
I am reading this paper and it is right in equation (4) and (5)
This is obvious. For each $i\in\{1,2,\ldots,m\}$, denote by $e_i\in\mathbb R^m$ the $i$-th vector in the standard basis, i.e. all entries of $e_i$ are zero, except that the $i$-th entry is one. Using the property of matrix trace that $\operatorname{tr}(XY)=\operatorname{tr}(YX)$ whenever both $XY$ and $YX$ make sense, we get \begin{align} \|P_u-P_w\|^2 &=(P_u-P_w)^T(P_u-P_w)\\ &=(e_u-e_w)^TP^TP(e_u-e_w)\\ &=\operatorname{tr}\bigg(\underbrace{(e_u-e_w)^TP^TP}_X\ \underbrace{(e_u-e_w)}_Y\bigg)\\ &=\operatorname{tr}\left((e_u-e_w)(e_u-e_w)^TP^TP\right)\\ &=\operatorname{tr}(CP^TP). \end{align}