# Showing that a given function is convex.

I am trying to show that the function

$f(x,\vec{y})=\alpha\ln(1+\exp(x+\vec{y}\cdot \vec{z}))+(1-\alpha)\ln(1+\exp(-x-\vec{y}\cdot\vec{z}))$

is a convex function of $(x,\vec{y})$ (where $x\in\mathbb{R}$,$\vec{y}\in\mathbb{R}^n$, $\alpha\in\{0,1\}$, and $\vec{z}$ is a pre-defined vector in $\mathbb{R}^n$).

I know that it's possible to show that a function of multiple variables is convex if its Hessian matrix is positive semi-definite, but that method seems to be very calculation-intensive, so I was wondering if there is a simpler method that I have overlooked.

I know this would be trivial if the natural log function was convex (as the composition of convex functions is convex, as is the sum of convex functions).

• Prove that $f_1(x)=\log(1+\exp(x))$ is a convex function of $x$.
• Note that $f_2(x,y)=\alpha f_1(x) + (1-\alpha) f_2(y)$ is a convex function of $x,y$ for fixed $\alpha\in(0,1)$. The product of a convex function and a positive constant is convex, and the sum of convex functions is convex.
• Note that $f(x,\vec{y})=f_2(x+\vec{y}\cdot\vec{z},-x-\vec{y}\cdot\vec{z})$, the composition of a convex outer function and affine inner functions of $(x,\vec{y})$. Such a convex-affine composition is always convex.