TITLE: How to check convexity?
QUESTION [26 upvotes]: How can I know the function $$f(x,y)=\frac{y^2}{xy+1}$$ with $x>0$,$y>0$ is convex or not?

REPLY [14 votes]: The Hessian of $\frac{y^2}{1+xy}$ is
$$
H
=
\frac1{(1+xy)^3}\begin{bmatrix}
2y^4&-y^2(3+xy)\\[12pt]
-y^2(3+xy)&2
\end{bmatrix}
$$
and
$$
\begin{bmatrix}
u&v
\end{bmatrix}
H
\begin{bmatrix}
u\\v
\end{bmatrix}
=\frac2{(1+xy)^3}(v-uy^2)^2-\frac1{(1+xy)^2}uvy^2
$$
Setting $\begin{bmatrix}u&v\end{bmatrix}=\begin{bmatrix}1&y^2\end{bmatrix}$ gives
$$
\begin{bmatrix}
1&y^2
\end{bmatrix}
H
\begin{bmatrix}
1\\y^2
\end{bmatrix}
=-\frac{y^4}{(1+xy)^2}
$$
so $\frac{y^2}{1+xy}$ is not convex as long as $y\ne0$.