In mathematics, a metric space is a set where a notion of distance between any two elements (usually called points) is defined, satisfying specific axioms: non-negativity, identity of indiscernibles, symmetry, and the triangle inequality. Essentially, it's a set with a defined distance function that allows us to measure how "far apart" any two elements are.
A vector space, by definition, has no metric inside it, which is very desirable property. It turns out that the scalar product can be used to define length or distance between vectors transferring ℝn into a metric space, known as the Euclidean space. In order to distinguish metric space from vector space with metric, mathematicians call the magnitude or length of vector v by norm and denote it as ∥v∥.
Example 15:
Let us start with a triangle ΔABC in the Euclidean plane, with vertices A, B, and C. Suppose we know the lengths of sides
\( \displaystyle \quad a = \left\vert BC \right\vert , \ b = \left\vert AC \right\vert , \ c = \left\vert AB \right\vert . \quad \)
Suppose that we have to determine the angles (or
their cosines) of this triangle. Call α the angle at vertex A (respectively, β, γ for
the other angles). We know that the length of the orthogonal projection of a
segment is shrunk by a factor equal to the cosine of the angle between the two
directions.
A first relation between the angles α and β is found if we project the sides AC and BC onto AB
\[
c = b\,\cos\alpha + a\,\cos\beta .
\]
Projecting similarly onto the other sides, we are led to two further equations
(which can be obtained from the first one by the use of circular permutations).
Here is the system
\[
\begin{cases}
b\,\cos\alpha + a\,\cos\beta \phantom{+b\,\cos\gamma} &= c ,
\\
\phantom{b\,\cos\alpha} c \,\cos\beta + b\,\cos\gamma &= a ,
\\
c\,\cos\alpha + \phantom{c\.\cos\beta} + a\,\cos\gamma &= b .
\end{cases}
\]
It is linear in the three variables x₁ = cosα, x₂ = cosβ, x₃ = cosγ. Let us solve this system by Gaussian elimination:
\begin{align*}
\left( \begin{array}{ccc|l} b&a&0&c \\ 0&c&b&a \\ c&0&a&b \end{array} \right) &\sim \left( \begin{array}{ccc|l} b&a&0&c \\ 0&c&b&a \\ 0& -\frac{c}{b}\,a & a& b - \frac{c}{b}\,c \end{array} \right)
\\
&\sim \left( \begin{array}{ccc|l} b&a&0&c \\ 0&c&b&a \\ 0&0& 2a & b - \frac{c^2}{b} + \frac{a^2}{b} \end{array} \right)
\end{align*}
This yields
\]
as well as two similar expressions for the other angles. We have obtained the
law of cosines
\[
c^2 = a^2 + b^2 - 2ab\,\cos\gamma .
\]
In particular, we get the Pythagorean theorem for right triangle:
\[
c^2 = a^2 + b^2 \qquad \iff \qquad \cos\gamma = 0 .
\]
■
where "plus" upfront of the square root indicates that only positive root is chosen out of two branches. Here u = u₁e₁ + u₂e₂ + ⋯ + unen is the expansion of vector u with respect to the standard (ordered) basis.
In mathematics, norm ∥·∥ is used to define a distance or length between two vectors:
In order to convince you that the above is a sensible notion
of length, we consider a possible change in length under scalar (λ ∈ ℝ) multiplication of a
vector:
Evidently, if a vector is multiplied with a scalar λ its length scales with the modulus |λ|. This certainly makes intuitive sense and explains why the square root has been
included in Eq. (7). (Otherwise, the length would scale with the square of the scalar.)
We summarize properties of Euclidean norm in the following assesment.
Theorem 6:
The Euclidean length (norm) ∥·∥ : ℝn ↦ ℝ≥0 defined in Eq. (7)
has the following properties, for all v, u ∈ ℝn and all λ ∈ ℝ.
This property follows immediately from the definition
\[
\mathbf{v} \bullet \mathbf{v} = v_1^2 + v_2^2 + \cdots + v_n^2 .
\]
A sum of positive entries cannot be negative, and it is zero only when every term is zero.
Example 16:Mathematica is a very smart CAS, and it can evaluate norms of vectors independently how you write it either as an n-tuple or in matrix form (row or column).
u = {{-1, 3, -2, 2, 3}}; Norm[u]
3 Sqrt[3]
uu = {-1, 3, -2, 2, 3}; Norm[uu]
3 Sqrt[3]
uuu = {{-1}, {3}, {-2}, {2}, {3}}; Norm[uuu]
3 Sqrt[3]
We will use Mathematica for random;y generating vectors. However, its output is always given in matrix form, In order to convert the output in vector form (as an element of 𝔽n), use Flatten command:
u = Flatten[RandomInteger[{-7, 9}, {1, 6}]]; VectorQ[u]
True
Using Mathematica, we verify properties included in Theorem 6 with the following examples.
This formulas follows from the identity:
\[
\mathbf{v} \bullet \mathbf{v} = v_1^2 + v_2^2 + \cdots + v_n^2 .
\]
which is zero only when all components of vector v are zeroes.
Each component of n is divided by the scalar value ∥v∥ ≥ 0.
Therefore, the unit vector n = n(v) represents the direction of vector v. If v = 0, then its length is zero and the corresponding direction vector does not exist. Remember that you must check the value ∥v∥ before dividing to
be sure it is greater than your zero divide tolerance. The zero divide
tolerance is the absolute value of the smallest number by which you
can divide confidently.
Example 17:
Let us consider a vector v = (4, 3) ∈ ℝ². Its Euclidean norm is \( \displaystyle \quad \| \mathbf{v} \| = \sqrt{4^2 + 3^2} = \sqrt{16 + 9} = \sqrt{25} = 5 . \quad \) Then the corresponding direction vector becomes
\[
\mathbf{n} = \frac{\mathbf{v}}{\| \mathbf{v} \|} = \frac{(4, 3)}{5} = \left( \frac{4}{5}, \frac{3}{5} \right) = \left( 0.8, 0.6 \right) .
\]
Since we have only
scaled v by a positive amount ∥v∥ = 5, the direction of n is the same as v.
There are infinitely many unit vectors. Imagine drawing them all,
emanating from the origin. The figure that you will get is a circle of
radius one!
a = 30;
Graphics[Table[
{Line[{{Cos[\[Theta]]/5, Sin[\[Theta]]/
5}, {Cos[\[Pi]/(2 a) + \[Theta]], Sin[\[Pi]/(2 a) + \[Theta]]}}],
Line[{{1/5 Cos[\[Pi]/(2 a) + \[Theta]],
1/5 Sin[\[Pi]/(2 a) + \[Theta]]}, {Cos[\[Theta]],
Sin[\[Theta]]}}],
Line[{{Cos[\[Pi]/(2 a) + \[Theta]],
Sin[\[Pi]/(2 a) + \[Theta]]}, {Cos[\[Pi]/a + \[Theta]],
Sin[\[Pi]/a + \[Theta]]}}],
Line[{{Cos[(3 \[Pi])/(4 a) + \[Theta]],
Sin[(3 \[Pi])/(4 a) + \[Theta]]}, {6/
5 Cos[(5 \[Pi])/(4 a) + \[Theta]],
6/5 Sin[(5 \[Pi])/(4 a) + \[Theta]]}}],
Line[{{Cos[(7 \[Pi])/(4 a) + \[Theta]],
Sin[(7 \[Pi])/(4 a) + \[Theta]]}, {6/
5 Cos[(5 \[Pi])/(4 a) + \[Theta]],
6/5 Sin[(5 \[Pi])/(4 a) + \[Theta]]}}],
Disk[{0, 0}, 2/10]},
{\[Theta], 0, 2 Pi, Pi/a} ], PlotRange -> All, Axes -> False]
Figure 15.2: Unit vectors
■
End of Example 17
Upon introducing the norm (meaning length or magnitude) of a vector, \( \displaystyle \quad \| {\bf v} \| = +\sqrt{{\bf v} \bullet {\bf v}} , \quad \) Cauchy's inequality can be written as
Example 18:
Let us consider a rectangular parallelepiped (also known as rectangular cuboid) with sizes 𝑎, b, and c. We want to compute the angle between the diagonals on two adjacent faces. First, we plot the prizm with two vectors along adjacent diagonals.
Using points A(0, 0, c), B(𝑎, 0, 0), and C(0, b, 0), we find vectors
\[
\mathbf{u} = \vec{BA} = (-a, 0, c) \qquad\mbox{and} \qquad \mathbf{v} = \vec{BC} = (-a, b, 0) .
\]
Their norms
\[
\| \mathbf{u} \| = \sqrt{a^2 + c^2} , \qquad \|\mathbf{v} \| = \sqrt{a^2 + b^2}
\]
and dot product
\[
\mathbf{u} \bullet \mathbf{v} = a^2
\]
show that formula (8) can be written as
\[
\frac{\mathbf{u} \bullet \mathbf{v}}{\| \mathbf{u} \| \cdot \| \mathbf{v} \|} = \frac{a^2}{\sqrt{a^2 + c^2}\cdot\sqrt{a^2 + b^2}} = \cos\theta
\]
because the ratio is definitely less than 1. For instance, if 𝑎 =1, b = 2, and c = 3, we get
\[
\cos\theta = \frac{1}{\sqrt{5}\cdot \sqrt{10}} \qquad \Longrightarrow \qquad \theta = \mbox{arctan}\left( \frac{1}{5\sqrt{2}} \right) \approx 0.14049 .
\]
N[ArcTan[1/(5 Sqrt[2])]]
0.14049
Converting radians into degrees, we multiply the latter by 180/&pi::
N[ArcTan[1/(5 Sqrt[2])]]*180/Pi
8.04947
Another angle problem:
We consider the same cuboid, but now we are going to determine the angle between a diagonal on a face and a diagonal of the cuboid. Upon plotting Figure 16.2, we are after the angle ∠ABD.
Since point D has coordinates (0, b, c), we find vector
\( \displaystyle \quad \mathbf{v} = \vec{BD} = \left( -a, b, c \right) . \quad \) Then the dot product of vectors u and v becomes
\[
\mathbf{u} \bullet \mathbf{v} = \left( -a, 0, c \right) \bullet \left( -a, b, c \right) = a^2 + c^2 .
\]
Then formula (8) yields
\[
\cos\theta = \frac{\mathbf{u} \bullet \mathbf{v}}{\| \mathbf{u} \| \, \| \mathbf{v} \|} = \frac{a^2 + c^2}{\sqrt{a^2 + c^2}\,\sqrt{a^2 + b^2 + c^2}} .
\]
Taking inverse cosine function, we find the angle to be
\[
\theta = \mbox{arccos} \left( \frac{\sqrt{a^2 + c^2}}{\sqrt{a^2 + b^2 + c^2}} \right) .
\]
For 𝑎 =1, b = 2, c = 3, we get
\[
\theta = \mbox{arccos} \left( \frac{\sqrt{10}}{\sqrt{14}} \right) \approx 0.563943 = 32.3115^{\circ} .
\]
N[ArcCos[Sqrt[5/7]]]
0.563943
%*180/P%*180/Pii
32.3115
■
End of Example 18
Dot product in not standard bases
When ordered basis [e₁, e₂, … , en] in ℝn is not a standard one, the dot product must be modified in order to maintain regular (Euclidean) distance between points or vectors:
where u = u¹e₁ + u²e₂ + ⋯ + unen, v = v¹e₁ + v²e₂ + ⋯ + vnen, and the
Einstein summation convention is employed. The metric tensor provides the scalar product of a pair of contravariant vector