Theorem (Cauchy-Schwarz inequality): For $\x, \y \in \real^d$,

\[\x \tp \y \le \norm{\x}_2\norm{\y}_2,\]

where equality holds only if $\x=a\y$ for some scalar $a$.

Proof: The Cauchy-Schwarz Master Class (2004), Steele JM. Cambridge University Press.

It is also common to encounter the Cauchy-Schwarz theorem in the following form (squaring both sides):

\[\left( \sum_i x_i y_i \right)^2 \le \sum_i x_i^2 \sum_i y_i^2.\]

If $\x$ and $\y$ contain both positive and negative values, it is worth noting that the Cauchy-Schwarz theorem also applies to $\x^\ast$ and $\y^\ast$, where the elements of $\x^\ast$ are the absolute value of the elements of $\x$ and so on for $\y^\ast$. This results in yet another form of the Cauchy-Schwarz theorem:

\[\sum_i \abs{x_i y_i} \le \norm{\x}_2 \norm{\y}_2,\]

or

\[\tfrac{1}{n} \sum_i \abs{x_i y_i} \le \sqrt{\tfrac{1}{n}\sum_i x_i^2} \sqrt{\tfrac{1}{n}\sum_i y_i^2}.\]