# Problem to prove function is convex or not?

How do I plot function $f(x1,x2)=x^4_1+x^4_2$ such that $x^2_1+x^2_2=1$ and $x_1,x_2\in(0,1)$? Does it possible to plot in MATLAB so that I can visualize the function?

Also I am trying to check whether $f$ is convex or not, because I am trying to optimize it and accordingly formulate the problem like that

Maximize $x^{4}_1+x^{4}_2+\cdots+x^{4}_n$

Subject to

$x^{2}_1+x^{2}_2+\cdots+x^{2}_n=1$

$x_i\in(0,1)$, $i=\{1, 2, \ldots, n\}$

And I calculate its Hessian matrix: $$H=\left[ \begin{array}{cc} 12x^{2}_1 & 0 \\ 0 & 12x^{2}_2 \end{array}\right]$$

After that I don't know how to proceed. Can anyone help me to prove whether f is convex or not?

Thank you very much.

• $f$ (twice differentiable) is convex if and only if its hessian is positive semidefinite, that is exactly the case if every eigenvalues are non-negative. What are the eigenvalues of $H$? Apart from your question, you are maximizing a convex function on a non convex set ... are you sure? – user251257 Mar 20 '16 at 15:24
• This is not a convex optimization model. The Hessian is indeed a convex function; however, you are maximizing it, and that is nonconvex. Furthermore, nonlinear equality constraints are (with very few manufactured exceptions) not convex. – Michael Grant Mar 21 '16 at 13:53

The term "convex" is a bit overloaded. In this single problem alone it needs to be used to ask three different questions:

1. Is this function convex?
2. Is this set convex?
3. Is this optimization model convex?

These questions are not the same, and one does not necessarily imply the others.

Your function $f$ is convex. That is easily verified, as you have done, by examining the Hessian.

Your constraint set $\left\{x\in(0,1)^n\,\middle|\,\sum_i x_i^2=1\right\}$ is not convex. Nonlinear equality constraints are almost never convex. This set describes the positive quadrant of the unit hypersphere, and this is not convex. Indeed, take any distinct pair of points in the set; their midpoint is not in the set (a necessary condition for convexity).

Finally, a convex optimization model requires that:

• Minimization of a convex function, or maximization of a concave function.
• Each and every constraint describes a convex set.

Your model fails both tests, because you are maximizing a convex function, and your nonlinear equality constraint is not convex.

EDIT: I should add that you could relax your constraint to $\left\{x\in(0,1)^n\,\middle|\,\sum_i x_i^2\leq 1\right\}$ without changing the optimal value of the problem. This would make your constraint set convex; but it would still be a nonconvex optimization problem, due to your attempt to maximize a convex function.

All that said, this problem is not that difficult to solve. In order to make the optimum achievable we need to relax the constraints to $\left\{x\in[0,1]^n\,\middle|\,\sum_i x_i^2\leq 1\right\}$ (i.e., non-strict inequalities on $x$). In that case, the optimal value is 1, and the optimal points are all of the unit vectors with a single non-zero value of $1$.