TITLE: Prove a function is non convex
QUESTION [2 upvotes]: I have a simple function dependent on two variables $x_1$ and $x_2$:
$$
f(x) = \ln\left(\frac{x_1}{x_2}\right)
$$
where $x_1, x_2 > 0$ (strictly positive).
I know this function is non convex as, given $0 < \lambda < 1$, I can easily find a numerical example with points $a,\, b\, (a < b)$ that violates:
$$
f((1-\lambda) a + \lambda b) \leq (1-\lambda) f(a) + \lambda f(b)
$$
Also, since the function is an equality and it is not linear it cannot be convex.
However, I am looking to prove analytically that the function above is nonconvex, how could I do that?
Thank you very much.

REPLY [3 votes]: Well, calculating the Hessian matrix of your function yields:
$$H=
\begin{pmatrix}
\frac{-1}{x_1^2} & 0\\
0&\frac{1}{x_2^2}
\end{pmatrix}
$$
So the function is not convex, since H is clearly not positive (semi-)definite.
{"set_name": "stack_exchange", "score": 2, "question_id": 499750}