Is the function $f(x,y) = -\log(x) \times \exp(y)$ convex?

75 Views Asked by At

The function $f(x,y) = -\log(x) \times \exp(y)$, with $0 \le x \le 1$ and $\infty < y < \infty$, is the product of two convex functions $-\log(x)$ and $\exp(y)$. I know that the product of two convex functions may not be convex, but is this particular function $f(x,y)$ convex?

I plot the function in Python, it looks convex. How to prove it formally?

The code:

import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

x = np.linspace(0.01,0.99,99)
y = np.linspace(-10,10,99)
X,Y = np.meshgrid(x,y)
Z = -np.log(X) * np.exp(Y)

fig = plt.figure(figsize=(10,6))
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X,Y,Z)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('f(x,z)')

The plot from different angles: enter image description here

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

Let's calculate hessian:

$$\frac{\partial f}{\partial x}=\frac{-e^y}{x} \qquad , \qquad \frac{\partial f}{\partial y}=-\ln(x)y^y\\ h_{11}=\frac{\partial^2f}{\partial x^2}=\frac{e^y}{x^2} \qquad , \qquad h_{22}=\frac{\partial^2f}{\partial y^2}=-\ln(x)y^y\\ h_{12}=\frac{\partial^2f}{\partial x\partial y}=\frac{-e^y}{x} \quad \; ,\;\; \quad \; h_{12}=\frac{\partial^2f}{\partial x\partial y}=\frac{-e^y}{x} \quad \\ H=\begin{bmatrix}h_{11} &h_{12}\\ h_{21} &h_{22} \end{bmatrix} $$

To determine $f(x,y)$ is convex, is equivalent to determining $H$ is PSD or not. $H$ is symmetric, thus we need to investigate the sign of each eigenvalue. We have

$$\det(H) = \frac{-e^{2y}(\ln x+1)}{x^2}=\lambda_1\lambda_2\qquad,\qquad \text{tr}(H) =e^y\left( \frac{1}{x^2}-\ln x \right)= \lambda_1+\lambda_2 $$ $y$ has no effect on the sign of eigenvalues, thus we only need to investigate range of $x$. For $H$ to have any kind of structure (concave or convex) we need $\det(H)\ge0$, therefore $-(\ln x+1)\ge0 \Rightarrow x\in (0,\frac{1}{e})$. In this region ($x\in (0,\frac{1}{e})$) we have $-\ln x >1$ and $\frac{1}{x^2}>0$ and thus $\text{tr}(H)>0$ and therefore $f(x,y)$ is convex in this region. For the rest of the range $x\in[\frac{1}{e},1)$ the Hessian $H$ is indefinite and $f(x,y)$ has no meaningful structure.

0
On

It is quite clear from a simple plot that, for example, the restriction $f(x,3x)$ is not convex on $0<x<1$, therefore neither is $f(x,y)$.