# What is Cosine Similarity?

Cosine similarity is a measure of similarity between two non-zero vectors of an inner product space that measures the cosine of the angle between them. Two vectors with the same orientation have a cosine similarity of $1$, two vectors at $90°$ have a similarity of $0$, and two vectors diametrically opposed have a similarity of $-1$, independent of their magnitude.

The formula for cosine similarity is:

$$\text{Cosine similarity} = (\text{Dot product of two vectors}) / (\text{Product of Euclidean lengths of two vectors})$$

Cosine similarity is a commonly used measure in information retrieval and text mining, where it is often used to measure the similarity of documents. It is also used in collaborative filtering, where it is used to measure the similarity of users or items.

Next Chapter:

What is Inductive Learning?