I'm stuck on a problem in Boyd's optimization book. I need a hint on how to convert the following quartic function into a quadratic one. I've gone as far as expanding the whole thing into a big summation comprised of terms of the form $x^Tx, ~ a_i^Tx$, etc. but haven't got anywhere from there. I want to know if my approach is correct at all.
$f(x)=\sum_i ~(\|x-a_i\|^2 - r^2)^2$
where $r\in R$ and $x,a_i\in R^n$.
Here's what I've done so far.
$f(x)=g(x)^Tg(x)$ where $g(x)=\begin{bmatrix} (x-a_1)^T(x-a_1)\\ \vdots \\ (x-a_n)^T(x-a_n) \end{bmatrix} - \begin{bmatrix} r^2\\ \vdots \\ r^2 \end{bmatrix}.$
Edit: Something just came to my mind. If I can prove that $R\leq \| x\|^2$ at the optimal $x$ for $R= \| x\|^2-r$, then I can linearize the terms $\|x-a_i\|^2 - r^2$ by introducing the variable $R$. Anyone has an idea how I can prove $R\leq \| x\|^2$?