Sign in to follow this  

Dot product

This topic is 4023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I always thought the dot product was just some weird number that related to angles between two vectors, but what does the dot product mean? My teacher talks about it all the time like it's supposed to be the length of projection or something. So the red part is what I'm thinking the dot product is giving (not the vector but the length of the vector). But even if this is true, in the upper right case, if I drew the red line on the top vector, the length of projection doesn't look like it could be 2.

Share this post


Link to post
Share on other sites
The length of the projection is given in units based on the length of the vector being projected onto.

In the two upper cases, the vector being projected onto are both of length 1, so a dot product of 2 means the projected vector's length is 2/1=1. In the bottom case, the length of the vector projected onto is 2. The dot product is also 2, and the length of the projection is 2/2=1.

So a longer vector you project onto, the larger the dot product. But to get the length, you have to divide by it's length.

Share this post


Link to post
Share on other sites
The length of the red line in the bottom left picture doesn't match the magnitude of the dot product for its vectors.

The dot product of a vector with a unit vector gives the length of the projection of the vector onto the unit vector. To get the projection onto a non-unit vector, you must divide by the magnitude of the non-unit vector.

The dot product is closely related to angles. The cosine of the angle between two vectors can be defined as the ratio of the dot product of the vectors to the product of their magnitudes. A dot B / |A|*|B|

These different interpretations of the dot product are consistent with each other.

Share this post


Link to post
Share on other sites
Your current assumption is pretty much correct. I personally think of it as 'how close are these two normalized vectors pointing in the same direction?'

Normalized simply means that the vector has been dilated/contracted so that its length is 1. Of course, it still points in the same direction as its non-normalized form. To normalize a vector, we calculate its length and then divide each of its components by this value. If the length of the vector is 1, then it is already normalized. In some crowds, they call this a unit vector to denote that its length is 'of unity'.

A dot product of -1 reveals that they are pointing in the completely opposite direction, and a dot product of 1 reveals that they are pointing in the same direction (they are technically the same vector). If the dot product is 0, then they are perpendicular.

The following example vectors are already normalized:

A = -1,0
B = 1,0
Dot product = -1*1 + 0*0 = -1 + 0 = -1

A = 1,0
B = 1,0
Dot product = 1*1 + 0*0 = 1 + 0 = 1

A = 1,0
B = 0,1
Dot product = 1*0 + 0*1 = 0 + 0 = 0


In demonstration, for your first case:

A = 1,1
B = 1,0

Step 1, Calculate the vector lengths:
Length of A = Square root of dot product of A and itself = sqrt(1*1 + 1*1) = sqrt(2) = 1.4142135623730950488016887242097
Length of B = sqrt(1*1 + 0*0) = sqrt(1) = 1

Step 2, Normalize the vectors:
A normalized = 1/1.414213,1/1.414213 = 0.707106,0.707106
B normalized = 1/1,0/1 = 1,0 (we see now that it was already normalized, since it has not changed)

Step 3, Calculate the dot product as usual using these normalized vectors:
Dot product = 0.707106*1 + 0.707106*0 = 0.707106


When dealing with normalized vectors like this, the dot product is always the cosine of the angle between them. So, to find the angle between 1,1 and 1,0, you would use arccos(0.707106).

This stands to reason, since cos(180) gives us -1, cos(0) is 1, and cos(90) is 0, as described in paragraph 3.

If ever the process to calculate the length of a vector seems strange, just remember the Pythagorean Theorem where c*c = a*a + b*b for a right triangle.

WARNING: If you do not normalize the vectors beforehand, funny things happen and you may very well throw the Earth off its rotational axis, spinning us into either deep space or the fiery depths of the sun. :)

[Edited by - taby on December 11, 2006 4:12:07 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by dpadam450
Ok so in the bottom left picture if I project the opposite way the length of (2,0)*(1,1) would be 2/ (1/radical(2) )? or the dot product divided by the lenght of vector (1,1)

The dot product of a unit vector IS the cosine which IS the projection of the vector lying on the x axis; if you look at it, the ratio of that projection and the hypotenuse (the top vector in this case) is the very definition of cosine.

Calling the top vector in each of your diagrams 'u' and the bottom vector 'v', the dot product is also |u|* |v|* cos theta. And the length of the projection assuming u is not a unit vector will be |u| cos theta. So the length of the projection is also given by the dot product divided by the length of v ( |v| ).

But all of this is just different calculations based on the definition of cosine, which is very clearly represented by the ratio of the lengths of the 'projected' vector and the original (top) vector in your diagrams.

Share this post


Link to post
Share on other sites

This topic is 4023 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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

Sign in to follow this