Calculating the angle between two vectors

  • Thread starter Thread starter computerex
  • Start date Start date
  • Tags Tags
    Angle Vectors
AI Thread Summary
To calculate the angle between two vectors in a range of 0 to 360 degrees, first compute the inverse cosine of the dot product of the normalized vectors. This provides an angle between 0 and π, but does not indicate direction. To determine the orientation, define a reference vector in the plane of the two vectors. Calculate the cross product of the vectors; if the z-component of the result is positive or zero, use the angle from the inverse cosine directly. If the z-component is negative, subtract the angle from 2π to get the correct orientation.
computerex
Messages
68
Reaction score
0
When calculating the angle between two vectors, I take the inverse cosine of the dot product of the two vectors normalized. This gives me the angle, however this does not specify whether the direction is backwards or forwards. In other words, it'll give me a range of -PI/2 to PI/2, then it loops back. Is there a way to figure out the angle in range of 0 to 360 degrees with this?
 
Mathematics news on Phys.org
Usually (for how it is normally defined, for example, in calculators) the cos^(-1) gives back values belonging to [0, pi], not [-pi/2 , pi/2] because in this interval the cos is not invertible.

Lets consider R^3.
If you want an angle between two normalized vectors u and v, belonging to [0, 2pi[, you have to define an orientation z for the plane where the two vectors are (the vector z lies in one side or the other of the plane, you choose).

(1) calculate alpha = cos^(-1) (u.v)
(2) calculate w = u x v
(3) if w.z > 0 or w.z = 0 then the answer is alpha
(4) if w.z < 0 then the answer is 2pi - alpha
 
The "angle between two vectors" is, by definition, the smaller of the two angles formed by the intersection of lines in the direction of the two vectors. The angle between two vectors is always between 0 and \pi.
 
HallsofIvy said:
The "angle between two vectors" is, by definition, the smaller of the two angles formed by the intersection of lines in the direction of the two vectors. The angle between two vectors is always between 0 and \pi.

Nevertheless, if you need it, you can define the angle in (0, 2pi), and to do so you have to decide an orientation.
 
Suppose ,instead of the usual x,y coordinate system with an I basis vector along the x -axis and a corresponding j basis vector along the y-axis we instead have a different pair of basis vectors ,call them e and f along their respective axes. I have seen that this is an important subject in maths My question is what physical applications does such a model apply to? I am asking here because I have devoted quite a lot of time in the past to understanding convectors and the dual...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Back
Top