How to to minimize a sum by changing summation order

78 Views Asked by At

I have two vectors $(x_1,\dots,x_n),(y_1,\dots,y_n) \in \mathbb{R}^{n}$. I want to find a permutation $\sigma$ such that $$ \sum_{i=1}^n |x_i -y_{\sigma(i)}|^2$$ is minimized. Is there a better way than trying out all permutations?