Solution (source code)

= Solution

The <Cauchy-Schwarz inequality> in $\mathbb R^n$ is
$$
\boxed{|a\cdot b|\leq\|a\|\,\|b\|.}
$$
Here the <Euclidean norm> is induced by the <dot product>. If $b=0$, the result is immediate. If $b\ne0$, the squared <Euclidean norm> of the component of $a$ perpendicular to $b$ is nonnegative:
$$
0\leq\left\|a-\frac{a\cdot b}{\|b\|^2}b\right\|^2=\|a\|^2-\frac{(a\cdot b)^2}{\|b\|^2}.
$$
Rearrangement proves the <Cauchy-Schwarz inequality>. Equality holds precisely when $a$ and $b$ are linearly dependent, including the cases of a zero vector.

Expanding the squared <Euclidean norm> and using the <Cauchy-Schwarz inequality> gives
$$
\|a+b\|^2=\|a\|^2+2a\cdot b+\|b\|^2\leq(\|a\|+\|b\|)^2.
$$
Taking nonnegative square roots gives the <triangle inequality>. Applying the <triangle inequality> once more gives
$$
\boxed{\|a+b\|\leq\|a\|+\|b\|,\qquad\|a+b+c\|\leq\|a\|+\|b\|+\|c\|.}
$$