# Vectorizing a sum of rank one matrices and positive definiteness

Let $$x_1,\dots, x_n$$ be a set of $$d-$$dimensional real vectors. Consider the sum of rank-one matrices given as \begin{align}K = \sum_{i,j}(x_i^Tx_j)*(x_ix_j^T)\end{align} Here $$x_i^Tx_j$$ is the dot-product of vectors $$x_i$$ and $$x_j$$. And $$x_ix_j^T$$ denotes the outer product of the same vectors. Is there a nice way of writing this in terms of the matrix $$X=[x_1,\dots,x_n]$$ (i.e. columns are $$x_i$$). Are there any interesting properties for $$K$$?. Can $$K$$ be positive definite?

We can write your matrix $$K$$ as $$K = \sum_{i,j = 1} x_ix_i^Tx_jx_j^T = \left(\sum_i x_ix_i^T\right) \left(\sum_j x_jx_j^T\right) = \left(\sum_i x_ix_i^T\right)^2 = (XX^T)^2$$ Your matrix $$K$$ will always be positive semidefinite. It will be positive definite if and only if the columns of $$X$$ span all of $$\Bbb R^d$$.