The Question
Given two sets of vectors $S_1$ and $S_2$,we want to find a unit vector $s$ such that $$\{\sum_{u\in S_1}(\|u\|^2-\langle u, s \rangle^2)\} \cdot \{\sum_{v\in S_2}(\|v\|^2 - \langle v, s \rangle^2)\}$$ is minimized, where $\langle *, * \rangle$ denotes the inner product of two vectors, $\|*\|$ the length of a vector.
It is easy to notice that $\|u\|^2 - \langle u, s \rangle^2$ is just the squared distance from $u$ to the line specified by $s$. Consequently, for $$\arg \min_s\sum_{u\in S_1}(\|u\|^2 - \langle u, s \rangle^2)$$, we can get the answer by doing a SVD decomposition. The same holds for the set $S_2$。
However, when the optimization objective becomes a form like the one in my question, how to get the answer? Rather than a closed-form solution, I'm more interested in the time complexity of solving the problem.
As the post below has figured out, the problem can be converted to a tensor problem on the unit sphere.
EDIT
As @user1551's answer points out, the question can be transformed to a form of product of two quadratic forms. Are there any materials covering this topic?
I don't think there is any (semi)closed-form solution, but you can simplify the problem quite a bit (when the dimension of the vector space is small). Presumably all the vectors here are real. Let $A=\sum_{u\in S_1}uu^T$ and $B=\sum_{v\in S_2}vv^T$. Since $$ \|u\|^2-\langle u, s \rangle^2 = u^Tu - (s^Tu)(u^Ts) = \operatorname{trace}(uu^T)-s^Tuu^Ts, $$ it follows that $$ \sum_{u\in S_1}\left(\|u\|^2-\langle u, s \rangle^2\right) = \operatorname{trace}(A)-s^TAs = s^T\left(\operatorname{trace}(A)I-A\right)s. $$ Let $P=\operatorname{trace}(A)I-A$ and $Q=\operatorname{trace}(B)I-B$. These two matrices are positive semidefinite. Now the problem boils down to minimising $(s^TPs)(s^TQs)$ on the unit sphere.