Zaratruta
Zaratruta

Reputation: 2285

Difference between two vectors

How can I measure the difference/similarity of two vectors?

That is...Let us suppose that I have two vectors in R^3: v1 = {1,8,3} v2 = {2,5,10} Let us consider that v1 and v2 are representing directions.

I would like to measure how much v1 and v2 are pointing to the same direction.

Upvotes: 0

Views: 3569

Answers (1)

Peter Olson
Peter Olson

Reputation: 142977

There are a number of different "similarity" measures between vectors, but one of the more popular ones is cosine similarity, i.e. the cosine of the angle between them.

This measure is convenient because it will give a number between -1 and 1, where 0 means that the vectors are perpendicular, 1 means that the vectors point in exactly the same direction, and -1 means that the vectors are diametrically opposed.

enter image description here

Upvotes: 1

Related Questions