3.2 Norm, Dot Product, and Distance in Rⁿ
Norm, Dot Product, and Distance
In this section, we explore concepts of length and distance as they apply to vectors. We’ll start with familiar 2D and 3D spaces, then generalize these ideas algebraically to \(R^n\).
The length of a vector \(\mathbf{v}\) is called its norm, denoted by \(\| \mathbf{v}\|\). It’s also referred to as the length or magnitude of \(\mathbf{v}\).
In \(R^2\) (Pythagorean Theorem): For \(\mathbf{v} = (v_1, v_2)\), \[ \| \mathbf{v}\| = \sqrt{v_1^2 + v_2^2} \tag{1} \]
In \(R^3\) (Pythagorean Theorem twice): For \(\mathbf{v} = (v_1, v_2, v_3)\), \[ \| \mathbf{v}\| = \sqrt{v_1^2 + v_2^2 + v_3^2} \tag{2} \]
Figure 3.2.1: Geometric interpretation of vector norm in \(R^2\) and \(R^3\).
For a vector \(\mathbf{v} = (v_1, v_2, \ldots, v_n)\) in \(R^n\), its norm is defined as:
\[ \| \mathbf{v}\| = \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2} \tag{3} \]
Calculate the norm for a vector in \(R^n\). Enter components as a comma-separated list.
For a vector \(\mathbf{v}\) in \(R^n\) and any scalar \(k\):
Proof (c): If \(\mathbf{v} = (v_1, \ldots, v_n)\), then \(k\mathbf{v} = (kv_1, \ldots, kv_n)\). \[ \begin{aligned} \| k\mathbf{v}\| &= \sqrt{(kv_1)^2 + (kv_2)^2 + \cdots + (kv_n)^2} \\ &= \sqrt{k^2 v_1^2 + k^2 v_2^2 + \cdots + k^2 v_n^2} \\ &= \sqrt{k^2(v_1^2 + v_2^2 + \cdots + v_n^2)} \\ &= \sqrt{k^2} \sqrt{v_1^2 + v_2^2 + \cdots + v_n^2} \\ &= |k| \| \mathbf{v}\| \end{aligned} \]
A vector with a norm of 1 is called a unit vector. Unit vectors are useful for specifying direction without concern for length.
To obtain a unit vector \(\mathbf{u}\) that has the same direction as a nonzero vector \(\mathbf{v}\), we normalize \(\mathbf{v}\): \[ \mathbf{u} = \frac{1}{\| \mathbf{v}\|} \mathbf{v} \tag{4} \]
Warning
Notation Alert: You might also see this written as \(\mathbf{u} = \frac{\mathbf{v}}{\| \mathbf{v}\|}\). This is just a compact way of writing the scalar multiplication, not actual vector division.
We can confirm \(\| \mathbf{u}\| = 1\) using Theorem 3.2.1(c): \[ \| \mathbf{u}\| = \left\| \frac{1}{\| \mathbf{v}\|} \mathbf{v} \right\| = \left| \frac{1}{\| \mathbf{v}\|} \right| \| \mathbf{v}\| = \frac{1}{\| \mathbf{v}\|} \| \mathbf{v}\| = 1 \]
Find the unit vector \(\mathbf{u}\) that has the same direction as \(\mathbf{v} = (2, 2, -1)\).
Solution: First, find the norm of \(\mathbf{v}\): \[ \| \mathbf{v}\| = \sqrt{2^2 + 2^2 + (-1)^2} = \sqrt{4 + 4 + 1} = \sqrt{9} = 3 \] Now, normalize \(\mathbf{v}\): \[ \mathbf{u} = \frac{1}{3} (2, 2, -1) = \left(\frac{2}{3}, \frac{2}{3}, -\frac{1}{3}\right) \] You can verify that \(\| \mathbf{u}\| = \sqrt{(2/3)^2 + (2/3)^2 + (-1/3)^2} = \sqrt{4/9 + 4/9 + 1/9} = \sqrt{9/9} = 1\).
Enter a vector in \(R^n\) and normalize it.
These are unit vectors along the positive coordinate axes.
In \(R^2\): \(\mathbf{i} = (1,0)\) and \(\mathbf{j} = (0,1)\)
In \(R^3\): \(\mathbf{i} = (1,0,0)\), \(\mathbf{j} = (0,1,0)\), and \(\mathbf{k} = (0,0,1)\)
Any vector \(\mathbf{v}\) can be expressed as a linear combination of these:
The concept extends to \(R^n\):
\[ \mathbf{e}_1 = (1,0,0,\ldots,0), \quad \mathbf{e}_2 = (0,1,0,\ldots,0), \quad \ldots, \quad \mathbf{e}_n = (0,0,0,\ldots,1) \tag{7} \] Any vector \(\mathbf{v} = (v_1, v_2, \ldots, v_n)\) in \(R^n\) can be expressed as: \[ \mathbf{v} = v_1\mathbf{e}_1 + v_2\mathbf{e}_2 + \dots + v_n\mathbf{e}_n \tag{8} \]
The distance between two points \(P_1\) and \(P_2\) is the length of the vector \(\overrightarrow{P_1P_2}\).
In \(R^2\): For \(P_1(x_1,y_1)\) and \(P_2(x_2,y_2)\), \[ d = \| \overrightarrow{P_1P_2}\| = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \tag{9} \] In \(R^3\): For \(P_1(x_1,y_1,z_1)\) and \(P_2(x_2,y_2,z_2)\), \[ d = \| \overrightarrow{P_1P_2}\| = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \tag{10} \]
Figure 3.2.3: Distance between two points in \(R^2\).
For points \(\mathbf{u} = (u_1, \ldots, u_n)\) and \(\mathbf{v} = (v_1, \ldots, v_n)\) in \(R^n\), the distance \(d(\mathbf{u},\mathbf{v})\) is:
\[ d(\mathbf{u},\mathbf{v}) = \| \mathbf{u} - \mathbf{v}\| = \sqrt{(u_1 - v_1)^2 + (u_2 - v_2)^2 + \cdots + (u_n - v_n)^2} \tag{11} \]
If \(\mathbf{u} = (1, 3, -2, 7)\) and \(\mathbf{v} = (0, 7, 2, 2)\), then the distance is: \[ \begin{aligned} d(\mathbf{u},\mathbf{v}) &= \sqrt{(1 - 0)^2 + (3 - 7)^2 + (-2 - 2)^2 + (7 - 2)^2} \\ &= \sqrt{1^2 + (-4)^2 + (-4)^2 + 5^2} \\ &= \sqrt{1 + 16 + 16 + 25} = \sqrt{58} \end{aligned} \]
Calculate the distance between two points in \(R^n\). Enter components as comma-separated lists.
To define the “angle” between vectors, we use the dot product.
For nonzero vectors \(\mathbf{u}, \mathbf{v}\) in \(R^2\) or \(R^3\) (with initial points coinciding), the angle \(\theta\) (\(0 \leq \theta \leq \pi\)) between them is shown below:
Figure 3.2.4: Angle between two vectors.
Definition 3 (Geometric Dot Product): \[ \mathbf{u}\cdot \mathbf{v} = \| \mathbf{u}\| \| \mathbf{v}\| \cos \theta \tag{12} \] If \(\mathbf{u} = \mathbf{0}\) or \(\mathbf{v} = \mathbf{0}\), then \(\mathbf{u}\cdot \mathbf{v} = 0\).
From the geometric definition, we can find the angle: \[ \cos \theta = \frac{\mathbf{u}\cdot\mathbf{v}}{\| \mathbf{u}\| \| \mathbf{v}\|} \tag{13} \] Since \(0 \leq \theta \leq \pi\):
Figure 3.2.5: Angle types based on dot product sign.
Find the dot product of the vectors \(\mathbf{u}\) and \(\mathbf{v}\) shown in Figure 3.2.5.
The lengths are:
\(\| \mathbf{u}\| = 1\)
\(\| \mathbf{v}\| = \sqrt{2^2 + 2^2} = \sqrt{8} = 2\sqrt{2}\)
The angle between them is \(\theta = 45^\circ\), so \(\cos(45^\circ) = 1/\sqrt{2}\).
Thus, \[ \mathbf{u}\cdot \mathbf{v} = \| \mathbf{u}\| \| \mathbf{v}\| \cos \theta = (1)(2\sqrt{2})(1/\sqrt{2}) = 2 \]
For computational purposes, we need a formula in terms of components. Using the Law of Cosines for the triangle formed by \(\mathbf{u}\), \(\mathbf{v}\), and \(\mathbf{v}-\mathbf{u}\):
Figure 3.2.6: Derivation of component form of dot product.
This leads to:
For vectors \(\mathbf{u} = (u_1, \ldots, u_n)\) and \(\mathbf{v} = (v_1, \ldots, v_n)\) in \(R^n\), the dot product is:
\[ \mathbf{u}\cdot \mathbf{v} = u_1v_1 + u_2v_2 + \dots + u_nv_n \tag{17} \] In words: Multiply corresponding components and add the products.
Compute the dot product of two vectors in \(R^n\). Enter components as comma-separated lists.
Find the angle between a diagonal of a cube and one of its edges.
Let the cube have edge length \(k\). Place one vertex at the origin \((0,0,0)\).
Using the formula \(\cos \theta = \frac{\mathbf{u}\cdot\mathbf{v}}{\| \mathbf{u}\| \| \mathbf{v}\|}\): \[ \cos \theta = \frac{\mathbf{u}_1\cdot\mathbf{d}}{\| \mathbf{u}_1\| \| \mathbf{d}\|} = \frac{(k)(k) + (0)(k) + (0)(k)}{\sqrt{k^2}\sqrt{k^2+k^2+k^2}} = \frac{k^2}{k\sqrt{3k^2}} = \frac{k^2}{k(k\sqrt{3})} = \frac{1}{\sqrt{3}} \] \[ \theta = \cos^{-1}\left(\frac{1}{\sqrt{3}}\right) \approx 54.74^{\circ} \]
Note
The angle \(\theta\) does not depend on \(k\). This is expected because scaling a cube doesn’t change its internal angles.
Figure 3.2.7: Diagonal of a cube and one of its edges.
Relationship between Norm and Dot Product: \[ \mathbf{v}\cdot \mathbf{v} = v_1^2 + \dots + v_n^2 = \| \mathbf{v}\|^2 \tag{18} \] So, \(\| \mathbf{v}\| = \sqrt{\mathbf{v}\cdot \mathbf{v}}\) (Eq. 19)
Theorem 3.2.2: For \(\mathbf{u}, \mathbf{v}, \mathbf{w}\) in \(R^n\), scalar \(k\):
\(\mathbf{u}\cdot \mathbf{v} = \mathbf{v}\cdot \mathbf{u}\) (Symmetry)
\(\mathbf{u}\cdot (\mathbf{v} + \mathbf{w}) = \mathbf{u}\cdot \mathbf{v} + \mathbf{u}\cdot \mathbf{w}\) (Distributive)
\(k(\mathbf{u}\cdot \mathbf{v}) = (k\mathbf{u})\cdot \mathbf{v} = \mathbf{u}\cdot (k\mathbf{v})\) (Homogeneity)
\(\mathbf{v}\cdot \mathbf{v} \geq 0\) and \(\mathbf{v}\cdot \mathbf{v} = 0\) iff \(\mathbf{v} = \mathbf{0}\)
Theorem 3.2.3 (Additional Properties):
\(\mathbf{0}\cdot \mathbf{v} = \mathbf{v}\cdot \mathbf{0} = 0\)
\((\mathbf{u} + \mathbf{v})\cdot \mathbf{w} = \mathbf{u}\cdot \mathbf{w} + \mathbf{v}\cdot \mathbf{w}\)
\(\mathbf{u}\cdot (\mathbf{v} - \mathbf{w}) = \mathbf{u}\cdot \mathbf{v} - \mathbf{u}\cdot \mathbf{w}\)
\((\mathbf{u} - \mathbf{v})\cdot \mathbf{w} = \mathbf{u}\cdot \mathbf{w} - \mathbf{v}\cdot \mathbf{w}\)
Simplify \((\mathbf{u} - 2\mathbf{v})\cdot (3\mathbf{u} + 4\mathbf{v})\).
Using distributive and homogeneity properties: \[ \begin{aligned} (\mathbf{u} - 2\mathbf{v})\cdot (3\mathbf{u} + 4\mathbf{v}) &= \mathbf{u}\cdot (3\mathbf{u} + 4\mathbf{v}) - 2\mathbf{v}\cdot (3\mathbf{u} + 4\mathbf{v}) \\ &= (3\mathbf{u}\cdot \mathbf{u} + 4\mathbf{u}\cdot \mathbf{v}) - (6\mathbf{v}\cdot \mathbf{u} + 8\mathbf{v}\cdot \mathbf{v}) \\ &= 3(\mathbf{u}\cdot \mathbf{u}) + 4(\mathbf{u}\cdot \mathbf{v}) - 6(\mathbf{u}\cdot \mathbf{v}) - 8(\mathbf{v}\cdot \mathbf{v}) & \text{[Symmetry: }\mathbf{v}\cdot \mathbf{u} = \mathbf{u}\cdot \mathbf{v}] \\ &= 3\| \mathbf{u}\|^2 - 2(\mathbf{u}\cdot \mathbf{v}) - 8\| \mathbf{v}\|^2 & \text{[Since }\mathbf{x}\cdot \mathbf{x} = \| \mathbf{x}\|^2] \end{aligned} \]
To define the angle in \(R^n\) using \(\cos \theta = \frac{\mathbf{u}\cdot\mathbf{v}}{\| \mathbf{u}\| \| \mathbf{v}\|}\), we need to ensure the argument of \(\cos^{-1}\) is between -1 and 1. This is guaranteed by the Cauchy-Schwarz Inequality:
Theorem 3.2.4 (Cauchy-Schwarz Inequality): If \(\mathbf{u} = (u_1, \ldots, u_n)\) and \(\mathbf{v} = (v_1, \ldots, v_n)\) are vectors in \(R^n\), then: \[ |\mathbf{u}\cdot \mathbf{v}|\leq \| \mathbf{u}\| \| \mathbf{v}\| \tag{22} \] Or in component form: \[ |u_1v_1 + \dots + u_nv_n| \leq (u_1^2 + \dots + u_n^2)^{1/2}(v_1^2 + \dots + v_n^2)^{1/2} \tag{23} \]
Implication for Angle: Dividing by \(\| \mathbf{u}\| \| \mathbf{v}\|\) (for nonzero vectors) gives: \[ \left|\frac{\mathbf{u}\cdot\mathbf{v}}{\| \mathbf{u}\| \| \mathbf{v}\|}\right|\leq 1 \quad \implies \quad -1 \leq \frac{\mathbf{u}\cdot\mathbf{v}}{\| \mathbf{u}\| \| \mathbf{v}\|} \leq 1 \] This confirms that the angle formula is well-defined for all nonzero vectors in \(R^n\).
These generalize familiar geometric results.
Theorem 3.2.5: For vectors \(\mathbf{u},\mathbf{v},\mathbf{w}\) in \(R^n\):
\(\| \mathbf{u} + \mathbf{v}\| \leq \| \mathbf{u}\| + \| \mathbf{v}\|\) (Triangle inequality for vectors)
\(d(\mathbf{u},\mathbf{v})\leq d(\mathbf{u},\mathbf{w}) + d(\mathbf{w},\mathbf{v})\) (Triangle inequality for distances)
Figure 3.2.8: Triangle inequality for vectors.
Proof (a): Starting with \(\| \mathbf{u} + \mathbf{v}\|^2 = (\mathbf{u} + \mathbf{v})\cdot (\mathbf{u} + \mathbf{v}) = \| \mathbf{u}\|^2 + 2(\mathbf{u}\cdot \mathbf{v}) + \| \mathbf{v}\|^2\). Using \(\mathbf{u}\cdot \mathbf{v} \leq |\mathbf{u}\cdot \mathbf{v}|\) and Cauchy-Schwarz \(|\mathbf{u}\cdot \mathbf{v}| \leq \| \mathbf{u}\| \| \mathbf{v}\|\): \[ \| \mathbf{u} + \mathbf{v}\|^2 \leq \| \mathbf{u}\|^2 + 2\| \mathbf{u}\| \| \mathbf{v}\| + \| \mathbf{v}\|^2 = (\| \mathbf{u}\| + \| \mathbf{v}\|)^2 \] Taking the square root (both sides non-negative) gives the result.
This theorem generalizes the property that the sum of the squares of the diagonals of a parallelogram equals the sum of the squares of its four sides.
Theorem 3.2.6 (Parallelogram Equation): If \(\mathbf{u}\) and \(\mathbf{v}\) are vectors in \(R^n\), then: \[ \| \mathbf{u} + \mathbf{v}\|^2 + \| \mathbf{u} - \mathbf{v}\|^2 = 2\left(\| \mathbf{u}\|^2 + \| \mathbf{v}\|^2\right) \tag{24} \]
Figure 3.2.10: Parallelogram formed by \(\mathbf{u}\), \(\mathbf{v}\), \(\mathbf{u}+\mathbf{v}\), and \(\mathbf{u}-\mathbf{v}\).
Theorem 3.2.7 (Dot Product from Norms): For vectors \(\mathbf{u}, \mathbf{v}\) in \(R^n\): \[ \mathbf{u}\cdot \mathbf{v} = \frac{1}{4}\| \mathbf{u} + \mathbf{v}\|^2 - \frac{1}{4}\| \mathbf{u} - \mathbf{v}\|^2 \tag{25} \] This formula expresses the dot product solely in terms of norms.
The dot product can be expressed using matrix notation, depending on whether vectors are row or column matrices.
| Form | Dot Product |
|---|---|
| \(\mathbf{u}\) column, \(\mathbf{v}\) column | \(\mathbf{u}^T\mathbf{v} = \mathbf{v}^T\mathbf{u}\) |
| \(\mathbf{u}\) row, \(\mathbf{v}\) column | \(\mathbf{u}\mathbf{v} = \mathbf{v}^T\mathbf{u}^T\) |
| \(\mathbf{u}\) column, \(\mathbf{v}\) row | \(\mathbf{v}\mathbf{u} = \mathbf{u}^T\mathbf{v}^T\) |
| \(\mathbf{u}\) row, \(\mathbf{v}\) row | \(\mathbf{u}\mathbf{v}^T = \mathbf{v}\mathbf{u}^T\) |
(Partial Table 1 from text)
Key Identities: For an \(n \times n\) matrix \(A\) and \(n \times 1\) column vectors \(\mathbf{u}, \mathbf{v}\): \[ A\mathbf{u}\cdot \mathbf{v} = \mathbf{u}\cdot A^T\mathbf{v} \tag{26} \] \[ \mathbf{u}\cdot A\mathbf{v} = A^T\mathbf{u}\cdot \mathbf{v} \tag{27} \] These link matrix multiplication with the transpose.
Given: \[ A={\left[\begin{array}{l l l}{1}&{-2}&{3}\\ {2}&{4}&{1}\\ {-1}&{0}&{1}\end{array}\right]}, \quad \mathbf{u}={\left[\begin{array}{l}{-1}\\ {2}\\ {4}\end{array}\right]}, \quad \mathbf{v}={\left[\begin{array}{l}{-2}\\ {0}\\ {5}\end{array}\right]} \] Calculate \(A\mathbf{u}\cdot \mathbf{v}\) and \(\mathbf{u}\cdot A^T\mathbf{v}\).
\(A\mathbf{u}\) calculation: \[ A\mathbf{u}={\left[\begin{array}{l}{1(-1) - 2(2) + 3(4)}\\ {2(-1) + 4(2) + 1(4)}\\ {-1(-1) + 0(2) + 1(4)}\end{array}\right]}={\left[\begin{array}{l}{7}\\ {10}\\ {5}\end{array}\right]} \] Then \(A\mathbf{u}\cdot \mathbf{v} = (7)(-2) + (10)(0) + (5)(5) = -14 + 0 + 25 = 11\).
\(A^T\mathbf{v}\) calculation: \[ A^T={\left[\begin{array}{l l l}{1}&{2}&{-1}\\ {-2}&{4}&{0}\\ {3}&{1}&{1}\end{array}\right]} \implies A^T\mathbf{v}={\left[\begin{array}{l}{1(-2) + 2(0) - 1(5)}\\ {-2(-2) + 4(0) + 0(5)}\\ {3(-2) + 1(0) + 1(5)}\end{array}\right]}={\left[\begin{array}{l}{-7}\\ {4}\\ {-1}\end{array}\right]} \] Then \(\mathbf{u}\cdot A^T\mathbf{v} = (-1)(-7) + (2)(4) + (4)(-1) = 7 + 8 - 4 = 11\). Thus, \(A\mathbf{u}\cdot \mathbf{v} = \mathbf{u}\cdot A^T\mathbf{v}\) is verified.
Verify \(A\mathbf{u}\cdot \mathbf{v} = \mathbf{u}\cdot A^T\mathbf{v}\) with custom matrices and vectors.
The International Standard Book Number (ISBN) uses a check digit based on the dot product.
Example: ISBN 0-471-15307-9
\(\mathbf{b} = (0, 4, 7, 1, 1, 5, 3, 0, 7)\)
\(\mathbf{a}\cdot \mathbf{b} = (1)(0) + (2)(4) + (3)(7) + (4)(1) + (5)(1) + (6)(5) + (7)(3) + (8)(0) + (9)(7)\)
\(= 0 + 8 + 21 + 4 + 5 + 30 + 21 + 0 + 63 = 152\)
\(152 \div 11 = 13\) with a remainder of \(9\).
So, \(c=9\).
Enter the first 9 digits of an ISBN to calculate its check digit.
Tip
Practical Importance for ECE: