Show that the arithmetic mean is less or equal than the quadratic mean

By Cauchy–Schwarz inequality, $$\left(\frac{a_1}{n}1+\frac{a_2}{n}1+\cdots+\frac{a_n}{n}1\right)^2\le\left(\frac{a_1^2}{n^2}+\frac{a_2^2}{n^2}+\cdots+\frac{a_n^2}{n^2}\right)\left(1^2+1^2+\cdots+1^2\right)$$


The result is immediate if all the $a_i$ are zero, so we may assume that not all $a_i$ are zero. Further, by the triangle inequality, $\lvert\frac{a_1 + \cdots + a_n}{n}\rvert \le \frac{\lvert a_1\rvert + \cdots + \lvert a_n\rvert}{n}$. Therefore $\left(\frac{a_1 + \cdots + a_n}{n}\right)^2 \le \left(\frac{\lvert a_1\rvert + \cdots + \lvert a_n\rvert}{n}\right)^2$. So we may suppose additionally that all the $a_i$ are nonnegative.

Introduce a discrete random variable $X$ on the sample space $\{a_1,\ldots, a_n\}$ by letting $P(X = a_i) = a_i/n$ for $i = 1,2,\ldots n$. Then mean of $X$ is $\mu = (a_1 + \cdots + a_n)/n$, so the variance of $X$ is $$\operatorname{var}(X) = E(X^2) - \mu^2 = \left(\frac{a_1^2 + \cdots + a_n^2}{n}\right) - \left(\frac{a_1 + \cdots + a_n}{n}\right)^2$$ Since the variance is nonnegative, we deduce that $$\left(\frac{a_1 + \cdots + a_n}{n}\right)^2 \le \frac{a_1^2 + \cdots + a_n^2}{n}$$


Let $f(x) = x^2$. Since $f''(x) = 2 > 0$, $f$ is convex. Thus \begin{align*} f\left(\frac{x_1+x_2+\cdots + x_n}{n}\right) \leq \frac{f(x_1)+f(x_2)+\cdots+f(x_n)}{n} \end{align*} In fact, considering the function $f(x) = x^{p/q}$, where $p > q>0$, one can show that \begin{align*} \left(\frac{x_1^q+x_2^q+\cdots +x_n^q}{n}\right)^{1/q} \leq \left(\frac{x_1^p+x_2^p+\cdots +x_n^p}{n}\right)^{1/p} \end{align*}