Convex Analysis – Is f(x,y) = (y+2)/(x+y+2) Convex Anywhere?

calculusconvex-analysishessian-matrixlinear algebramultivariable-calculus

So, from Multivariate Calculus and Linear Algebra, I learned that:

  1. Given $f(x,y)$, I can find out if it is convex by checking if the eigenvalues of its Hessian are positive or zero (i.e. if the Hessian is positive-semidefinite).
  2. The determinant of any matrix is the product of its eigenvalues.

Therefore, I assumed that, given a simple function $f(x,y) = \frac{y+2}{x+y+2}$, which looks convex in the positive domain (picture below), I could just find its Hessian, take the derivative and note that it was not negative in this region (positive $x, y$). I know that being positive could mean it is either convex or concave, but I was hoping not to see a negative determinant in this region.

enter image description here

Its Hessian is easy to compute:

$$H = \begin{bmatrix}
\frac{2(y+2)}{(x+y+2)^3} & \frac{-x+y+2}{(x+y+2)^3} \\
\frac{-x+y+2}{(x+y+2)^3} & \frac{-2x}{(x+y+2)^3} \\
\end{bmatrix}$$

The determinant, though, is negative everywhere, independent of $x, y$. That is:

$$\det(H) = \frac{-1}{(x+y+2)^4} < 0$$ everywhere.

Now, following from (1) and (2), this would mean that even for $x, y>0$, the region where it is apparently convex, both eigenvalues of H have opposite signs, which would make H not positive-semidefinite, which would make $f(x,y)$ not convex anywhere. This simply does not seem to be the case by just graphing the function.

What did I get wrong?

PS: I know it is concave for most of the negative region and that f is not convex in $\Bbb R^2$. I just wanted to 'prove' that it is convex for positive $x, y$.

Best Answer

The graph does not have a positive-definite nor negative-definite hessian anywhere; it is not convex on any open region. One nice way of seeing this is to restrict the function, at any point $(x_0, y_0) \in (0, \infty)^2$ to two different lines passing through the point, and verify that the function is convex in one direction, but concave in the other. That is, as your calculation verifies, each point is a saddle point.

It's not difficult to do. Fix $(x_0, y_0)$, and consider: $$g(x) = f(x, y_0) = \frac{y_0 + 2}{x + y_0 + 2},$$ which has second derivative: $$g''(x) = \frac{2(y_0 + 2)}{(x + y_0 + 2)^3} > 0,$$ hence the function is convex in this direction, i.e. along the horizontal line $y = y_0$. On the other hand, if we let: $$h(y) = f(x_0, y) = \frac{y + 2}{x_0 + y + 2} = 1 - \frac{x_0}{x_0 + y + 2},$$ then $$h''(y) = -\frac{2x_0}{(x_0 + y + 2)^3} < 0,$$ so the function is concave in the vertical direction $x = x_0$.

Related Question