# Sinus of the angle between two vectors

dr-dock
i wonder how can i get the exact sinus of the angle between two vectors. one solution is thru the vector product.since
|XxY|=|X||Y|sin(<X,Y>) then
sin(<X,Y>)=|XxY|/(|X||Y|)
unfortunately i don't know when |XxY|>0 and when |XxY|<0 cause
|XxY|=(+/-)sqrt(sqr(XxY(1))+sqr(XxY(2))+sqr(XxY(3))).
how can i be sure when to use + when to use -?

or maybe there is another way to do it?

enigma
Staff Emeritus
Gold Member
Originally posted by dr-dock
i don't know when |XxY|>0 and when |XxY|<0 cause
|XxY|=(+/-)sqrt(sqr(XxY(1))+sqr(XxY(2))+sqr(XxY(3))).

|[vect]| is defined to be the positive value.

I can't help you in the way you are talking about, but i can give you another way to find the exact value of Sin([the]) between two vectors.
(suppose A and B are both vectors in 3D).
A can be written as :
A=A1i+A2j+A3k
(Same for B)
A.B is defined to be |A||B|Cos([the])
A.B=|A||B|Cos([the])
So
Cos([the])=(A.B)/(|A||B|)
You can also derive that (if you wonder how this happened, just ask about it) :
A.B=A1B1+A2B2+A3B3
So
Cos([the])=(A1B1+A2B2+A3B3)/(|A||B|) ------(1)
We also know that Cos([the])2+Sin([the])2=1
So Sin([the])=[squ](1 - Cos([the])2) ----(2)
Put the value of Cos([the]) obtained from (1) into equation (2), and you get Sin([the]).

Is this usefull for you ?
(edited for a typo)

Last edited:
i just try to explain the vector product....
a x b= ab sin(<X,Y>) and the direction is use the righ-hand rule
so, a x b= -(b x a)
and the angle is define in [0,180]
a x b is positive...then b x a is negative

Hurkyl
Staff Emeritus
Gold Member

Part 1: Ordinary geometry

Ordinary geometric angles are only allowed to range between 0 degrees and 180 degrees. Vector norms such as |X| are defined to always be nonnegative.

In the equation:

|XxY| = |X| |Y| sin &theta

&theta is the angle measure of the ordinary geometric angle between X and Y. Because ordinary geometric angles only range from 0 to 180 degrees, sin &theta is always positive. Vector norms are defined to be nonnegative, so we have no problem with this equation.

In ordinary geometry, angles don't have orientation; they're simply between the two vectors, not directed from one vector to another. The angle between X and Y is identical to the angle between Y and X

Part 2: Orientation

Ordinary geometry can be extended to include the concept of orientation. This can be a fairly tricky subject since orientation is an oft-neglected subject, which I will try to briefly summarize (which will necessarily be lacking in depth).

I'll start with 2 dimensions. In two dimensional geometry, we often impose the convention (aka orientation) that positive angles are counter-clockwise and negative angles are clockwise. But how would you describe this to someone who has never heard of the term "clockwise" before?

One can heuristically define counter-clockwise as "The direction that yields the smallest angle if you start from the positive x-axis and rotate to the positive y-axis". Mathematically this definition is a nightmare, but it conveys a good understanding to a person.

Fortunately, there are nicer numerical definitions of orientation in the 2-d plane. The simplest is via the cross product:

If both X and Y are in the x-y plane, then XxY is a vector that points along the z-axis. We can then define that the angle between X and Y is positive (counter-clockwise) if their cross product lies on the positive z-axis, and negative (clockwise) if the cross product lies on the negative z-axis.

The original formula needs to be modified if we're working with directed angles. One way is to strip off the direction information:

|XxY| = |X| |Y| |sin &theta|

The other way is to use the above definition of direction:

(XxY).k = |X| |Y| sin &theta

Where . means dot product and k is the unit vector pointing along the positive z-axis.

Now, let us move into 3-D space. In 2-D space, we always implicitly assumed that we're looking directly at the 2-D plane with the positive x-axis pointing to our right and the positive y-axis pointing up. However, we can look at any 2-D plane from two different sides... so in 3-D space we don't have any implicit assumption about which way we're "supposed" to look at our angle, and looking at it from different sides will yield opposite calculations of its sign. So we see that simply having the two vectors doesn't give us enough information to define a direction for the angle between them.

The last formula I gave for the angle between two vectors gives us the hint we need. We need to specify a unit vector that points in the direction from which we should look at the angle! For 2-D geometry, we're always looking from the positive z-axis, so we used k for this vector... but for an angle located in general 3-D space, we need to explicitly specify this vector.

Explicitly specifing that vector, however, is often difficult and cumbersome. A more common approach is to go half-way; we merely declare something like:

|XxY| = |X| |Y| |sin &theta|
Where &theta is directed from X to Y.

I say this goes half-way because while it specifies the orientation of &theta, it doesn't give us a nice + or - value we like, though it does have the nice property that it doesn't require a specification of from which way we should look at it.. For many applications where we really need to know the orientation of an angle, the above is all we really need, and there's no reason to go all the way to get + and - values for direction.

To summarize, the reason your formula doesn't tell you whether the angle is positive or negative is because if you just have two vectors, you don't have enough information to even define the meaning of positive or negative angles.

Hurkyl

Last edited:
dr-dock
Originally posted by STAii
I can't help you in the way you are talking about, but i can give you another way to find the exact value of Sin([the]) between two vectors.
(suppose A and B are both vectors in 3D).
A can be written as :
A=A1i+A2j+A3k
(Same for B)
A.B is defined to be |A||B|Cos([the])
A.B=|A||B|Cos([the])
So
Cos([the])=(A.B)/(|A||B|)
You can also derive that (if you wonder how this happened, just ask about it) :
A.B=A1B1+A2B2+A3B3
So
Cos([the])=(A1B1+A2B2+A3B3)/(|A||B|) ------(1)
We also know that Cos([the])2+Sin([the])2=1
So Sin([the])=[squ](1 - Cos([the])2) ----(2)
Put the value of Cos([the]) obtained from (1) into equation (2), and you get Sin([the]).

Is this usefull for you ?
(edited for a typo)
STAii
i think this won't work cause:
sin=(+/-)sqrt(1-sqr(cos))

Enigma
|X| could be >0 or <0.it depends wether the projection of X is on the positive direction or on the negative direction along x-axis.for example |(1,0,0)|>0 on the x-axis while |(-1,0,0)|<0 on the same axis.

with cos it's different cause
X.Y>0 if 0<angle<pi/2 and
X.Y<0 if pi/2<anlge<pi
i'll just have to find a way.

enigma
Staff Emeritus
Gold Member
|X| is defined as positive.

It is the magnitude or norm of X. It is impossible to have a negative magnitude.

|(-1,0,0)| = +sqrt(-1^2+0+0) = +sqrt (1) = 1

EDIT:
for example |(1,0,0)|>0 on the x-axis while |(-1,0,0)|<0 on the same axis

The magnitude is not a vector quantity.

Last edited: