Cauchy–Schwarz inequality

The Cauchy–Schwarz inequality (also called Cauchy–Bunyakovsky–Schwarz inequality) is an upper bound on the inner product between two vectors in an inner product space in terms of the product of the vector norms. It is considered one of the most important and widely used inequalities in mathematics.

The inequality for sums was published by. The corresponding inequality for integrals was published by and. Schwarz gave the modern proof of the integral version.

Statement of the inequality
The Cauchy–Schwarz inequality states that for all vectors $$\mathbf{u}$$ and $$\mathbf{v}$$ of an inner product space

where $$\langle \cdot, \cdot \rangle$$ is the inner product. Examples of inner products include the real and complex dot product; see the examples in inner product. Every inner product gives rise to a Euclidean $$l_2$$ norm, called the or , where the norm of a vector $$\mathbf{u}$$ is denoted and defined by $$\|\mathbf{u}\| := \sqrt{\langle \mathbf{u}, \mathbf{u} \rangle},$$ where $$\langle \mathbf{u}, \mathbf{u} \rangle$$ is always a non-negative real number (even if the inner product is complex-valued). By taking the square root of both sides of the above inequality, the Cauchy–Schwarz inequality can be written in its more familiar form in terms of the norm:

Moreover, the two sides are equal if and only if $$\mathbf{u}$$ and $$\mathbf{v}$$ are linearly dependent.

Sedrakyan's lemma - Positive real numbers
Sedrakyan's inequality, also known as Bergström's inequality, Engel's form, Titu's lemma (or the T2 lemma), states that for real numbers $$u_1, u_2, \dots, u_n$$ and positive real numbers $$v_1, v_2, \dots, v_n$$: $$\frac{\left(\displaystyle\sum_{i=1}^n u_i\right)^2 }{\displaystyle\sum_{i=1}^n v_i} \leq \sum_{i=1}^n \frac{u_i^2}{v_i} \quad \text{ or equivalently, } \quad \frac{\left(u_1 + u_2 + \cdots + u_n\right)^2}{v_1 + v_2 + \cdots + v_n} \leq \frac{u^2_1}{v_1} + \frac{u^2_2}{v_2} + \cdots + \frac{u^2_n}{v_n} .$$

It is a direct consequence of the Cauchy–Schwarz inequality, obtained by using the dot product on $$\R^n$$ upon substituting $$u_i' = \frac{u_i}{\sqrt{v_i}}$$ and $$v_i' = \sqrt{v_i}$$. This form is especially helpful when the inequality involves fractions where the numerator is a perfect square.

$R^{2}$ - The plane
The real vector space $$\R^2$$ denotes the 2-dimensional plane. It is also the 2-dimensional Euclidean space where the inner product is the dot product. If $$\mathbf{u} = \left(u_1, u_2\right)$$ and $$\mathbf{v} = \left(v_1, v_2\right)$$ then the Cauchy–Schwarz inequality becomes: $$\langle \mathbf{u}, \mathbf{v} \rangle^2 = (\|\mathbf{u}\| \|\mathbf{v}\| \cos \theta)^2 \leq \|\mathbf{u}\|^2 \|\mathbf{v}\|^2,$$ where $$\theta$$ is the angle between $$\mathbf{u}$$ and $$\mathbf{v}$$.

The form above is perhaps the easiest in which to understand the inequality, since the square of the cosine can be at most 1, which occurs when the vectors are in the same or opposite directions. It can also be restated in terms of the vector coordinates $$u_1$$, $$u_2$$, $$v_1$$, and $$v_2$$ as $$\left(u_1 v_1 + u_2 v_2\right)^2 \leq \left(u_1^2 + u_2^2\right) \left(v_1^2 + v_2^2\right),$$ where equality holds if and only if the vector $$\left(u_1, u_2\right)$$ is in the same or opposite direction as the vector $$\left(v_1, v_2\right)$$, or if one of them is the zero vector.

$R^{n}$: n-dimensional Euclidean space
In Euclidean space $$\R^n$$ with the standard inner product, which is the dot product, the Cauchy–Schwarz inequality becomes: $$\left(\sum_{i=1}^n u_i v_i\right)^2 \leq \left(\sum_{i=1}^n u_i^2\right) \left(\sum_{i=1}^n v_i^2\right).$$

The Cauchy–Schwarz inequality can be proved using only elementary algebra in this case by observing that the difference of the right and the left hand side is $$ \frac{1}{2} \sum_{i,j=1,\ldots,n} (u_i v_j - u_j v_i)^2 \ge 0$$

or by considering the following quadratic polynomial in $$x$$ $$ \left(u_1 x + v_1\right)^2 + \cdots + \left(u_n x + v_n\right)^2 = \left(\sum_i u_i^2\right) x^2 + 2 \left(\sum_i u_i v_i\right) x + \sum_i v_i^2.$$

Since the latter polynomial is nonnegative, it has at most one real root, hence its discriminant is less than or equal to zero. That is, $$\left(\sum_i u_i v_i\right)^2 - \left(\sum_i {u_i^2}\right) \left(\sum_i {v_i^2}\right) \leq 0.$$

$C^{n}$: n-dimensional Complex space
If $$\mathbf{u}, \mathbf{v} \in \Complex^n$$ with $$\mathbf{u} = \left(u_1, \ldots, u_n\right)$$ and $$\mathbf{v} = \left(v_1, \ldots, v_n\right)$$ (where $$u_1, \ldots, u_n \in \Complex$$ and $$v_1, \ldots, v_n \in \Complex$$) and if the inner product on the vector space $$\Complex^n$$ is the canonical complex inner product (defined by $$\langle \mathbf{u}, \mathbf{v} \rangle := u_1 \overline{v_1} + \cdots + u_{n} \overline{v_n},$$ where the bar notation is used for complex conjugation), then the inequality may be restated more explicitly as follows: $$|\langle \mathbf{u}, \mathbf{v} \rangle|^2 = \left|\sum_{k=1}^n u_k\bar{v}_k\right|^2 \leq \langle \mathbf{u}, \mathbf{u} \rangle \langle \mathbf{v}, \mathbf{v} \rangle = \left(\sum_{k=1}^n u_k \bar{u}_k\right) \left(\sum_{k=1}^n v_k \bar{v}_k\right) = \sum_{j=1}^n \left|u_j\right|^2 \sum_{k=1}^n \left|v_k\right|^2.$$

That is, $$\left|u_1 \bar{v}_1 + \cdots + u_n \bar{v}_n\right|^2 \leq \left(\left|u_1\right|^2 + \cdots + \left|u_n\right|^2\right) \left(\left|v_1\right|^2 + \cdots + \left|v_n\right|^2\right).$$

$L^{2}$
For the inner product space of square-integrable complex-valued functions, the following inequality: $$\left|\int_{\R^n} f(x) \overline{g(x)}\,dx\right|^2 \leq  \int_{\R^n} |f(x)|^2\,dx \int_{\R^n} |g(x)|^2 \,dx.$$

The Hölder inequality is a generalization of this.

Analysis
In any inner product space, the triangle inequality is a consequence of the Cauchy–Schwarz inequality, as is now shown: $$\begin{alignat}{4} \|\mathbf{u} + \mathbf{v}\|^2 &= \langle \mathbf{u} + \mathbf{v}, \mathbf{u} + \mathbf{v} \rangle && \\ &= \|\mathbf{u}\|^2 + \langle \mathbf{u}, \mathbf{v} \rangle + \langle \mathbf{v}, \mathbf{u} \rangle + \|\mathbf{v}\|^2 ~ && ~ \text{ where } \langle \mathbf{v}, \mathbf{u} \rangle = \overline{\langle \mathbf{u}, \mathbf{v} \rangle} \\ &= \|\mathbf{u}\|^2 + 2 \operatorname{Re} \langle \mathbf{u}, \mathbf{v} \rangle + \|\mathbf{v}\|^2 && \\ &\leq \|\mathbf{u}\|^2 + 2|\langle \mathbf{u}, \mathbf{v} \rangle| + \|\mathbf{v}\|^2 && \\ &\leq \|\mathbf{u}\|^2 + 2\|\mathbf{u}\|\|\mathbf{v}\| + \|\mathbf{v}\|^2 ~ && ~ \text{ using CS}\\ &=(\|\mathbf{u}\| + \|\mathbf{v}\|)^2. && \end{alignat}$$

Taking square roots gives the triangle inequality: $$\|\mathbf{u} + \mathbf{v}\| \leq \|\mathbf{u}\| + \|\mathbf{v}\|.$$

The Cauchy–Schwarz inequality is used to prove that the inner product is a continuous function with respect to the topology induced by the inner product itself.

Geometry
The Cauchy–Schwarz inequality allows one to extend the notion of "angle between two vectors" to any real inner-product space by defining: $$\cos\theta_{\mathbf{u} \mathbf{v}} = \frac{\langle \mathbf{u}, \mathbf{v} \rangle}{\|\mathbf{u}\| \|\mathbf{v}\|}.$$

The Cauchy–Schwarz inequality proves that this definition is sensible, by showing that the right-hand side lies in the interval $[&minus;1, 1]$ and justifies the notion that (real) Hilbert spaces are simply generalizations of the Euclidean space. It can also be used to define an angle in complex inner-product spaces, by taking the absolute value or the real part of the right-hand side, as is done when extracting a metric from quantum fidelity.

Probability theory
Let $$X$$ and $$Y$$ be random variables. Then the covariance inequality is given by: $$\operatorname{Var}(X) \geq \frac{\operatorname{Cov}(X, Y)^2}{\operatorname{Var}(Y)}.$$

After defining an inner product on the set of random variables using the expectation of their product, $$\langle X, Y \rangle := \operatorname{E}(X Y),$$ the Cauchy–Schwarz inequality becomes $$|\operatorname{E}(XY)|^2 \leq \operatorname{E}(X^2) \operatorname{E}(Y^2).$$

To prove the covariance inequality using the Cauchy–Schwarz inequality, let $$\mu = \operatorname{E}(X)$$ and $$\nu = \operatorname{E}(Y),$$ then $$\begin{align} &= |\operatorname{E}((X - \mu)(Y - \nu))|^2 \\ &= |\langle X - \mu, Y - \nu \rangle |^2\\ &\leq \langle X - \mu, X - \mu \rangle \langle Y - \nu, Y - \nu \rangle \\ & = \operatorname{E}\left((X - \mu)^2\right) \operatorname{E}\left((Y - \nu)^2\right) \\ & = \operatorname{Var}(X) \operatorname{Var}(Y), \end{align}$$ where $$\operatorname{Var}$$ denotes variance and $$\operatorname{Cov}$$ denotes covariance.
 * \operatorname{Cov}(X, Y)|^2

Proofs
There are many different proofs of the Cauchy–Schwarz inequality other than those given below. When consulting other sources, there are often two sources of confusion. First, some authors define $⟨⋅,⋅⟩$ to be linear in the second argument rather than the first. Second, some proofs are only valid when the field is $$\mathbb R$$ and not $$\mathbb C.$$

This section gives two proofs of the following theorem:

$$

In both of the proofs given below, the proof in the trivial case where at least one of the vectors is zero (or equivalently, in the case where $$\|\mathbf{u}\|\|\mathbf{v}\|= 0$$) is the same. It is presented immediately below only once to reduce repetition. It also includes the easy part of the proof of the Equality Characterization given above; that is, it proves that if $$\mathbf{u}$$ and $$\mathbf{v}$$ are linearly dependent then $$\left|\langle \mathbf{u}, \mathbf{v} \rangle\right| = \|\mathbf{u}\| \|\mathbf{v}\|.$$

By definition, $$\mathbf{u}$$ and $$\mathbf{v}$$ are linearly dependent if and only if one is a scalar multiple of the other. If $$\mathbf{u} = c \mathbf{v}$$ where $$c$$ is some scalar then $$|\langle \mathbf{u}, \mathbf{v} \rangle| = |\langle c \mathbf{v}, \mathbf{v} \rangle| = |c \langle \mathbf{v}, \mathbf{v} \rangle| = |c|\|\mathbf{v}\| \|\mathbf{v}\| =\|c \mathbf{v}\| \|\mathbf{v}\| =\|\mathbf{u}\| \|\mathbf{v}\|$$

which shows that equality holds in the $$. The case where $$\mathbf{v} = c \mathbf{u}$$ for some scalar $$c$$ follows from the previous case: $$|\langle \mathbf{u}, \mathbf{v} \rangle| = |\langle \mathbf{v}, \mathbf{u} \rangle| =\|\mathbf{v}\| \|\mathbf{u}\|.$$

In particular, if at least one of $$\mathbf{u}$$ and $$\mathbf{v}$$ is the zero vector then $$\mathbf{u}$$ and $$\mathbf{v}$$ are necessarily linearly dependent (for example, if $$\mathbf{u} = \mathbf{0}$$ then $$\mathbf{u} = c \mathbf{v}$$ where $$c = 0$$), so the above computation shows that the Cauchy-Schwarz inequality holds in this case.

Consequently, the Cauchy–Schwarz inequality only needs to be proven only for non-zero vectors and also only the non-trivial direction of the Equality Characterization must be shown.

Proof via the Pythagorean theorem
The special case of $$\mathbf{v} = \mathbf{0}$$ was proven above so it is henceforth assumed that $$\mathbf{v} \neq \mathbf{0}.$$ Let $$\mathbf{z} := \mathbf{u} - \frac {\langle \mathbf{u}, \mathbf{v} \rangle} {\langle \mathbf{v}, \mathbf{v} \rangle} \mathbf{v}.$$

It follows from the linearity of the inner product in its first argument that: $$\langle \mathbf{z}, \mathbf{v} \rangle = \left\langle \mathbf{u} - \frac{\langle \mathbf{u}, \mathbf{v} \rangle} {\langle \mathbf{v}, \mathbf{v} \rangle} \mathbf{v}, \mathbf{v} \right\rangle = \langle \mathbf{u}, \mathbf{v} \rangle - \frac{\langle \mathbf{u}, \mathbf{v} \rangle} {\langle \mathbf{v}, \mathbf{v} \rangle} \langle \mathbf{v}, \mathbf{v} \rangle = 0.$$

Therefore, $$\mathbf{z}$$ is a vector orthogonal to the vector $$\mathbf{v}$$ (Indeed, $$\mathbf{z}$$ is the projection of $$\mathbf{u}$$ onto the plane orthogonal to $$\mathbf{v}.$$) We can thus apply the Pythagorean theorem to $$\mathbf{u}= \frac{\langle \mathbf{u}, \mathbf{v} \rangle} {\langle \mathbf{v}, \mathbf{v} \rangle} \mathbf{v} + \mathbf{z}$$ which gives $$\|\mathbf{u}\|^2 = \left|\frac{\langle \mathbf{u}, \mathbf{v} \rangle}{\langle \mathbf{v}, \mathbf{v} \rangle}\right|^2 \|\mathbf{v}\|^2 + \|\mathbf{z}\|^2 = \frac{|\langle \mathbf{u}, \mathbf{v} \rangle|^2}{(\|\mathbf{v}\|^2 )^2} \,\|\mathbf{v}\|^2 + \|\mathbf{z}\|^2 = \frac{|\langle \mathbf{u}, \mathbf{v} \rangle|^2}{\|\mathbf{v}\|^2} + \|\mathbf{z}\|^2 \geq \frac{|\langle \mathbf{u}, \mathbf{v} \rangle|^2}{\|\mathbf{v}\|^2}.$$

The Cauchy–Schwarz inequality follows by multiplying by $$\|\mathbf{v}\|^2$$ and then taking the square root. Moreover, if the relation $$\geq$$ in the above expression is actually an equality, then $$\|\mathbf{z}\|^2 = 0$$ and hence $$\mathbf{z} = \mathbf{0};$$ the definition of $$\mathbf{z}$$ then establishes a relation of linear dependence between $$\mathbf{u}$$ and $$\mathbf{v}.$$ The converse was proved at the beginning of this section, so the proof is complete. $$\blacksquare$$

Proof by analyzing a quadratic
Consider an arbitrary pair of vectors $$\mathbf{u}, \mathbf{v}$$. Define the function $$p : \R \to \R$$ defined by $$p(t) = \langle t\alpha\mathbf{u} + \mathbf{v}, t\alpha\mathbf{u} + \mathbf{v}\rangle$$, where $$\alpha$$ is a complex number satisfying $$|\alpha| = 1$$ and $$\alpha\langle\mathbf{u}, \mathbf{v}\rangle = |\langle\mathbf{u}, \mathbf{v}\rangle|$$. Such an $$\alpha$$ exists since if $$\langle\mathbf{u}, \mathbf{v}\rangle = 0$$ then $$\alpha$$ can be taken to be 1.

Since the inner product is positive-definite, $$p(t)$$ only takes non-negative real values. On the other hand, $$p(t)$$ can be expanded using the bilinearity of the inner product: $$\begin{align} p(t) &= \langle t\alpha\mathbf{u}, t\alpha\mathbf{u}\rangle + \langle t\alpha\mathbf{u}, \mathbf{v}\rangle + \langle\mathbf{v}, t\alpha\mathbf{u}\rangle + \langle\mathbf{v}, \mathbf{v}\rangle \\ &= t\alpha t\overline{\alpha}\langle\mathbf{u}, \mathbf{u}\rangle + t\alpha\langle\mathbf{u}, \mathbf{v}\rangle + t\overline{\alpha}\langle \mathbf{v}, \mathbf{u}\rangle + \langle\mathbf{v}, \mathbf{v}\rangle \\ &= \lVert \mathbf{u} \rVert^2 t^2 + 2|\langle\mathbf{u}, \mathbf{v}\rangle|t + \lVert \mathbf{v} \rVert^2 \end{align}$$ Thus, $$p$$ is a polynomial of degree $$2$$ (unless $$\mathbf{u} = 0,$$ which is a case that was checked earlier). Since the sign of $$p$$ does not change, the discriminant of this polynomial must be non-positive: $$\Delta = 4 \left(|\langle \mathbf{u}, \mathbf{v} \rangle|^2 - \Vert \mathbf{u} \Vert^2 \Vert \mathbf{v} \Vert^2\right) \leqslant 0.$$ The conclusion follows.

For the equality case, notice that $$\Delta = 0$$ happens if and only if $$p(t) = (t\Vert \mathbf{u} \Vert + \Vert \mathbf{v} \Vert)^2.$$ If $$t_0 = -\Vert \mathbf{v} \Vert / \Vert \mathbf{u} \Vert,$$ then $$p(t_0) = \langle t_0\alpha\mathbf{u} + \mathbf{v},t_0\alpha\mathbf{u} + \mathbf{v}\rangle = 0,$$ and hence $$\mathbf{v} = -t_0\alpha\mathbf{u}.$$

Generalizations
Various generalizations of the Cauchy–Schwarz inequality exist. Hölder's inequality generalizes it to $$L^p$$ norms. More generally, it can be interpreted as a special case of the definition of the norm of a linear operator on a Banach space (Namely, when the space is a Hilbert space). Further generalizations are in the context of operator theory, e.g. for operator-convex functions and operator algebras, where the domain and/or range are replaced by a C*-algebra or W*-algebra.

An inner product can be used to define a positive linear functional. For example, given a Hilbert space $$L^2(m), m$$ being a finite measure, the standard inner product gives rise to a positive functional $$\varphi$$ by $$\varphi (g) = \langle g, 1 \rangle.$$ Conversely, every positive linear functional $$\varphi$$ on $$L^2(m)$$ can be used to define an  inner product $$\langle f, g \rangle _\varphi := \varphi\left(g^* f\right),$$ where $$g^*$$ is the pointwise complex conjugate of $$g.$$ In this language, the Cauchy–Schwarz inequality becomes $$\left|\varphi\left(g^* f\right)\right|^2 \leq \varphi\left(f^* f\right) \varphi\left(g^* g\right),$$

which extends verbatim to positive functionals on C*-algebras:

$$

The next two theorems are further examples in operator algebra.

$$

This extends the fact $$\varphi\left(a^*a\right) \cdot 1 \geq \varphi(a)^* \varphi(a) = |\varphi(a)|^2,$$ when $$\varphi$$ is a linear functional. The case when $$a$$ is self-adjoint, that is, $$a = a^*,$$ is sometimes known as Kadison's inequality.

$$

Another generalization is a refinement obtained by interpolating between both sides of the Cauchy–Schwarz inequality:

$$

This theorem can be deduced from Hölder's inequality. There are also non-commutative versions for operators and tensor products of matrices.

Several matrix versions of the Cauchy–Schwarz inequality and Kantorovich inequality are applied to linear regression models.