Maximize $y^T (X \beta) $ s.t. $(X \beta)^T (X \beta) = y^T y$.
Here $y$ is a known vector with size $n$ and $X$ is a known $n$ by $m$ matrix. $\beta$ is the unknown vector with size $m$ we want to find the solution to. $X$ is "skinny" so $n >> m$
I feel like intuitively there should be a closed form solution. $y^T (X \beta) $ from Cauchy inequality, maximizes when $y$ and $X \beta$ are linearly dependent. $(X \beta)^T (X \beta) = y^T y$ just enforces that the standard deviation of linear combination of $\beta X$ and $y$ are the same. But I cannot derive it ...
Lagrangian: $$y^\top X \beta + \lambda(\beta^\top X^\top X \beta - y^\top y)$$
KKT conditions:
Stationarity implies $\beta = c(X^\top X)^{-1} X^\top y$ for some scalar $c$. Plugging this into the primal feasibility condition will help you figure out the correct scalar $c$.