### Vectors: Distance, angle, dot product and cross product

### Length and distance

Length in 2D and 3D

We denote the length of a vector \(\vec{v}=\cv{v_1\\ v_2}\) in the coordinate plane \(\mathbb{R}^2\), more precisely the Euclidean length, by \( \lVert\vec{v}\rVert\). It can be calculated via the Pythagorean theorem: \[ \lVert\vec{v}\rVert=\sqrt{v_1^2+v_2^2}\]

When we deal with a vector \(\vec{v}=\cv{v_1\\ v_2\\ v_3}\) in \(\mathbb{R}^3\), the notion of length becomes \[ \lVert\vec{v}\rVert=\sqrt{v_1^2+v_2^2+v_3^3}\]

**Examples**

\[\begin{aligned}\left\lVert\cv{2\\ -3}\right\rVert &=\sqrt{2^2+(-3)^2} \\ &= \sqrt{4+9}=\sqrt{13} \\ \\ \left\lVert\cv{2\\ 3\\ -z}\right\rVert &=\sqrt{2^2+3^2+(-z)^2} \\ &= \sqrt{4+9+z^2}=\sqrt{13+z^2}\end{aligned}\]

This can be generalized to the \(n\)-dimensional coordinate space \(\mathbb{R}^n\).

Length The **Euclidean length** of a vector \(\vec{v}=\cv{v_1\\ \vdots \\ v_n}\) in the \(n\)-dimensional space \(\mathbb{R}^n\), also called the **(Euclidean)** **norm,** we denote by \(\lVert\vec{v}\rVert\). It can be calculated as follows: \[ \lVert\vec{v}\rVert=\sqrt{v_1^2+\cdots + v_n^2}=\sqrt{\sum_{i=1}^n v_i^2}\]

Distance The distance between two vectors \(\vec{u}\) and \(\vec{v}\) is noted as \(d(\vec{u}, \vec{v})\). This is by definition the length of the difference vector \(\vec{u}-\vec{v}\), so \(d(\vec{u}, \vec{v})=\lVert\vec{u}-\vec{v}\rVert\).

Unit vector A vector \(\vec{e}\) is called a **unit vector** if its norm (i.e., its length) is equal to \(1\): \(\lVert\vec{e}\rVert=1\). Division of a nonzero vector \(\vec{v}\) by its norm, that is, multiplication by the reciprocal value of the norm, leads to a unit vector \(\vec{e}=\frac{1}{\|\vec{v}\|}\cdot \vec{v}\) with the same direction as \(\vec{v}\), but with length equal to \(1\).

Properties of the Euclidean norm, the Euclidean norm \(\mathbb{R}^n\) has the following properties: \[\begin{aligned} \lVert\vec{v}\rVert > 0 & \quad\text{if } \vec{v}\neq\vec{0}\\ \lVert\vec{v}\rVert = 0 & \quad\text{if } \vec{v}=\vec{0}\\ \lVert c\cdot\vec{v}\rVert =|c|\cdot \lVert \vec{v}\rVert & \quad\text{voor alle }c \in \mathbb{R}\\ \lVert\vec{u}+\vec{v}\rVert \leq \lVert\vec{u}\rVert+\lVert\vec{v}\rVert & \quad\text{for all } \vec{u}, \vec{v}\in \mathbb{R}^n\end{aligned}\text{.}\]

The properties are exactly what is needed to turn a vector space \(V\) via norm \(\lVert\;\rVert : V\longrightarrow \mathbb{R}\;\) into a so-called **normed vector space.**

The last inequality is called the **triangle inequality** or **Minkowski inequality**.

Two vectors \(\vec{u}\) and \(\vec{v}\) in \(\mathbb{R}^2\) or \(\mathbb{R}^3\) are perpendicular to one another if and only if \[\lVert\vec{u}\rVert^2 + \lVert\vec{v}\rVert^2= \lVert\vec{u}-\vec{v}\rVert^2\tiny.\]

Distance from a point to a line or plane Let \(U\) be a line or a plane in space and \(P\) a point. There is a unique point \(Q\) on \(U\) that has the shortest distance from all points on \(U\) to \(P\). This point is characterized by the property that the vector \(\vec{PQ}\) is perpendicular to the direction vector(s) of \(U\) state. The point \(Q\) is called the **perpendicular projection** or **orthogonal projection** of \(P\) on \(U\).

Projection on a line In the visualisation below, \(U\) is the span of the vector \(\vec{u}\) and we have drawn a perpendicular projection of a vector \(\vec{v}\) on the line \(U\). The vector \(\vec{w}\) is a scalar multiple of the vector \(\vec{u}\). The length of the vector \(\vec{v}-\vec{w}\) is minimal when this vector is perpendicular to the line \(U\). By dragging the terminal point of the vector \(\vec{w}\) along the line you can explore this.

Projection on a plane In the visualisation below, \(U\) is a plane through the origin and we have drawn a perpendicular projection of a vector \(\vec{P}\) on the plane\(U\). The length of the vector \(\vec{QP}\) is minimal under the lengths of \(\vec{RP}\) for all choices of the vectors \(\vec{R}\) in the plane.

The length of a vector \( \cv{x \\ y \\ z} \) is given by \( \sqrt{x^2+y^2+z^2} \).

In the case of \(\vec{v} = \cv{4 \\ 3 \\ -7} \), and thus:

\[\begin{aligned}

\|\vec{v}\| &= \sqrt{4^2 + 3^2 + (-7)^2} \\ \\

&= \sqrt{16 + 9 + 49} \\ \\

&=\sqrt{74}

\end{aligned}\]