From Coordinates to Distance
A point in \(\mathbb{R}^n\) is an ordered list of \(n\) real coordinates. To measure the separation of two such points, subtract their coordinates and combine the resulting differences into one nonnegative number. The familiar formula in the plane extends directly to every finite dimension. Its triangle inequality is not a separate geometric assumption: it follows algebraically from the Cauchy–Schwarz inequality.
Throughout, \(n\in\mathbb{N}\), and \(\mathbb{R}^n\) is equipped with the Euclidean distance defined below. For \(x=(x_1,\dots,x_n)\) and \(y=(y_1,\dots,y_n)\), their dot product is the real number \(\langle x,y\rangle=\sum_{i=1}^n x_i y_i\). The usual norm is defined from this dot product.
Each coordinate difference is squared, so it contributes a nonnegative amount; taking the nonnegative square root then gives a nonnegative distance. In \(\mathbb{R}^2\), this is the familiar square-root-of-the-sum-of-squares formula. The same rule applies without change in \(\mathbb{R}^3\) and in every higher finite dimension. To show that this formula is a metric, the main step is proving its triangle inequality.
The Cauchy–Schwarz Inequality
Proof. First suppose \(y=0\). Then \(\langle x,y\rangle=0\) and \(\|y\|=0\), so both sides of the claimed inequality are zero. Now suppose \(y\ne 0\), so \(\|y\|^2>0\). Set \(t=\langle x,y\rangle/\|y\|^2\). A squared norm is nonnegative, and expanding the following one using the dot product gives
Multiplication by the positive number \(\|y\|^2\) yields \(\langle x,y\rangle^2\leq\|x\|^2\|y\|^2\). Both sides are nonnegative, so taking square roots gives \(|\langle x,y\rangle|\leq\|x\|\|y\|\). This also proves the stated result in the case \(y\ne0\); the case \(y=0\) was checked separately. \(\square\)
The absolute value matters: the dot product can be negative, while the norms cannot. In particular, the lemma implies the one-sided bound \(\langle x,y\rangle\leq\|x\|\|y\|\), which is the form used to prove the triangle inequality.
The Triangle Inequality and the Metric Axioms
Proof. A metric must be nonnegative, vanish exactly when its two inputs agree, be symmetric, and satisfy the triangle inequality. By definition, \(d_2(x,y)\) is a square root of a sum of squares, so \(d_2(x,y)\geq0\). If \(d_2(x,y)=0\), then \(\sum_{i=1}^n(x_i-y_i)^2=0\). Every summand is nonnegative, so each is zero. Thus \(x_i=y_i\) for every coordinate \(i\), and \(x=y\). Conversely, if \(x=y\), every difference is zero and \(d_2(x,y)=0\). Also, \((x_i-y_i)^2=(y_i-x_i)^2\) for each \(i\), so \(d_2(x,y)=d_2(y,x)\).
It remains to prove the triangle inequality. The identity \(x-z=(x-y)+(y-z)\) gives, by expansion of the dot product and then Cauchy–Schwarz,
Both distances, and their sum, are nonnegative. Therefore, taking nonnegative square roots preserves the inequality and gives \(d_2(x,z)\leq d_2(x,y)+d_2(y,z)\). This verifies every metric axiom. \(\square\)
The proof uses no assumption that the points are distinct. If some or all of \(x,y,z\) coincide, the same identities and inequalities still apply; for example, if \(x=y\), then \(d_2(x,z)=d_2(y,z)\) and the right side is \(0+d_2(y,z)\). Thus the degenerate cases are included.
Worked Example: A Right Triangle in the Plane
Let \(p=(0,0)\), \(q=(3,0)\), and \(r=(3,4)\) in \(\mathbb{R}^2\). Compute the three pairwise distances and check the triangle inequality for the distance from \(p\) to \(r\).
For \(p\) and \(q\), subtract coordinates and square each difference: \(0-3=-3\) and \(0-0=0\). Hence \(d_2(p,q)=\sqrt{(-3)^2+0^2}=\sqrt{9+0}=\sqrt9=3\).
For \(q\) and \(r\), the coordinate differences are \(3-3=0\) and \(0-4=-4\). Hence \(d_2(q,r)=\sqrt{0^2+(-4)^2}=\sqrt{0+16}=\sqrt{16}=4\).
For \(p\) and \(r\), the differences are \(0-3=-3\) and \(0-4=-4\). Thus \(d_2(p,r)=\sqrt{(-3)^2+(-4)^2}=\sqrt{9+16}=\sqrt{25}=5\).
Check: The computed distances satisfy \(d_2(p,r)=5\leq d_2(p,q)+d_2(q,r)=3+4=7\). Substituting the coordinates directly into the formula for \(d_2(p,r)\) gives \(\sqrt{25}=5\) again, confirming the direct distance calculation.
Worked Example: Checking the Inequality in Three Dimensions
Take \(x=(0,0,0)\), \(y=(1,-2,2)\), and \(z=(3,-1,2)\) in \(\mathbb{R}^3\). Compute the distances along the two sides through \(y\) and compare their sum with \(d_2(x,z)\).
First, the coordinate differences from \(x\) to \(y\) are \(0-1=-1\), \(0-(-2)=2\), and \(0-2=-2\). Therefore \(d_2(x,y)=\sqrt{(-1)^2+2^2+(-2)^2}=\sqrt{1+4+4}=\sqrt9=3\).
Next, from \(y\) to \(z\) the differences are \(1-3=-2\), \(-2-(-1)=-1\), and \(2-2=0\). Therefore \(d_2(y,z)=\sqrt{(-2)^2+(-1)^2+0^2}=\sqrt{4+1+0}=\sqrt5\).
Finally, from \(x\) to \(z\) the differences are \(0-3=-3\), \(0-(-1)=1\), and \(0-2=-2\). Therefore \(d_2(x,z)=\sqrt{(-3)^2+1^2+(-2)^2}=\sqrt{9+1+4}=\sqrt{14}\).
Check: The inequality to check is \(\sqrt{14}\leq 3+\sqrt5\). Both sides are nonnegative, so it is equivalent to comparing their squares. The left square is \(14\), while \((3+\sqrt5)^2=9+6\sqrt5+5=14+6\sqrt5\). Since \(\sqrt5>0\), \(14<14+6\sqrt5\); hence the required inequality holds. The direct coordinate difference \(z-x=(3,-1,2)\) also has squared norm \(3^2+(-1)^2+2^2=9+1+4=14\), agreeing with the distance computed above.
Worked Example: Distance in Four Dimensions
Let \(p=(1,0,-2,2)\) and \(q=(4,4,-2,5)\) in \(\mathbb{R}^4\). The coordinate differences \(p_i-q_i\) are \(1-4=-3\), \(0-4=-4\), \(-2-(-2)=0\), and \(2-5=-3\). Thus
Check: The sum of the squared differences is \(9+16+0+9=34\), so squaring the reported distance gives \((\sqrt{34})^2=34\), the same value. Reversing the order of the points changes the differences to \(3,4,0,3\); their squares are still \(9,16,0,9\), which also checks symmetry for this pair.
A Common Calculation Error
Common pitfall. For the points \((1,2)\) and \((4,6)\), one might calculate the coordinate differences as \(3\) and \(4\), then incorrectly add their magnitudes and report the Euclidean distance as \(3+4=7\). That calculation does not follow the Euclidean formula. The correct computation is
The incorrect value \(7\) comes from replacing the square root of a sum by a sum of square roots: \(\sqrt{9+16}=5\), whereas \(\sqrt9+\sqrt{16}=3+4=7\). These expressions are not equal. Checking the correct answer by squaring gives \(5^2=25=9+16\), as required by the defining formula. The order of operations is essential: square the coordinate differences, add the squares, and only then take the nonnegative square root.
Why the Formula Works in Every Finite Dimension
The coordinate formula is useful because it turns distance into a finite calculation, while the proof of the metric property does not depend on any special feature of the plane. In the triangle-inequality proof, the only dimension-dependent operation was the dot product \(\sum_{i=1}^n x_i y_i\). Cauchy–Schwarz applies to that sum for every positive integer \(n\), so the same argument covers all finite-dimensional Euclidean spaces.
It is also important to distinguish the norm of a vector from the distance between two points. The norm \(\|x\|\) measures the length associated to a vector \(x\); the distance \(d_2(x,y)\) applies that norm to the difference \(x-y\). The subtraction makes the distance depend on the separation of the points, not on their individual coordinates. For example, translating both points by the same vector does not change their difference: \((x+a)-(y+a)=x-y\). This observation follows directly from the formula and requires no extra metric assumption.
The metric axioms establish that this formula is a valid distance. In particular, the triangle inequality says that the direct distance between two points cannot exceed the sum of the distances along a route through a third point. The examples show how to verify that claim numerically; the Cauchy–Schwarz argument explains why it holds for every triple of points in every \(\mathbb{R}^n\).
Check Your Understanding
For each question, begin with the coordinate formula and show the intermediate squares and sums.
- Compute the Euclidean distance between \((2,-1)\) and \((-1,3)\) in \(\mathbb{R}^2\).
- For \(u=(1,2,2)\) and \(v=(3,2,2)\) in \(\mathbb{R}^3\), find \(\|u\|\), \(\|v\|\), and \(d_2(u,v)\).
- In the Cauchy–Schwarz proof, why must the case \(y=0\) be handled separately before dividing by \(\|y\|^2\)?
- For \(a=(0,0)\), \(b=(0,2)\), and \(c=(3,2)\), compute all three distances and verify the triangle inequality for \(d_2(a,c)\).
- State which metric axiom is checked by the identity \((x_i-y_i)^2=(y_i-x_i)^2\), and explain why that identity proves the axiom for \(d_2\).