Best angle of trajectory via differences in normalised dot product

36 Views Asked by At

Take three vectors $u,v,h \in \mathbb{R}^n$. We will call $u$ the desired vector, $v$ the undesired vector, and $h$ the true vector. We can measure the similarity in the direction of these vectors by examining their normalised dot products. Therefore, take: \begin{equation} \theta = \frac{u\cdot v}{\lVert u \rVert \lVert v \rVert}, \quad \phi= \frac{u\cdot h}{\lVert u \rVert \lVert h \rVert}, \quad \text{and } \tau= \frac{v\cdot h}{\lVert v \rVert \lVert h \rVert} \end{equation}

We then devise a score $S = \phi - \tau$ that essentially measures how well aligned the true trajectory is with the desired trajectory and how mis-aligned the true trajectory is with the undesired trajectory.

Therefore, since $\theta,\tau,\phi \in [-1,1]$, then $S\in[-2,2]$. Where

  • $S\in[-2,2]$ can only occur when $\theta = -1$ ($u$ and $v$ are perfectly opposed);
  • $S\in[-1,1]$ (strictly) can only occur when $\theta = 0$ ($u$ and $v$ are orthogonal); and
  • $S=0$ $\forall v$ when $\theta = 1$ (when $u$ and $v$ are perfectly aligned).

Thus, for any given value of $v$ and $u$ there must be some value $h$ can take that maximises the score $S$. My intuition is that the maximum value that $S$ can take for any fixed values for $v$ and $u$ must be related to their angle $\theta$, but I am unsure of how to go about finding this maximum. I've tried breaking down the score into fundamental parts, so: \begin{equation} S = \frac{1}{\lVert h \rVert} \sum_{i=1}^n h_i \bigg(\frac{u_i}{\lVert u \rVert} - \frac{v_i}{\lVert v \rVert} \bigg) = \frac{1}{\big(\sum_{i=1}^nh^p\big)^\frac{1}{p}} \sum_{i=1}^n h_i \bigg(\frac{u_i}{\big(\sum_{i=1}^n u^p\big)^\frac{1}{p}} - \frac{v_i}{\big(\sum_{i=1}^n v^p\big)^\frac{1}{p}} \bigg) \end{equation}

where $h_i$ is therefore essentially a variable, and trying to manipulate the equation to find $\theta$, but to no avail. Perhaps I am overcomplicating this, as I do feel like this relationship should be relatively simple, but any help would be appreciated.

Essentially, I am just after $\max(S)$ given $v$ and $u$ are fixed, with $h$ allowing to vary. Thanks in advance

1

There are 1 best solutions below

0
On

I was overcomplicating this (slightly)!

Since:

\begin{equation} \begin{aligned} S &= \phi - \tau \\ &= \frac{h\cdot u}{ \lVert h \rVert \lVert u \rVert} - \frac{h\cdot v}{ \lVert h \rVert \lVert v \rVert} \\ &= \frac{h}{\lVert h \rVert} \cdot \bigg ( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg ) \end{aligned} \end{equation} we are essentially checking the alignment $h$ has with the difference between the two other vectors. Thus, the maximum value that $S$ can take at any one time occurs when: \begin{equation} h = \lVert h \rVert \bigg( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg) \end{equation}

EDIT:

Just to add to this, this means that: \begin{equation} \begin{aligned} \frac{S}{\max(S)} &= \frac{\frac{h\cdot u}{ \lVert h \rVert \lVert u \rVert} - \frac{h\cdot v}{ \lVert h \rVert \lVert v \rVert}}{\frac{\bigg( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg) \cdot \bigg( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg)}{\lVert \bigg( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg) \rVert}} \\ &= \frac{h}{\Vert h \rVert} \cdot \frac{\bigg( \frac{u}{\lVert u \rVert} - \frac{v}{\lVert v \rVert} \bigg)}{\sqrt{2 - 2\theta}} \end{aligned} \end{equation} so the intuition about the value being related to the angle between the desiered and undesired trajectory was correct!