Reading guide · Proof index

Metric spaces

Jiří Lebl, Basic Analysis I–II, version 6.3. Free author edition of this section. Selection and attribution · Notation.

L7.1.4: Real finite-dimensional Cauchy–Schwarz by sum of squares

Proof.

A square of a real number is nonnegative. Hence, a sum of squares is nonnegative:
0≤∑k=1n∑ℓ=1n(xkyℓ−xℓyk)2=∑k=1n∑ℓ=1n(xk2yℓ2+xℓ2yk2−2xkxℓykyℓ)=(∑k=1nxk2)(∑ℓ=1nyℓ2)+(∑k=1nyk2)(∑ℓ=1nxℓ2)−2(∑k=1nxkyk)(∑ℓ=1nxℓyℓ).\begin{equation*} \begin{split} 0 & \leq \sum_{k=1}^n \sum_{\ell=1}^n {(x_k y_\ell - x_\ell y_k)}^2 \\ & = \sum_{k=1}^n \sum_{\ell=1}^n \bigl( x_k^2 y_\ell^2 + x_\ell^2 y_k^2 - 2 x_k x_\ell y_k y_\ell \bigr) \\ & = \biggl( \sum_{k=1}^n x_k^2 \biggr) \biggl( \sum_{\ell=1}^n y_\ell^2 \biggr) + \biggl( \sum_{k=1}^n y_k^2 \biggr) \biggl( \sum_{\ell=1}^n x_\ell^2 \biggr) - 2 \biggl( \sum_{k=1}^n x_k y_k \biggr) \biggl( \sum_{\ell=1}^n x_\ell y_\ell \biggr) . \end{split} \end{equation*}
We relabel and divide by 2 to obtain precisely what we wanted,
0≤(∑k=1nxk2)(∑k=1nyk2)−(∑k=1nxkyk)2.\begin{equation*} 0 \leq \biggl( \sum_{k=1}^n x_k^2 \biggr) \biggl( \sum_{k=1}^n y_k^2 \biggr) - {\biggl( \sum_{k=1}^n x_k y_k \biggr)}^2 . \qedhere \end{equation*}

L7.1.5: Euclidean distance satisfies triangle inequality; positivity and symmetry follow from its displayed sum of squares

Example 7.1.5.

Let us construct the standard metric for Rn.\R^n\text{.} Define
d(x,y)≔(x1−y1)2+(x2−y2)2+⋯+(xn−yn)2=∑k=1n(xk−yk)2.\begin{equation*} d(x,y) \coloneqq \sqrt{ {(x_1-y_1)}^2 + {(x_2-y_2)}^2 + \cdots + {(x_n-y_n)}^2 } = \sqrt{ \sum_{k=1}^n {(x_k-y_k)}^2 } . \end{equation*}
For n=1,n=1\text{,} the real line, this metric agrees with what we defined above. For n>1,n > 1\text{,} the only tricky part of the definition to check, as before, is the triangle inequality. It is less messy to work with the square of the metric. In the following estimate, note the use of the Cauchy–Schwarz inequality.
(d(x,z))2=∑k=1n(xk−zk)2=∑k=1n(xk−yk+yk−zk)2=∑k=1n((xk−yk)2+(yk−zk)2+2(xk−yk)(yk−zk))=∑k=1n(xk−yk)2+∑k=1n(yk−zk)2+2∑k=1n(xk−yk)(yk−zk)≤∑k=1n(xk−yk)2+∑k=1n(yk−zk)2+2∑k=1n(xk−yk)2∑k=1n(yk−zk)2=(∑k=1n(xk−yk)2+∑k=1n(yk−zk)2)2=(d(x,y)+d(y,z))2.\begin{equation*} \begin{split} {\bigl(d(x,z)\bigr)}^2 & = \sum_{k=1}^n {(x_k-z_k)}^2 \\ & = \sum_{k=1}^n {(x_k-y_k+y_k-z_k)}^2 \\ & = \sum_{k=1}^n \Bigl( {(x_k-y_k)}^2+{(y_k-z_k)}^2 + 2(x_k-y_k)(y_k-z_k) \Bigr) \\ & = \sum_{k=1}^n {(x_k-y_k)}^2 + \sum_{k=1}^n {(y_k-z_k)}^2 + 2 \sum_{k=1}^n (x_k-y_k)(y_k-z_k) \\ & \leq \sum_{k=1}^n {(x_k-y_k)}^2 + \sum_{k=1}^n {(y_k-z_k)}^2 + 2 \sqrt{ \sum_{k=1}^n {(x_k-y_k)}^2 \sum_{k=1}^n {(y_k-z_k)}^2 } \\ & = {\left( \sqrt{ \sum_{k=1}^n {(x_k-y_k)}^2 } + \sqrt{ \sum_{k=1}^n {(y_k-z_k)}^2 } \right)}^2 = {\bigl( d(x,y) + d(y,z) \bigr)}^2 . \end{split} \end{equation*}
Because the square root is an increasing function, the inequality is preserved when we take the square root of both sides, and we obtain the triangle inequality.