Question: Consider the Euclidean metric space $(\mathbb{R}^n , \Vert\cdot \Vert)$.
Let $X\subset \mathbb{R}^n$ and $f\colon X \to \mathbb{R}$.
$X$ is said to be a convex set if for every $x,y \in X$ and $t \in (0,1)$, we have $tx+(1-t)y \in X$.
$f$ is said to be a convex function at $x\in X$ if for every $y \in X$ and $t\in(0,1)$, $tx+(1-t)y\in X$ implies $f(tx+(1-t)y) \le tf(x) +(1-y)f(y)$.
$f$ is said to be a convex function if it is a convex function at every $x \in X$.
Prove the following statements:
If X is a convex set, then $f\colon X \in \mathbb{R}$ is a convex function iff $\{ (x,y) \in X \times \mathbb{R} \mid f(x) \le y \}$ is a convex set.
If $X$ is open in $\mathbb{R}^n$ and $f$ is convex and differentiable at $x \in X$, then $$f(y)-f(x) \ge Df(x)\cdot (y-x)$$ for every $y\in X$, where $Df(x)$ is the derivative of $f(x)$ at $x$.
If $X$ is open in $\mathbb{R}^n$ and $f$ is convex and twice differentiable at $x \in X$, then $D^2f(x)$ is positive semidefinite.
EDIT :
I am deleting how I tried Part 1 as I got my mistake and now it is solved.
Part 2 and Part 3 are still unsolved
For parts 2) and 3), we can use the trick of reducing to the case where we have a convex function of a single variable. Let $y \in X$, and introduce the convex function $g:[0,1] \to \mathbb R$ defined by \begin{equation} g(t) = f(x + t(y-x)). \end{equation}
2) Because $g$ is a function of a single variable, it's easy to show that \begin{equation} g'(0) \leq g(1) - g(0). \end{equation}
By the chain rule, $g$ is differentiable and \begin{equation} g'(0) = Df(x)(y-x). \end{equation} This shows that \begin{equation} Df(x)(y-x) \leq f(y) - f(x). \end{equation}
3) Because $g$ is a function of a single variable, it's easy to show that \begin{equation} g''(0) \geq 0. \end{equation} By the chain rule, \begin{equation} g''(0) = (y-x)^T D^2f(x) (y - x). \end{equation} We see that \begin{equation} (y-x)^T D^2f(x) (y-x) \geq 0 \end{equation} for all $y \in X$. It follows that $D^2f(x)$ is positive semi-definite.