Convexity of quadratic functions in two variables

We return to the example described here. We consider the two quadratic functions p,q : mathbf{R}^2 rightarrow mathbf{R}, with values

 begin{array}{rcl} p (x) &=& 4x_1^2 + 2x_2^2 + 3 x_1x_2 + 4 x_1 + 5 x_2 + 2 times 10^5,  q(x) &=& 4x_1^2 - 2x_2^2 + 3 x_1x_2 + 4 x_1 + 5 x_2 + 2 times 10^5. end{array}

The Hessian of p is independent of x, and given by the constant matrix:

 nabla^2 p = left(begin{array}{cc} 8 & 3  3 & 4 end{array} right).

We check that the eigenvalues of p are positive, since the determinant, as well as the trace, of the above matrix are. Therefore, p is convex.

Likewise, the Hessian of q is

 nabla^2 q = left(begin{array}{cc} 8 & 3  3 & -4 end{array} right).

This time, the Hessian has a negative eigenvalue, so q is not convex.

Level curve of $p$ 

Level sets and graph of the quadratic function p. The epigraph is anything that extends above the graph in the z-axis direction. This function is ‘‘bowl-shaped’’, or convex.

Level curve of $p$ 

Level sets and graph of the quadratic function q.