Constrained optimization involving unit vectors I want to find the vector $v$ with the following properties
$v \cdot v = 1$, (unit length)
$v \cdot w = \alpha$, where $w$ is also a unit vector
$(v \cdot n)^2$ is minimized
Is there a closed solution for $v$? 
 A: WLOG assume $w=(1,0,...,0)$ and $n = (n_1,n_2,0,...,0)$; i.e. pick coordinates so that $w$ is the first unit vector, and $n$ is in the plane spanned by the first and second unit vectors. Write $v=(v_1,...,v_k)$.
Then $v\cdot w=\alpha$ means $v = (\alpha,v_2,...,v_k)$ and $v\cdot v=1$ means that $v_2^2+\cdots + v_k^2 = 1-\alpha^2$. Thus, if $\alpha > 1$ there is no solution.
Now note that,
$$
(v\cdot n)^2 
= (\alpha n_1 + v_2n_2)^2 
= (\alpha n_1 / n_2 + v_2)^2 / n_2^2
$$
This is a quadratic in $v_2$ which is minimized at $v_2=\alpha n_1 / n_2$ and increases away from this value. However, we have the constraint $v_2^2 = 1 - \alpha^2 - v_3^2 - \cdots v_k^2$ which means we need $v_2^2 \leq 1 - \alpha^2$.
Thus, we should pick $v_2$ as close to $\alpha n_1 / n_2$ as possible while still keeping $v_2^2 \leq 1-\alpha^2$.
Explicitly,
$$
v_2 = \begin{cases}
-\sqrt{1-\alpha^2} & \alpha n_1/n_2 \leq -\sqrt{1-\alpha^2} \\
\alpha n_1 / n_2 & -\sqrt{1-\alpha^2} < \alpha n_1 / n_2 < \sqrt{1-\alpha^2} \\ 
\sqrt{1-\alpha^2} & \alpha n_1/n_2 \geq \sqrt{1-\alpha^2} 
\end{cases}
$$
In the first and last cases, $v_3,...,v_k$ must all be zeero to satisfy the constraints. However, in the middle case we can pick any $v_3,...,v_k$ so that the constraints are satisfied (for $k>3$ there will be infinitely many solutions).
