# Find vector that maximizes $f(x) = 2x_1^2+2x_2^2-x_3^3+2x_1x_2$

Find the vector with $||x||^2=x^Tx=1$ that maximizes the following function.

$f(x) = 2x_1^2+2x_2^2-x_3^3+2x_1x_2$

I have rewritten the quadratic form as

$f(x) = \frac{1}{2}x^T \begin{bmatrix} 4&2&0\\2&4&0\\0&0&-2\end{bmatrix} x$

in which the gradient can be found as $\nabla{f}=Qx+b$ where $b = 0$ But this is exactly the point where I'm stuck.

I want to use the First-order necessary condition to find the maximizer but how can I find the vector that maximizes the function if I can't use the FONC because $b=0$?

EDIT: Due to the comment section I found out that this function is NOT quadratic. So if I just take the gradient I get

$\nabla f(x) = \begin{bmatrix} 4x_1+2x_2\\4x_2+2x_1\\-3x_3^2\end{bmatrix}$ but still, can someone show me how to do it from here?

EDIT2: Using Lagrange multiplier I get the Lagrange function:

$L(x,y) = 2x_1^2+2x_2^2-x_3^3+2x_1x_2-\lambda(x_1^2+x_2^2+x_3^2-1)$

Taking partial derivatives and setting it equal to zero I get

$\begin{bmatrix} 4x_1+2x_2-2\lambda x_1\\4x_2+2x_1-2\lambda x_2\\-3x_3^2-2\lambda x_3\\-x_1^2-x_2^2-x_3^2+1 \end{bmatrix} = \begin{bmatrix} 0\\0\\0\\0\end{bmatrix}$

But I get from the third equation that lambda equals -1 and then filling it in the other equations I get $x_1=0, x_2=0$ and $x_3 = 1$ or $x_3 = -1$ But as the person below kindly showed the answer should be 3.

• Your function $f$ is NOT quadratic. – Batominovski Jul 26 '15 at 14:49
• Is there a specific technique that you are trying to use to solve this problem? Because otherwise it is a simple matter of a lagrange multiplier in 3 variables. – DanielV Jul 26 '15 at 16:25
• @DanielV I have edited and used the lagrange multiplier as you suggested but my answer differs from what was said below. Can you see what I am doing wrong? – Peter Jul 26 '15 at 17:14
• The equations actually have several solutions~, you've only found 1 – DanielV Jul 26 '15 at 17:26

$$2x_1^2+2 x_1 x_2+2x_2^2-x_3^3 = 3\left(\frac{x_1+x_2}{\sqrt{2}}\right)^2+\left(\frac{x_1-x_2}{\sqrt{2}}\right)^2-x_3^3$$ hence the problem is equivalent to finding the maximum of: $$3a^2+b^2-c^3$$ under the constraint $a^2+b^2+c^2=1$. Given that $a^2+b^2=1-c^2$, the maximum of $3a^2+b^2$ is achieved when $b=0$, so the last problem is equivalent to finding the maximum of: $$f(c)=3(1-c^2)-c^3$$ under the constrant $c\in[-1,1]$. Such a maximum is attained at $c=0$ and it equals $\color{red}{3}$.
• @Peter: the stationary point you computed is the minimum. The maximum is given by $\lambda=3$. – Jack D'Aurizio Jul 26 '15 at 17:32