How to prove $\left(\sum_{i=1}^n x_i\right)^2 \le n\sum_{i=1}^n x_i^2$? For now I have the following
\begin{align*}
\left(\sum_{i=1}^n x_i\right)^2 & \le n\sum_{i=1}^n x_i^2 \\
\sum_{i=1}^n x_i^2 + 2\sum_{i<j}x_ix_j & \le n\sum_{i=1}^n x_i^2 \\
2\sum_{i<j}x_ix_j & \le (n-1)\sum_{i=1}^n x_i^2 \\
\end{align*}
Then I'm thinking about using Cauchy-Schwarz inequality. But I feel stuck.
 A: First let's recall the Cauchy - Schwarz inequality:
$$\left(\sum_{i=1}^n x_iy_{i}\right)^2 \le \sum_{i=1}^n (x_i)^2 \sum_{i=1}^n (y_{i})^2$$
Therefore by letting $y_{i} = 1$ for all $i$:
$$\left(\sum_{i=1}^n x_i \times 1\right)^2 \le \sum_{i=1}^n (x_i)^2 \sum_{i=1}^n (1)^2$$
$$\left(\sum_{i=1}^n x_i \right)^2 \le \sum_{i=1}^n (x_i)^2 \sum_{i=1}^n (1)$$
$$\left(\sum_{i=1}^n x_i \right)^2 \le \sum_{i=1}^n (x_i)^2 n$$
$$\left(\sum_{i=1}^n x_i \right)^2 \le n\sum_{i=1}^n (x_i)^2.$$
A: The Cauchy-Schwarz inequality tells you that
$$
\langle v,w\rangle^2\le\langle v,v\rangle\langle w,w\rangle
$$
If you take $v=(x_1,x_2,\dots,x_n)$, you just need to find $w$ such that
$$
\langle v,w\rangle=x_1+x_2+\dots+x_n
$$
and $\langle w,w\rangle=n$.
A: You can use $x_i^2+x_j^2\ge2x_ix_j$ (i.e. $(x_i-x_j)^2\ge0$) for all combinations $(i,j)$ with $j>i$ and sum the resulting inequalities. Every term $x_i^2$ occurs $(n-1)$ in the resulting sum.
For example, if n=3
$$x_1^2+x_2^2\ge 2x_1x_2 \\
x_1^2+x_3^2\ge 2x_1x_3 \\
x_2^2+x_3^2\ge 2x_2x_3
$$
