Let $A$ be $p\times p$ symmetric positive definite with distinct eigenvalues and $x\_p\in \mathbb{R}^p$ and consider the problem


Minimize $x'Ax + b'x$


Subject to $x'x=1$


Most of the information I've found is is either very general/theoretical or specific to linear constraints, although I'm largely flitting around optimization texts and crossing my fingers since I don't know exactly what I'm looking for. 


Anyway, my first pass was to use a Lagrange multiplier;


$f(x, \lambda) = x'Ax + b'x + \lambda(x'x-1)$


Taking derivatives and setting to zero gives


$x = -\frac{1}{2} (A+\lambda I)^{-1}b$


$\frac{1}{4} b'(A+\lambda I)^{-2}b = 1$


I've got my system in $p+1$ equations and I can go about solving them. Analytically I haven't gotten anywhere, except simplifying things a little with the eigendecomposition of $A$. When $b=0$ the solution is trivially $x=e\_1$, the first eigenvector of $A$, so let's ignore that case. So my first question: is there an analytical solution that I'm too mathematically challenged to see? If not, what is the best way to solve this problem? 


(To help quantify "best", I have potentially many such problems to solve for smallish $p$, say 5-10, and $A$ is the same but $b$ changes. An approximate solution is OK, in fact an approximate solution near the correct global solution is better than an exact local one.)



Optimizing a quadratic restricted to the sphere
Your problem has been studied extensively in the context of trust region methods for optimization, and there are a number of algorithms that have been developed. 


See for example:


W. W. Hager, Minimizing a quadratic over a sphere. SIAM Journal on Optimization, 12:188-208, 2001. 


Hager's paper gives a lemma that characterizes the solutions to your problem and a solution in terms of the eigenvalues and eigenvectors of A as well as algorithms for solving the problem. Since then there have been several other papers written on this topic, with particular attention to algorithms for solving instances where A is large and sparse- this isn't a particular issue for you. 


