This question is related to a derivation step in " A Duality View of Spectral Methods for Dimensionality Reduction" Xiao et al. 2006
When deriving the dual equation for Maximum Variance Unfolding (MVU) the authors take the following steps:
$L(K,Z,\eta,W) = \mathbf{Tr}K + \mathbf{Tr} KZ - \eta \mathbf{1}^TK\mathbf{1} - \sum_{\{i,j\}\in E}$ $W_{i,j}(\mathbf{Tr} KE^{i,j}- D_{ij})$
$ = \mathbf{Tr}K (I + Z -\eta \mathbf{1}\mathbf{1}^T - \sum_{\{i,j\}\in E}$ $W_{i,j}\mathbf E^{i,j}) + \sum_{\{i,j\}\in E} D_{i,j}W_{i,j}$
My question is related to the ability to factor out the $\mathbf{Tr}K$ term. Specifically, I don't understand how:
$\eta \mathbf{1}^TK\mathbf{1} = \mathbf{Tr}K(\eta \mathbf{1} \mathbf{1}^T)$
Thanks in advance for any help.
Let $k_{i,j}$ be the element in row $i$ and column $j$ of matrix $K$ of size $N\times N$. Then $\mathbf{1}^TK\mathbf{1}$ is the sum of all the elements of $K$, so $$\eta\mathbf{1}^TK\mathbf{1}=\eta\sum_{i=0}^{N-1}\sum_{i=0}^{N-1}k_{i,j}$$
Now the $i^{th}$ diagonal element of matrix product $K(\eta\mathbf{1}\mathbf{1}^T)$ will be the sum of the elements in row $i$ of matrix $K$ $$\eta\sum_{j=0}^{N-1}k_{i,j}$$ leading to the trace (sum of all $N$ diagonal elements) being $$\mathbf{Tr}K(\eta\mathbf{1}\mathbf{1}^T)=\eta\sum_{i=0}^{N-1}\sum_{i=0}^{N-1}k_{i,j}=\eta\mathbf{1}^TK\mathbf{1}$$