2
$\begingroup$

I have been battling a problem of needing to know the derivative of the angle between two vectors, the vectors possibly being parallel at some points in time. I started off with:

$$\bf A \dot \bf B = \|A\|\|B\|\cos\theta \Rightarrow \theta=\arccos \left( \frac{\bf A \dot \bf B}{\|A\|\|B\|} \right)$$

Let's say that $\bf A$ and $\bf B$ are unit vectors for simplicity so:

$$ \theta=\arccos \left( \bf \hat A \dot \bf \hat B \right) $$

To find the derivative of the angle $\theta$:

$$ \dot \theta = \frac{-1}{\sqrt{1-\left(\bf \hat A \dot \bf \hat B\right)^2}} \left[\bf \dot{\hat A}\dot \bf \hat B+\bf {\hat A}\dot \bf \dot{\hat B}\right] $$

But, $\bf{\hat A} \dot \bf{\hat B}=$$1$ when $\bf \hat A \,\,\|\,\, \bf \hat B$ and the denominator of the expression for $\dot \theta$ becomes $0$. We hence get a division by $0$. Now I have tried other ways - by projecting $\bf{\hat B}$ onto $\bf{\hat A}$ and taking $\arctan$, by projecting $\bf{\hat B}$ onto a plane and forming a right-angle triangle and again taking $\arctan$. Every method I tried leads to the same singularity when $\bf \hat A \,\,\|\,\, \bf \hat B$.

Question: what method can I use such that I don't get a singularity for $\dot\theta$ when $\bf{\hat A}$ becomes parallel to $\bf{\hat B}$? Thank you!

$\endgroup$
5
  • 1
    $\begingroup$ Have you tried visualizing $\theta$ as a complex angle, and differentiating $e^{i\theta}$. This is never $0$ so should be differentiable. $\endgroup$
    – JMP
    Feb 22, 2015 at 2:20
  • $\begingroup$ I think that you might be running into trouble with your assumption that A and B are unit vectors. By that assumption you cannot arbitrarily change one of the vectors. It has to remain on the unit circle. Thus $\bf \dot{\hat A}\dot \bf \hat B$ and $\bf {\hat A}\dot \bf \dot{\hat B}$ are both zero. So you have a situation where you have $0/0$ and you would have to use L'Hopital's rule to solve it. I recommend that you solve for the general case. $\endgroup$
    – Tpofofn
    Feb 22, 2015 at 2:38
  • $\begingroup$ Would using arcsec work? $\endgroup$
    – Jack
    Feb 22, 2015 at 2:53
  • $\begingroup$ None of these work... I also don't see how to do the complex representation and solve from there. Could it be that such a simple task as knowing the derivative of an angle between two vectors around the region where these may become parallel be impossible impossible with modern math? $\endgroup$ Feb 22, 2015 at 14:28
  • $\begingroup$ Indeed modern math cannot give you the derivative of the angle between the vectors at exactly the point where they become parallel. Also modern math cannot prove that $2+2=3.$ $\endgroup$
    – David K
    Mar 1, 2022 at 23:50

2 Answers 2

4
$\begingroup$

You cannot get rid of the singularity. Note that in ${\mathbb R}^d$ with $d\geq3$ the angle between two vectors ${\bf a}$, ${\bf b}$ is nonoriented, implying that we always have $$\angle({\bf a},{\bf b})\in[0,\pi]\ .$$ Consider the following example in ${\mathbb R}^3$: $${\bf a}(t):=(1,0,0),\quad{\bf b}(t):=(\cos t,\sin t,0)\qquad(-1<t<1)\ .$$ Then $$\phi(t):=\angle\bigl({\bf a}(t),{\bf b}(t)\bigr)=|t|\ ,$$ and this is not differentiable at $t=0$.

$\endgroup$
0
-1
$\begingroup$

Consider the function $F:\mathbb R^n \setminus\{0\} \to \mathbb S_{n-1}$, defined by $F(u) := u/\|u\|$. So you seek $\dot\theta(t)$, where $\theta(t):= \arccos(r(t))$, and $r(t): = a(t)\cdot b(t)$, where $a(t):= F(x(t))$ and $b(t) := F(y(t))$

Now, by chain rule, $\dot{r}(t) = a(t).\dot{b}(t) + \dot{a}(t)\cdot b(t)$. Using a algebraic fact (see lemma below) and the chain rule again, we get $$ \begin{split} \dot{a}(t) &= \nabla F(x(t))\cdot\dot{x}(t) = \frac{I_n-F(x(t))\otimes F(x(t))}{\|x(t)\|}F(y(t)),\\ \dot{b}(t) &= \nabla F(y(t))\cdot\dot{y}(t) = \frac{I_n-F(y(t))\otimes F(y(t))}{\|y(t)\|}F(x(t)), \end{split} $$ where $\otimes$ denotes the outer-product of vectors (produces a rank-1 matrix) and $I$ is the identity matrix of size $n$. Putting everything together should give you the correct formula for $\dot{r}(t)$. Now by using the chain rule one last time to get $\dot{\theta} = -\dfrac{1}{\sqrt{1-r(t)^2}}\dot{r}(t)$.

Lemma. If $u,v \in \mathbb R^n$ with $u \ne 0$, then $\nabla_u (F(u)\cdot v) = \dfrac{I_n-F(u)\otimes F(u)}{\|u\|}v$.

Proof. Chain rule and basic matrix calculus.

$\endgroup$
3
  • $\begingroup$ This just repeats the OP's solution, but repackaging the dot product in a function $ r(t) $. $\endgroup$
    – Jake Mirra
    Oct 24, 2020 at 14:09
  • $\begingroup$ @JakeMirra I don't think you've understood what I wrote... $\endgroup$
    – dohmatob
    Oct 24, 2020 at 15:21
  • $\begingroup$ Compare your final formula to OP's. $\endgroup$
    – Jake Mirra
    Oct 24, 2020 at 19:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .