The cosine similarity of two nonzero real vectors and
is the cosine of the angle between
them,
It is invariant under positive rescaling of either vector. Its value lies in , and for vectors with nonnegative
components it lies in
.
The quantity
is often called cosine distance, although it does not in general satisfy the triangle
inequality.