How to check whether a complex multivariable function is convex? 
Given a convex function $f : \mathbb R^2 \to \mathbb R$ and real numbers $a$ and $b$, I want to check whether the following function $g : \mathbb R^2 \to \mathbb R$ is convex.


First, I think I should use the lemma below:



So I start to write down g(αx1 + (1-α)y1 , αx2+(1-α)y2)
what I get is like this:

Then I get stuck, the function I get is just too complex and I don't know how to do next. Did I do it in the wrong way? Can anyone give me some hints?
 A: Hints:


*

*Sum of convex functions are convex.

*Non-negative multiple of a convex function is convex.

*Composition of a convex function and an affine function is convex.

*Maximum of convex functions is convex.

A: $$
g(x,y)=a(x,y)+b(x,y)+c(x,y)
$$
where 
$$
a(x,y)= 5(x^2+y^2+xy)=\frac{5x^2}{4}+5 \left(\frac{x}{4}+y \right)^2=a_1(x,y)+a_2(x,y)\\
b(x,y)=f(x-y,ax+by)=f(A(x,y)) \textrm { where } A=\left(\begin{matrix}1 &-1\\ a &b \end{matrix} \right) \\
c(x,y)=\max\{|x-y|,2y-x\}=\max\{c_1(x,y),c_2(x,y)\}
$$
we have $a_1$ is convex ($x^p$ is convex if $p\geq 1$), and $a_2$ is a composite of convex ($x \mapsto x^2$) and linear function ($x\mapsto x/4+y$), so convex :

if $f$ is convex and $g$ is affine then $f \circ g$ is convex :
  \begin{eqnarray*}
f(g(\alpha x+ (1-\alpha)y))&=& f(\alpha g(x)+ (1-\alpha)g(y))\\
&\leq & \alpha f(g(x))+(1-\alpha)f(g(y))
\end{eqnarray*} 

so $a$ is convex.
The same argument works for $b$, so $b$ is convex too.
Finally, the maximum of two convex function is also convex, which proves that $c$ is convex.
We conclude that $g$ is convex. 
