Is this function really not concave or convex in any range?

573 Views Asked by At

Consider the function $f(x,y)=\frac{y}{1+e^x}$ where $0<y<1$ and $x \in \mathbb{R}$.

If you plot this function, it looks like this:

function

Also note that for a given value of $y$ the function $f$ is concave in $x$ for $x<0$ (it is simply a logistic function).

So I expected that I could find some threshold $t$ such that $f$ is jointly concave for $x<t$.

So I calculate the Hessian:

$H(f)= \begin{pmatrix}\frac{y*e^x*(e^x-1)}{(e^x+1)^3} & \frac{-e^x}{(e^x+1)^2} \\ \frac{-e^x}{(e^x+1)^2} & 0 \end{pmatrix}$

For $f$ to be concave we need $H$ to be negative semidefinite. For this we need both eigenvalues to be non-positive. This requires the determinant to be non-negative. But you can see that:

$det(H) = H_{1,1}H_{2,2} - H_{1,2}^2 = 0 - H_{1,2}^2 < 0$

Which seems to suggest $f$ is never concave, regardless of the ranges of $x$ and $y$...

Actually if the determinant is negative it means that $f$ is also never convex.

Am I missing something? Seems like something might be wrong here given how this function looks.