# Cauchy-Schwarz inequality

In mathematics, the Cauchy-Schwarz inequality is a fundamental and ubiquitously used inequality that relates the absolute value of the inner product of two elements of an inner product space with the magnitude of the two said vectors. It is named in the honor of the French mathematician Augustin-Louis Cauchy and German mathematician Hermann Amandus Schwarz.

## The inequality for real numbers

The simplest form of the inequality, and the first one considered historically, states that

$( x_1 y_1 + x_2 y_2 + \cdots + x_n y_n )^2 \le ( x_1^2 + x_2^2 + \cdots + x_n^2 ) ( y_1^2 + y_2^2 + \cdots + y_n^2 )$

for all real numbers x1, …, xn, y1, …, yn (where n is a arbitrary positive integer). Furthermore, the inequality is in fact an equality

$( x_1 y_1 + x_2 y_2 + \cdots + x_n y_n )^2 = ( x_1^2 + x_2^2 + \cdots + x_n^2 ) ( y_1^2 + y_2^2 + \cdots + y_n^2 )$

if and only if there is a number C such that xi = Cyi for all i.

## The inequality for inner product spaces

Let V be a complex inner product space with inner product $\langle \cdot,\cdot \rangle$. Then for any two elements $x,y \in V$ it holds that

$|\langle x,y \rangle|\leq \|x\|\|y\|,\quad (1)$

where $\|a\|=\langle a,a \rangle^{1/2}$ for all $a \in V$. Furthermore, the equality in (1) holds if and only if the vectors x and y are linearly dependent (in this case proportional one to the other).

If V is the Euclidean space Rn, whose inner product is defined by

$\langle x,y \rangle = \sum_{i=1}^n x_i y_i,$

then (1) yields the inequality for real numbers mentioned in the previous section.

Another important example is where V is the space L2([a, b]). In this case, the Cauchy-Schwarz inequality states that

$\left( \int_a^b f(x) g(x) \,\mathrm{d}x \right)^2 \le \int_a^b \big( f(x) \big)^2 \,\mathrm{d}x \cdot \int_a^b \big( g(x) \big)^2 \,\mathrm{d}x$

for all real functions f and g in $\scriptstyle L^2([a,b])$.

## Proof of the inequality

A standard yet clever idea for a proof of the Cauchy-Schwarz inequality for inner product spaces is to exploit the fact that the inner product induces a quadratic form on V. Let x,y be some fixed pair of vectors in V and let $\phi(x,y)$ be the argument of the complex number $\langle x,y\rangle$. Now, consider the expression $f(t)=\langle x+t e^{i\phi(x,y)} y, x+te^{i\phi(x,y)} y\rangle$ for any real number t and notice that, by the properties of a complex inner product, f is a quadratic function of t. Moreover, f is non-negative definite: $f(t)\geq 0$ for all t. Expanding the expression for f gives the following:

\begin{align} f(t) &= \langle x+te^{i\phi(x,y)} y,x+te^{i\phi(x,y)} y\rangle \\ &= \|x\|^2 + t e^{i\phi(x,y)}\langle y,x \rangle + t e^{-i\phi(x,y)}\langle x,y \rangle + t^2\|y\|^2 \\ &= \|x\|^2 + 2t |\langle x,y \rangle|+ t^2\|y\|^2. \end{align}

Since f is a non-negative definite quadratic function of t, it follows that the discriminant of f is non-positive definite. That is,

$4|\langle x,y \rangle|^2-4 \|x\|^2\|y\|^2=4\Big(|\langle x,y \rangle|^2- \|x\|^2\|y\|^2\Big) \leq 0,$

from which (1) follows immediately.

## Application in ℝ3

For vectors r1 and r2 in ℝ3 it holds that

$(\mathbf{r}_1\cdot \mathbf{r}_2)^2 = (r_1 r_2 \cos\theta)^2 \le (\mathbf{r}_1\cdot \mathbf{r}_1)\;\; (\mathbf{r}_2\cdot \mathbf{r}_2) = r_1^2 r_2^2,$

where r1 = ||r1|| and r2 = ||r2|| are the lengths of the two vectors; θ is the angle between them. Taking square roots of

$(r_1 r_2 \cos\theta)^2 \le r_1^2 r_2^2$

gives

$- r_1 r_2 \le r_1 r_2 \cos\theta \le r_1 r_2.$

Hence the Cauchy-Schwarz inequality in ℝ3 is equivalent to stating that −1 ≤ cos θ ≤ 1. The equalities follow when θ = 0 and θ = π, for which cosθ = 1 and cosθ = −1, respectively. Hence, equality holds only for the case that the two vectors are parallel (θ = 0) or antiparallel (θ = π).