# Is this function convex

Is function $$f(x, y) = \left(\frac{x}{y} - a\right)^2 \left(\frac{y}{x} - \frac{1}{a}\right)^2$$ convex on the domain $$\{(x,y): x, y \in \mathbb{R}, x >0, y >0 \}\quad?$$

Now I think that it is not convex. I calculated $$f''_{xx}=\frac{2(x^2 - 3 a^2y^2 + 2xay)}{ayx^4}$$ which can be negative when $x$ is small and $y$ is large. It means that the hessian cannot be positive definite, so $f(x,y)$ is not convex. Is that right?

EDIT: Correct calculations $$f''_{xx} = \frac{3a^2y^2}{x^4} +\frac{1}{a^2y^2} - \frac{4ay}{x^3}$$

-

Let's generalize. When is a function of the form $f(x,y)=g(x/y)$ convex in the positive quadrant? We have $\nabla f = \langle y^{-1} g', -xy^{-2}g'\rangle$, and therefore the Hessian is $$D^2f = \begin{pmatrix} y^{-2} g'' & -xy^{-3}g'' - y^{-2}g' \\ -xy^{-3}g'' - y^{-2}g' & x^2y^{-4} g'' + 2xy^{-3}g' \end{pmatrix} \tag1$$ The determinant simplifies nicely: $$\det D^2f = x^2y^{-6} (g'')^2+2xy^{-5}g''g' - (xy^{-3}g'' + y^{-2}g')^2 = -y^{-4} (g')^2 \tag2$$ Well, isn't this sad. The function $f$ is not convex unless it is constant.
@5pm if $g''$ is positive then $D^2f$ is negative definite? –  ashim Mar 4 '13 at 21:32
@ashim Since the determinant of $D^2f$ is $\le 0$, the matrix $D^2f$ cannot be either positive-definite or negative-definite. –  user53153 Mar 4 '13 at 21:34
If $f : [0, 1] \to \mathbb{R}$ be a function defined by $f(x) = - \sqrt{1 - x^{2}}$. I want to show that $f$ is convex on $[0, 1]$, but I know that $f''(x) \geq 0$ for each $x \in (0, 1)$. It follows that $f$ is convex on $(0, 1)$. How can I prove for $[0, 1]$ ? –  nameless Oct 23 '13 at 15:44