How is the angle between 2 vectors in more than 3 dimensions defined?

14.7k Views Asked by At

I would like to know how the angle between two n-vectors is defined. I mean whether it is unique and how we may compute it (is the inner product a valid method in the n-dimensional space?). I have found very little information on this issue on the internet. Thanks

4

There are 4 best solutions below

1
On

In the $n$-dimensional real space the angle between two vectors is defined by the inner-product: $$\cos\theta=\frac{\langle v,w \rangle}{||v||\cdot||w||}$$ Where $||v||$ is the length of the vector.

4
On

If your two vectors $v$ and $w$ are not collinear then they span a two-dimensional plane $E\subset{\mathbb R}^n$. This plane inherits the given scalar product in ${\mathbb R}^n$ and so becomes an ordinary euclidean plane like the sheet of paper you are drawing on. The angles in this plane are related to the scalar product as they are in two-dimensional vector geometry, namely by $$\cos\bigl(\angle(v,w)\bigr)={\langle v, w\rangle\over|v|\ |w|}\ .$$

0
On

While you can certainly compute the angle using the usual inner product formula, it's also possible and perfectly acceptable to use the same flavor of geometric definition of angles as is done in $\mathbb{R}^2$ and $\mathbb{R}^3$. Radially project two given nonzero vectors onto the unit sphere via the map $\vec{x}\to\vec{x}/\|\vec{x}\|$. Any two nonidentical points on a hypersphere determine a unique "great circle" containing both of them; the angle in radians can be defined as the length of the shorter arc between the two. (Of course, this raises the question, "How is arclength defined in higher dimensions?" - but this is moot given that the 2 and 3-dimensional definitions immediately generalize to any dimension.)

Demonstrating the inner product formula works in higher dimensions given this definition is fairly easy: the general idea is to use an orthonormal change-of-base matrix $M$ which takes the plane determined by the great circle containing two unit vectors to the $xy$-plane (inner products are unchanged under $M$'s action: $\langle Mx,My\rangle = \langle x,M^TMy\rangle = \langle x,Iy\rangle=\langle x,y\rangle$) and then the formula's validity is reduced to the two-dimensional case.

0
On

Here is one way to build up to the notion, proving Cauchy-Schwarz inequality along the way.

Distance: Let $ x = (x_1 , \ldots, x_n)^t \in \mathbb{R}^n $. We know, for $ n = 3 $, length of this vector is $ \sqrt{x_1 ^2 + x_2 ^2 + x_3 ^2} $.
This suggests looking at the quantity $ \| x \| \overset{\text{def}}{=} \sqrt{\sum x_i ^2 } $ (which we expect to behave like length).

Orthogonality: Let $ x,y \in \mathbb{R}^n $ be nonzero. For $ n \leq 3 $ we know $ (x,y \text{ are perpendicular}) $ $ \iff (\text{point } x \text{ is equidistant from points } y, (-y))$ $ \iff (\lVert x - y \rVert = \lVert x - (-y) \rVert )$ expresses perpendicularity in terms of lengths.
This suggests looking at the notion $ (x, y \in \mathbb{R}^n \text{ are orthogonal}) \overset{\text{def}}{\iff} (\lVert x - y \rVert = \lVert x + y \rVert). $

Dot Product: The condition $ \lVert x - y \rVert = \lVert x + y \rVert $ can be rewritten as $ \sum (x_i - y_i)^2 = \sum (x_i + y_i)^2 $, which inturn is $ \sum x_i y_i = 0 $. Also $ \| x \| = \sqrt{\sum x_i x_i} $.
This suggests looking at $ \langle x,y \rangle \overset{\text{def}}{=} \sum x_i y_i $, from which $ (x,y \in \mathbb{R}^n \text{ are orthogonal}) \iff (\langle x,y \rangle = 0) $ and $ \| x \| = \sqrt{ \langle x,x \rangle}. $
[ $\langle \cdot \, , \cdot \rangle $ also has few pleasant properties like $ \langle x,y \rangle = \langle y,x \rangle $, $ \langle v_1 + v_2, w \rangle = \langle v_1 , w \rangle + \langle v_2, w \rangle $, etc. ]


We dont yet have a notion similar to "angle between two vectors"...

Decomposing into perpendicular and parallel vectors:
Let $ x,y \in \mathbb{R}^n $ be nonzero. We'll try decomposing $ x $ as $ x = x_{||} + x_{\perp} $, so that $ x_{||} $ is parallel to $ y $ and $ x_{\perp} $ perpendicular to $ y $.
This amounts to writing $ x = ty + (x-ty) $ where $ \langle x-ty, y \rangle = 0 $. So $ x = \frac{\langle x,y \rangle}{\langle y,y \rangle} y + \left( x - \frac{\langle x, y \rangle}{\langle y,y \rangle} y \right) $ is the required decomposition.

Cauchy-Schwarz: In above setup, $ \| x \| = \sqrt{\langle x_{||} + x_{\perp}, x_{||} + x_{\perp} \rangle} $, which on using $ \langle x_{||}, x_{\perp} \rangle = 0 $ becomes $ \sqrt{\|x_{||}\|^2 + \| x_{\perp}\|^2 } $.
Especially $ \| x \| \geq \| x_{||} \| $ $ = \frac{|\langle x,y \rangle|}{\|y\|^2} \| y \| $ $ = \frac{|\langle x,y \rangle|}{\| y \|} $, that is $ \| x \| \| y \| \geq | \langle x,y \rangle | $.
[ The inequality $ \| x \| \| y \| \geq | \langle x, y \rangle | $ also trivially holds when one of $ x,y $ is $ 0 $ ]

Angles: Let $ x,y \in \mathbb{R}^n $ be nonzero.
For $ n \leq 3 $, we know $ \| x \| | \cos(\theta) | = \| x_{||} \| $, where $ \theta $ is the angle between $ x $ and $ y $. In fact, $ \| x \| \cos(\theta) = \left(\text{sign of scaling factor } \frac{\langle x,y \rangle}{\langle y, y \rangle} \right) \left\| \frac{\langle x,y \rangle}{\langle y,y \rangle} y \right\|. $ That is, $ \cos(\theta) = \frac{\langle x, y \rangle}{\| x \| \| y \|} $.
This suggests defining angle between $ x,y \in \mathbb{R}^n $ as $ \theta \overset{\text{def}}{=} \cos^{-1} \left( \frac{\langle x,y \rangle}{\|x\| \|y\|} \right) \in [0, \pi]. $