2

Consider the space $\mathbb{R}^n$. A direction can be thought of as point on the unit sphere. However, I do not know how to formally define the relation "Point $x$ is more towards direction $\theta$ than point $y$", where $\theta$ is a direction. For example, in $\mathbb{R}^2$, the point $(2,2)$ is north-west of the point $(3,0)$. How does one formally define the relation of direction?

user107952
  • 20,508
  • 1
    This notion is formalised quite well as a dot product of vectors! – Adam Karlson May 07 '21 at 00:24
  • "Point $x$ is more towards direction $\theta$ than point $y$" means that the angle subtended at the origin between $x$ and $\theta$ is smaller than that between $y$ and $\theta$. This isn't really analogous to "$(2, 2)$ is north-west of $(3, 0)$": which would generalise to a statement about the signs of the differences $a_1 - b_1, a_2, b_2, \ldots$ for two vectors $(a_1, a_2, \ldots)$ and $(b_1, b_2, \ldots)$. – Rob Arthan May 07 '21 at 00:27

2 Answers2

3

I'm considering that you want "oriented" directions, ie, that you want you vectors to face the same way to have the same direction.

I'll give you two ways of doing things:

1) Normalize your two vectors (scale them by the inverse of their norm). Their dot product is then equal to the cosine of the angle between them. You can then compare these angles. For $u$, $v$, $w$, if $\cos(u,w)$ is closer to $1$ than $\cos(v,w)$ is close to $1$, then "$u$ is closer to being colinear with $w$ than $v$ is close to being colinear with $w$".

2) Let the relation $\sim$ on $\Bbb R^n$ be defined by $u \sim v \Leftrightarrow \exists k \in \Bbb R_+, u = kv$. This is an equivalence relation (you can prove it as exercise), where two vectors are equivalent iff one is a positive scaling of the other.

You can then do an algebraic quotient: you reduce every family of equivalent vectors (ie, one family for each direction) to a single representative (say the vector at distance $1$ from the origin). This space, written $\Bbb R^n/\sim$, is isomorphic to the $(n-1)$-sphere, as you seem to have noticed in your question. The quotient morphism $f_\sim: \Bbb R^n \to \Bbb R^n/\sim$ maps every vector to a point on this sphere, surjectively.

You can then use the smaller geodesic (there are always two) between any two points of the $(n-1)$-sphere to define a metric (a distance function), which we'll write $d_{S^{(n-1)}}$. You can then compare "how close in direction" two points $u$ and $v$ of $\Bbb R^n$ are by checking the value $d_{S^{(n-1)}}(f_\sim(u), f_\sim(v))$.

In this context you can use $n$-spherical geometry to go a lot further in your analysis than just comparing dot products.

Side note: For $n$-dimensions, you'll need $n-1$ angles to define your direction (ie, polar/spherical/hyperspherical coordinates). Eg: in 3D, you'll need latitude and longitude.

1

In your example of $\mathbb{R}^2$, you can find the direction quite easily. Given two vectors, $v_1, v_2$, you just subtract them. In your example, $(2,1) -(3,0) = (-1,1)$. This is a vector that points negatively in the $x$-coordinate (WEST!) and points positively in the $y$-coordinate (NORTH!). As you said, your point is North-west indeed.

This works well in 2-dimensions and generalizes easily. What we did was take projections in the $x$ and $y$ coordinates. This corresponds to taking dot products with $(1,0)$ and $(0,1)$ respectively.

So, if we had a three dimensional case, then $(4,5,6)$ is north-east-zenith of $(1,2,3)$ and so on. You might have noticed that this directionality is an artifact of us using an orthogonal (North-East-West-South) coordinate system. We have seen how to find how two vectors are arranged with respect to each other in this coordinate system. The previous statement can be rephrased to say how the difference vector is arranged with respect to the coordinate system.

Now, given a general direction $\theta$ and two points $x$ and $y$ in $\mathbb{R}^n$, which one is more in the direction of $\theta$?

As you might also know, that just $\theta$ (an angle) does not specify direction in higher dimensions. Thus, $\theta$ is an $(n-1)$-tuple of angles (for reference). Let the point on the unit sphere corresponding to the direction $\theta$ be $t$.

We can scale back $x$ and $y$ (by dividing them by their norms $\|x\|$ and $\|y\|$ resp.). As we can always do it, we assume that $x$ and $y$ lie on the unit sphere.

Now, compute $x\cdot t = X$ and $y\cdot t = Y$, where $\cdot$ is the dot product operation on $\mathbb{R}^n$.

Compare $X$ and $Y$. The larger number is the one which is closer to your direction, $\theta$.

As an example, let us see which of your vectors is closer to the y-axis. It is certain visually that it is $(2,2)$ but let us put our method to test.

The vector in the direction of $y$-axis is $t = (0,1)$ which lies on the unit circle.

Now, after scaling back to the unit circle, we get the vectors $x =(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$ and $y = (1,0)$

If we find the dot products, we obtain $x\cdot t = \frac{1}{\sqrt{2}}$ and $y\cdot t = 0$. This shows what we were going for.

By using the same method, you can find which of the two vectors is closer to $(2,1)$ (don't forget to scale all vectors). Draw them out and you will see that visually it is hard to tell if $(3,0)$ or $(2,2)$ is closer. This will reflect in the dot product computation!