this might be a dumb question, but I was working on a problem and ran into the following (sub)problem.
Suppose we have a nonnegative vector $\pi \in \mathbf{R}^n$ that satisfies $\sum_{i=1}^n \pi_i = 1$, i.e., it is a discrete probability density. We want to choose a unit vector $v \in \mathbf{R}^n$, $\|v\|=1$, where $\| \cdot \|$ is the Euclidean norm, such that the "variance"
$f(v) = \sum_{i=1}^n v_i^2 \pi_i - (\sum_{i=1}^n v_i \pi_i)^2$
is maximized. Of course there will be multiple maxima, because $f(v) = f(-v)$.
Is there any closed form solutions for the maximum $v$ or any ideas how to find it, or what is the maximum function value $f(v)$? Specifically, I want to show that if $\pi_1 > 0.5$, then any maximum $v$ satisfies ${\rm sign}(v_1) = -{\rm sign}(v_i)$ for all $i \neq 1$.
Any tips or ideas? Thank you very much!