<s>[INST] Show convexity of a function via inequalities I am stuck with deriving the convexity of the function 
$$
f(x) = \sqrt{1 + x^2}
$$ 
from first principles, that is I would like to show that for any $x,y \in \mathbb R$ and $\lambda \in (0,1)$ we have
$$
f(\lambda x + (1 - \lambda)y) \le \lambda f(x) + (1 - \lambda) f(y)
$$
The fact that it is a convex function is easy to see from the second derivative test so I am ok with the statement, its just that I cannot derive it using basic inequalities! 
Here is what I tried so far:
Attempt 1 
Use the convexity of the squaring function to write
\begin{align*}
\sqrt{1 + (\lambda x + (1 - \lambda)y)^2} &\le \sqrt{1 + \lambda x^2 + (1 - \lambda)y^2} \\
&= \sqrt{\lambda (1 + x^2) + (1 - \lambda)(1 + y^2)}
\end{align*}
Now use the fact that
$$
\sqrt{A + B} \le \sqrt{A} + \sqrt{B}
$$
to bound the the last expression by
\begin{align*}
\sqrt{\lambda (1 + x^2) + (1 - \lambda)(1 + y^2)} &\le \sqrt{\lambda (1 + x^2)} + \sqrt{(1 - \lambda)(1 + y^2)}
\end{align*}
but now I'm stuck because I cannot take out the factors and bound it above as both $\lambda$ and $1 - \lambda$ are less than $1$ .. :(
Attempt 2:
Don't use the convexity of the squaring function, instead expand. Then
\begin{align*}
\sqrt{1 + (\lambda x + (1 - \lambda)y)^2} &= \sqrt{1 + \lambda^2x^2 + 2\lambda(1 - \lambda)xy + (1 - \lambda)^2y^2} \\
&\le \sqrt{1 + 2\lambda^2x^2 + 2(1 - \lambda)^2y^2}
\end{align*}
so now I need to find a way to show that
$$
1 + \lambda^2x^2 + (1 - \lambda)^2y^2 \le \lambda^2 + (1 - \lambda)^2
$$
but somehow I am too blind / tired to find the right argument .. :(
Thanks for hints!
 [/INST] To make the two sides of the inequalities easier to compare, put $a:=\lambda$ and $b:=(1-\lambda)$ and then square both sides (a valid operation since both sides are nonnegative and therefore $x\mapsto x^{2}$ is invertible and monotonic, thus inequality preserving).
After doing this, we have on the one hand
$$\begin{align*}
[f(ax+by)]^{2}
&=1+(ax+by)^{2}\\
&=1+a^{2}x^{2}+2abxy+b^{2}y^{2}\\
&=a^2+2ab+b^2+a^2x^2+2abxy+b^2y^2&\text{($a^{2}+2ab+b^{2}=(a+b)^{2}=1$})\\
&=a^2(1+x^2)+b^2(1+y^2)+2ab(1+xy),
\end{align*}$$
and on the other
$$\begin{align*}
[af(x)+bf(y)]^{2}
&=a^{2}f^{2}(x)+b^{2}f^{2}(y)+2abf(x)f(y)\\
&=a^{2}(1+x^{2})+b^{2}(1+y)^{2}+2ab\sqrt{1+x^{2}}\sqrt{1+y^{2}}\\
&=a^{2}(1+x^{2})+b^{2}(1+y)^{2}+2ab\sqrt{1+x^{2}+y^{2}+x^{2}y^{2}}\\
\end{align*}$$
We now see that to bridge this chain, we only need to verify that
$$2ab(1+xy)\leq2ab\sqrt{1+x^{2}+y^{2}+x^{2}y^{2}},$$
or (after dividing both sides by $2ab>0$ [note that we are done if $2ab=0$])
$$1+xy\leq\sqrt{1+x^{2}+y^{2}+x^{2}y^{2}},$$
or (after squaring both sides assuming $1+xy\geq0$ [note that we are done if $1+xy<0$])
$$1+2xy+x^{2}y^{2}\leq 1+x^{2}+y^{2}+x^{2}y^{2},$$
or (after subtracting $1+x^{2}y^{2}$ from both sides)
$$2xy\leq x^{2}+y^{2},$$
which is true since $0\leq(\alpha+\beta)^{2}=\alpha^{2}+2\alpha\beta+\beta^{2}$ is of course valid for any $\alpha,\beta\in\mathbb{R}$.
</s>