I have a few vectors that are almost orthogonal (they are not all unit length). Measured in terms of their mean squared displacement, how can I find the smallest change that makes them exactly orthogonal?
I can arrive at an answer with Gram–Schmidt, but I'm not sure if it will be optimal.
Hint sequence: Consider the problem of finding the orthogonal matrix $U$ that maximizes $\text{tr} (DU)$, for given diagonal matrix $D$ with non-negative entries. And then consider the problem of maximizing $\text{tr}( AU)$ when $A$ is arbitrary. Finally, consider the problem of minimizing the trace of $(B-U)'(B-U)$ with respect to orthogonal $U$, for given matrix $B$.