Jump to content

angle between vectors


h4tt3n

Recommended Posts

In every vector ressource on the net you can read that the dot product of two vectors a and b can be used to find cosine of the angle between them, like this:

 

a.b = lal * lbl * cos angle

 

cos angle = a.b / (lal * lbl)

 

(lal and lbl beeing the magnitude of the vectors)

 

Finding the dot product of a and b is done like this:

 

a.b = (a.x * b.x + a.y * b.y)

 

(a.x, b.y and so forth beeing the horisonal and vertical length of the vectors)

 

What wonders me is that it doesnt say anywhere that

 

(a.x * b.y - a.y * b.x)

 

equals the sine of the angle, which can be a very useful information too.

My question is: what is this function called? It surely isn't the dot product, but I can't seem to find anything about it anywhere.

 

best regards,

Michael

Link to comment
Share on other sites

The CROSS PRODUCT of two vectors u x v is defined as the vector with length |u||v|sin(angle) pointing in the direction perpendicular to both u and v, in the "right hand rule" direction (Curl the fingers of your right hand from u to v. The direction your thumb points is the direction of the product vector.)

 

Strictly speaking the cross product is only defined for 3 dimensional vectors, but the cross product of the two vectors <ax, ay, 0> and <bx, by, 0> is the vector with length axby- aybx pointing along the z-axis.

 

The length of the cross product of vectors u and v is, also, the area of a parallelogram having vectors u and v as adjacent sides (even in 3 dimensions). The "triple product" u.(v x w) is the area of a parallelopiped having vector u, v, and w meeting in one vertex.

Link to comment
Share on other sites

On a sidenote (the term cross-product was already mentioned - I'll spare you of more formal terms that I'm not too familiar with, myself): The sine-term has an important disadvantage: Assume I use the proposed method and come up with sin(angle) = 0. What's the value of angle? You just don't know - and since I'm >:D I let you figure out the "why", yourself. The value of 0 was just an arbitrary choice, in fact one where you immediately see the result for angle. But I could as well have picked 0.623, where the result is not so obvious, anymore.

 

EDIT: I'll give you some time to think about my comment some more (or not) and post the solution later - tomorrow. It's not a big thing anyways. It's just a very suggestive pitfall that you already stepped into and that you'll hopefully remember (and avoid from thereon) after having seen what I meant.

Link to comment
Share on other sites

ad HallsofIvy: Well, ok. I just supposed that the term "cross product" was out of the question since, as you say, it is only used for three dimensional vectors.

 

would this qualify as a "2d cross product", then? Any other suggestions out there?

 

ad Atheist:

 

Ok, I don't get it. I'd just say Asin(Sine to angle) = angle, in this case 0. Anyway I dont actually need to know the angle - cosine and sine will do just fine for me ^^.

Link to comment
Share on other sites

Other suggestions would be "Volume-form" (a volume in 2D is an area) or "determinant". But I think it's best thinking of it in the way HallsofIvy suggested, by extending your R² to R³ in your mind and taking the cross-product (which then gives the signed area of the parallelogram spanned by the two vectors).

Link to comment
Share on other sites

The sine-term has an important disadvantage: Assume I use the proposed method and come up with sin(angle) = 0. What's the value of angle? You just don't know - and since I'm >:D I let you figure out the "why", yourself.

 

Stop being so obtuse, Atheist.

Link to comment
Share on other sites

k, my earlier point was actually pretty simple:

- The (undirected) angle between two vectors is in the range between 0° and 180°. The cosine of the angle assignes a unique value to each of these numbers, meaning that if cos(a) = cos(b) (for a and b being in the range mentioned), you know that a=b. Or in other words: If you know the cosine of the angle, you also know the angle. This is not true for the sine. The example sin(angle)=0 I mentioned of course is solved by angle=0 (both vectors pointing in the same direction). But: It's also solved by angle=180° (i.e. both vectors pointing in opposite directions). That's a completely different scenario and from the sine alone you cannot tell which of the two cases actually is true.

Or in short: You cannot deduce the angle between two vectors from its sine.

Link to comment
Share on other sites

Are you sure? cos(0) = 1, what's cos(180)?

 

Working in radians I find that [math]\cos(0) = \cos(\pi) = \cos(2\pi) =1[/math]. Likewise [math]\cos(\tfrac{\pi}{2}) = \cos(\tfrac{3}{2}\pi) = 0[/math], surely?

 

More generally, for all x, sin(x) and cos(x) are in [0,1]. Setting arcsin as the inverse sine function, likewise arccos, as I recall it is convention to set [math]\arcsin(\sin(x)) \in [-\tfrac{\pi}{2},\tfrac{\pi}{2}][/math] and [math]\arccos(\cos(x)) \in [0,\pi][/math].

 

These are called the "principle values" of arcsin and arccos, respectively.

 

I'm way, way rusty on trig, but this as I rememeber it.

Link to comment
Share on other sites

Woops! yes, you are right, silly me. But this doesn't alter the general truth of the rest of my post, I believe (your PNG doesn't show it): for arbitrary x, the values of sin(x) and cos(x) cannot be used to recover x unless one restricts the codomain of arcsin and arccos in the way I suggested.

 

Which is all totally irrelevant to the present thread. Ignore me.

Link to comment
Share on other sites

Woops! yes, you are right, silly me. But this doesn't alter the general truth of the rest of my post,...

Let's just say that ...

Working in radians I find that [math]\cos(0) = \cos(\pi) = \cos(2\pi) =1[/math].

...is wrong, too. That's of course the same error I mentioned in my previous post.

I believe (your PNG doesn't show it): for arbitrary x, the values of sin(x) and cos(x) cannot be used to recover x unless one restricts the codomain of arcsin and arccos in the way I suggested.

Your statement about the ranges of arcsin and arccos are probably true (too lazy checking for canonic definitions). Your statement that for arbitrary real-valued x, neither sin(x) nor cos(x) can be used to recover x definitely is true.

But the point is: The range on my plot is not arbitrary but chosen for a reason. We are talking about the (undirected, i.e. no vector is chosen as reference) angle between two vectors. This angle is in [0°,180°], i.e. not an arbitrary real value. Cosine maps this range in an invertible way (meaning that from the value of the cosine you can extract the angle), sine does not.

 

Which is all totally irrelevant to the present thread. Ignore me.

It's for Hatten do descide the relevance. What he said is that the scalar product can be used to find the cosine of the angle and that there is a way to easily get the sine of the angle (the cross-product style version). That's both true and the topic as such is pretty much covered with that. What I said is merely a remark on the usability of the sine and the cosine: The cosine can be used to obtain the angle, the sine can't. Personally I think the original question is already answered, so I don't restrain from discussing points beyond the original question (Hatten may complain if I'm wrong).

Link to comment
Share on other sites

Dammit, man! I've admitted my errors, what more do you want? My wallet? My wife?

I'm simply trying to clear up points that seemingly were unclear. I skip the wallet, so just post a picture of your wife.

 

Who is Hatten, by the way?

The guy who started the thread. There's a pseudo-language called "l33t" (english translation: "leet"). "Hatten" is the english translation of the l33t-name "h4tt3n".

Link to comment
Share on other sites

Stop being so obtuse, Atheist.[/quote']k, my earlier point was actually pretty simple: ... or in short: You cannot deduce the angle between two vectors from its sine.

 

I guess I should have used a smiley on my obtuse obtuse comment. An obtuse angle is one greater than [math]180^{\circ}[/math].

Link to comment
Share on other sites

- I didn't quote you. I didn't reply to your post at all, I kept the promise/threat that I "post the solution later - tomorrow". Up to a few seconds ago I thought I understood your comment/pun (although I had to use an online-dictionary to look up the term "obtuse"), but...

- My dictionary disagrees with your definition of an obtuse angle: It claims it's an angle 90°<angle<180°, not >180° (which my dictionary claims to be called "reflex angle").

 

Keiner versteht mich :-(!

Link to comment
Share on other sites

I'm brain dead. Too much proposal work over the last week. The definition of obtuse is correct, and that definition is exactly what I meant when I made my obtuse comment. The problem with the sine function is that [math]\sin \theta = \sin(\pi-\theta)[/math]. For example, given only the sine of the angle between two lines is [math]1/\surd 2[/math], there is no way to tell if the angle is 45 degrees or 135.

Link to comment
Share on other sites

ad HallsofIvy: Well, ok. I just supposed that the term "cross product" was out of the question since, as you say, it is only used for three dimensional vectors.

 

would this qualify as a "2d cross product", then? Any other suggestions out there?

I said: "Strictly speaking the cross product is only defined for 3 dimensional vectors, but the cross product of the two vectors <ax, ay, 0> and

<bx, by, 0> is the vector with length axby- aybx pointing along the z-axis." In other words, that is routinely used as the LENGTH of the cross product of two vectors in the xy-plane. As I said, the true cross product would point along the z-axis, in the positive or negative direction depending on the order of the terms- the cross product is ANTI-commutative.

 

ad Atheist:

 

Ok, I don't get it. I'd just say Asin(Sine to angle) = angle, in this case 0. Anyway I dont actually need to know the angle - cosine and sine will do just fine for me ^^.

 

Atheist wasn't talking about the angle between the two vectors, he was talking about the direction of their cross product. If the angle between two vectors is 0, since sin(0)= 0, their cross product is the 0 vector. It has NO direction.

Link to comment
Share on other sites

Atheist wasn't talking about the angle between the two vectors, he was talking about the direction of their cross product. If the angle between two vectors is 0, since sin(0)= 0, their cross product is the 0 vector. It has NO direction.

I wasn't talking about anything cross-product related, I was talking about the angle between two vectors in R².

Link to comment
Share on other sites

Yeah, sorry, I just skipped over this:

You cannot deduce the angle between two vectors from its sine.

Well, if you include the direction, i.e. distinguish between "parallel" (same direction, angle 0) or "anti-parallel" (opposite directions, angle pi) you can't. Of course that is true of the cosine as well. If two vectors have cosine of the angle between them, AND YOU INCLUDE "DIRECTION" WITH "ANGLE" we could not tell whether the anglee between them is pi/2 or 3pi/2. You need both sine and cosine to decide exactly what the angle and directions are.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.