Public Group

# Can dot() on two normalized vectors be greater than 1

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

## Recommended Posts

Just want quickly to ask something: Can dot-product of two normalized vectors be greater than 1?

##### Share on other sites
The dot product can be expressed by |A|*|B|*cos(ThetaAB). |A| and |B| are both 1, and cos(ThetaAB) never exceeds 1, so the answer is "no." Of course, this is neglecting rounding error.

##### Share on other sites
No, cosine of pi/2 is 1, thats the maximum distance 2 angles can be apart.

##### Share on other sites
OK, thanks for clarifying this!

##### Share on other sites
If you're asking if your code needs to handle the case that the dot product is greater than 1, then the answer is yes. Floating point error can create situations when such a dot product can occur.

##### Share on other sites
Since you've been given some different answers here, let me reinforce what Rycross and no such user have said, which is that assuming some sort of floating-point representation is being used, the answer to your question is yes. If you want your code to be robust, in most cases you'll need to take this into consideration.

##### Share on other sites
Yes, just to clarify, I was specifying that mathematically it would not come out greater than 1. In practice, you will need to accommodate floating point rounding errors, which may cause the result to be greater than 1.

##### Share on other sites
In case you care about a proof, Wikipedia has one.

1. 1
2. 2
3. 3
frob
20
4. 4
Rutin
18
5. 5

• 32
• 13
• 10
• 9
• 18
• ### Forum Statistics

• Total Topics
632555
• Total Posts
3007061

×