Prove that $\Vert\cdot \Vert^2:X\to \Bbb{R},$ where $X$ is a vector space, is convex

Just solved and thought to share it for the sake of future readers. \begin{align} \Vert \lambda x+(1-\lambda)y \Vert^2 &\leq \left( \lambda \Vert x\Vert+(1-\lambda)\Vert y \Vert\right)^2\\ &\leq \lambda^2 \Vert x\Vert^2+2\lambda(1-\lambda)\Vert x\Vert\Vert y\Vert+ (1-\lambda)^2\Vert y\Vert^2\\ &= \lambda^2 \Vert x\Vert^2+2\lambda(1-\lambda)\Vert x\Vert\Vert y\Vert+ (1-\lambda)^2\Vert y\Vert^2 -\lambda\Vert x\Vert^2 -(1-\lambda)\Vert y\Vert^2\\&\quad+\lambda\Vert x\Vert^2 +(1-\lambda)\Vert y\Vert^2,\;\;\text{adding and substracting}\;\lambda\Vert x\Vert^2 +(1-\lambda)\Vert y\Vert^2 \\ &= -\lambda (1-\lambda)\left(\Vert x\Vert-\Vert y\Vert\right)^2+\lambda\Vert x\Vert^2 +(1-\lambda)\Vert y\Vert^2\\ &\leq \lambda\Vert x\Vert^2 +(1-\lambda)\Vert y\Vert^2,\;\;\text{since}\;-\lambda (1-\lambda)\left(\Vert x\Vert-\Vert y\Vert\right)^2\leq 0.\end{align} Hence, $\Vert\cdot\Vert^2$ is a convex function.


In general if $f$ is a convex function and $g$ is a convex nondecreasing function then the composition $g \circ f$ is a convex function. Let $f(\cdot)=\|\cdot \|$ which maps to $\mathbb{R}_{\geq 0}$ and let $g(x)=x^2$ which is a nondecreasing convex function on $\mathbb{R}_{\geq 0}$. If follows that $g \circ f (\cdot)=\| \cdot \|^2$ is a convex function.

See The composition of two convex functions is convex for the original claim.