0
$\begingroup$

There are two vectors : $A = (\hat i + j + k)$ and $B = (\hat i - \hat j - \hat k)$, where $\hat i$, $\hat j$, and $\hat k$ are unit vectors along $x$, $y$, and $z$ axis respectively. We have to find the angle between these two vectors. Of course the best way to do that is by using ‘scalar product’. Scalar product of these two vectors gives $(-1)$, which is equal to $3\cos\theta$ \begin{align} \implies && -1 & = 3\cos \theta \\ \implies && \theta & = \arccos (-1/3) = 109° \quad \text{(approx)} \end{align}

Now if I use vector product, I get $A \times B = (2\hat j - 2\hat k)$, so $|A \times B| = \sqrt{8}$, which is equal to $3\sin\theta$.

\begin{align} \implies && \sqrt{8} & = 3\sin \theta \\ \implies && \theta & = \arcsin (\sqrt{8}/3) = 70.5° \quad \text{(approx)} \end{align}

Why aren't these two angles equal? Are they not supposed to be equal?

$\endgroup$

migrated from physics.stackexchange.com Jan 16 at 9:53

This question came from our site for active researchers, academics and students of physics.

  • $\begingroup$ Note that you can (and should!) use MathJax to typeset mathematics here; a good tutorial is here. (Also: presumably $B=(i-j-j)$ is a typo?) $\endgroup$ – E.P. Jan 15 at 19:19
  • $\begingroup$ the two angles have the same sinus : $sin(180-70) = sin(110)$ $\endgroup$ – Vincent Fraticelli Jan 15 at 19:32
  • 2
    $\begingroup$ Would Mathematics be a better home for this question? $\endgroup$ – Qmechanic Jan 15 at 19:32
  • $\begingroup$ I think there is a typo in the definition of $B$ $\endgroup$ – ja72 Jan 15 at 19:44
4
$\begingroup$

Your cross-product argument is faulty, because the inverse sine cannot distinguish between angles in the interval $[0,90°]$ and angles in the interval $[90°,180°]$.

The correct angle is that obtained from the scalar-product argument, $\arccos(-1/3) \approx 109°$, and you should be able to verify (numerically, at least) that this angle satisfies $$ \sin\mathopen{}\left(\arccos(-1/3)\right)\mathclose{} = \frac{\sqrt{8}}{3} = \frac{||A\times B||}{||A|| \, ||B||}. $$

The arc-sine, on the other hand, is always restricted to producing angles in the interval $[-90°,90°]$, which means that it reflects that $109.5°$ about the $90°$ mark to produce the $70.5°$ that you observe.

Because of this limitation, your vector-product method is unreliable and it shouldn't be used to calculate angles between vectors.

$\endgroup$
0
$\begingroup$

In fact, neither the sine nor the cosine are sufficient to find an oriented angle. The cosine (dot product) gives the angle to the sign. The sinus is necessary to have the sign. In principle, therefore, both the vector product and the dot product should be used.

$\endgroup$
  • $\begingroup$ You can't have oriented angles in 3D. $\endgroup$ – E.P. Jan 15 at 20:36
  • $\begingroup$ OK. I was speaking of oriented angles which is not the question asked. $\endgroup$ – Vincent Fraticelli Jan 16 at 6:40
0
$\begingroup$

I would argue to use both

$$ \| A \times B \| = \| A \| \| B \| \sin \theta $$ $$ A \cdot B = \| A \| \| B \| \cos \theta $$

or

$$ \tan \theta = \frac{ \| A \times B \|}{A \cdot B} $$

and computationally use the atan2(dy,dx) function

Angle = atan2( cross(A,B), dot(A,B) ) = atan2( 2*sqrt(2),-1 ) = 1.910633r = 109.47122°

The problem with calculating only the $\sin(\theta)$ is that the answer can only be between $[- \tfrac{\pi}{2} \ldots \tfrac{\pi}{2} )$.

Although the above also has the same domain as calculating $\cos(\theta)$ of $[0 \ldots \pi)$, it might be computationally faster since the magnitude of the vectors is never calculated (avoiding two sqrt()) calls.

$\endgroup$
  • 1
    $\begingroup$ So your method saves some two milliseconds in a calculation that used to take five milliseconds? (assuming that your assertion holds up, which is certainly not guaranteed.) Sounds like a useful method, if you're going to be doing this tens of thousands of times in your calculation - which is not the case for OP. $\endgroup$ – E.P. Jan 15 at 20:34
  • $\begingroup$ @EmilioPisanty - There is also the reason that when the vectors are really small near zero the division with the magnitude is unstable. The atan2() function is far more robust for the edge cases. $\endgroup$ – ja72 Jan 15 at 21:18
  • 1
    $\begingroup$ All of that is completely moot. There's no hint of numerical analysis in the question. $\endgroup$ – E.P. Jan 15 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.