<s>[INST] Prove $f(x, y) = \frac{x^2}{y}$ is a convex function on the set $\{(x, y) \in \mathbb{R}^2 : y > 0\}$ 
Prove $f(x, y) = \frac{x^2}{y}$ is a convex function on the set $\{(x,y) \in  \mathbb{R}^2 : y > 0\}$.


Attempt:
I start with the basic convexity, i.e.,
\begin{align}
f( \alpha_1 x_1 + \alpha_2 x_2) \leq \alpha_1 f(x_1) + \alpha_2f(x_2) \ ,
\end{align}
where $\alpha_1 + \alpha_2 = 1$.
Let $z = (x,y)$, then 
\begin{align}
f( \alpha z_1 + (1-\alpha) z_2) \leq \alpha f(z_1) + (1-\alpha)f(z_2) \ ,
\end{align}
How to proceed from here? Thank you so much.

Question: Can this be proved by perspective function? If yes, how to prove that.
 [/INST] A twice continuously differentiable function of several variables is convex on a convex set if and only if its Hessian matrix of second partial derivatives is positive semidefinite on the interior of the convex set.
$$f(x,y) = \frac{x^2}{y}$$
Partial derivatives:
$$\frac{\partial f(x,y)}{\partial x} = \frac{2x}{y}, \frac{\partial f(x,y)}{\partial y} = -\frac{x^2}{y^2}$$
$$\frac{\partial^2 f(x,y)}{\partial x^2} = \frac{2}{y}, \frac{\partial^2 f(x,y)}{\partial x \partial y} = -\frac{2x}{y^2}$$
$$\frac{\partial^2 f(x,y)}{\partial y \partial x} = -\frac{2x}{y^2}, \frac{\partial^2 f(x,y)}{\partial y^2} = \frac{2x^2}{y^3}$$
Hessian matrix:
$$H = 
\begin{bmatrix}
    \frac{\partial^2 f(x,y)}{\partial x^2} & \frac{\partial^2 f(x,y)}{\partial x \partial y} \\
    \frac{\partial^2 f(x,y)}{\partial y \partial x} & \frac{\partial^2 f(x,y)}{\partial y^2}
\end{bmatrix}
$$
$$H = 
\begin{bmatrix}
    \frac{2}{y} & -\frac{2x}{y^2} \\
    -\frac{2x}{y^2} & \frac{2x^2}{y^3}
\end{bmatrix}
$$
Sylvester's criterion is used to prove that matrix is positive semidefinite:
matrix is positive semidefinite if and only if all leading minors are non-negative.
$$\Delta_{(1)} = \frac{\partial^2 f(x,y)}{\partial x^2} = \frac{2}{y} >= 0$$
$$\Delta_{(2)} = \frac{\partial^2 f(x,y)}{\partial y^2} = \frac{2x^2}{y^3} >= 0$$
$$\Delta_{(1,2)} = 
\begin{vmatrix}
    \frac{2}{y} & -\frac{2x}{y^2} \\
    -\frac{2x}{y^2} & \frac{2x^2}{y^3}
\end{vmatrix} = 
\frac{2}{y} * \frac{2x^2}{y^3} - (-\frac{2x}{y^2}) * (-\frac{2x}{y^2}) = 
\frac{4x^2}{y^4} - \frac{4x^2}{y^4} = 0$$
So, all leading minors are non-negative on $\lbrace (x,y) \in \mathbb{R}^2 : y>0 \rbrace$.
Hence, Hessian matrix is positive semidefinite.
Hence, function $f(x,y)$ is a convex function on the set $\lbrace (x,y) \in \mathbb{R}^2 : y>0 \rbrace$.
</s>