Convexity of a function in $\mathbb{R^2}$ I have to find if this function is convex or not...
$$f(x_1, x_2) = 2x_1^2 −x_1x_2 + x_2^2 −3x_1 + e^{2x_1+x_2}$$
For me its convex (I have plot the surface and it seems convex). To prove it, I tried many things but It didn't work.
First, $2x_1^2$, $x_2^2$ and $e^{2x_1+x_2}$ are convex (trivial), $-3x_1$ is affine so also convex. Now, I have to show that $−x_1x_2$ but I am not really sure of that
Thank you in advance !
 A: We could compute the Hessian
$$H = \begin{bmatrix}
4 + 4e^{2x_1+x_2} & -1+2e^{2x_1+x_2} \\
-1+2e^{2x_1+x_2} & 2+e^{2x_1+x_2}  
\end{bmatrix}$$
and show that it's positive definite, since $\det(H)=16e^{2x_1+x_2}+7>0$ and $4+4e^{2x_1+x_2}>0$,$ \forall{x_1,x_2} \implies f$ is strictly convex.
A: Hint: $-x_1 x_2$ is not convex, but you can combine it with the other quadratic terms.
A: Here is another way to proceed :
Let recall the following lemma :

Let $f:\Omega\subseteq\mathbb{R}^n\to \mathbb{R}$ a differentiable function on the open set $\Omega$ and let consider $U$ a convex set of $\Omega$. Then $f$ is convex on $U$ iff for all $x,y\in U, \ f(y)-f(x)\ge \mathrm{d}_xf.(y-x)$.

Here we will apply this statement with $U=\Omega=\mathbb{R}^2$ and $f$ defined by : $f(x_1,x_2)=2x_1^2 −x_1x_2 + x_2^2 −3x_1 + e^{2x_1+x_2}$.
Let $(h_1,h_2)\in \mathbb{R}^2$ and then determine :
$f(x_1+h_1,x_2+h_2)-f(x_1,x_2)=2(x_1+h_1)^2-(x_1+h_1)(x_2+h_2)+(x_2+h_2)^2-3(x_1+h_1)+e^{2(x_1+h_1)+x_2+h_2} - 2x_1^2 +x_1x_2 - x_2^2 +3x_1 - e^{2x_1+x_2}.$
Then : $f(x_1+h_1,x_2+h_2)-f(x_1,x_2)=2x_1^2+4x_1h_1+2h_1^2-x_1x_2-x_1h_2-x_2h_1-h_1h_2+x_2^2 +2x_2h_2+h_2^2-3x_1-3h_1 + e^{(2x_1+x_2)+(2h_1+h_2)} -2x_1^2 +x_1x_2 - x_2^2 +3x_1 - e^{2x_1+x_2}.$
So :
$f(x_1+h_1,x_2+h_2)-f(x_1,x_2)=(4x_1-x_2-3)h_1+(2x_2-x_1)h_2+ \underbrace{e^{(2x_1+x_2)+(2h_1+h_2)} - e^{2x_1+x_2}}_{\ge \ 2h_1e^{2x_1+x_2}+h_2e^{2x_1+x_2} \text{because of the convexity of} \ (x_1,x_2)\mapsto e^{2x_1+x_2} \ \text{and the lemma}} + \underbrace{2h_1^2+h_2^2-h_1h_2}_{\ge \ 0 \ \text{because of} \ a^2+b^2\ge ab} \ge (4x_1-x_2-3+e^{2x_1+x_2})h_1 + (2x_2-x_1+e^{2x_2+x_2})h_2= \mathrm{d}_{(x_1,x_2)}f.(h_1,h_2).$
Hence according to the lemma $f$ is a convex function on $\mathbb{R}^2$.
