# What is Cosine Similarity? Definition & Technical Mechanics

> **Source:** [SPIDITS AI AI Glossary](https://spidits.com/ai-glossary)  
> **Category:** Mathematical Foundations  
> **Canonical Citation:** [https://spidits.com/ai-glossary/cosine-similarity](https://spidits.com/ai-glossary/cosine-similarity)

## Definition
Cosine Similarity is a mathematical metric used to measure the similarity between two vectors in high-dimensional space by calculating the cosine of the angle between them. It is independent of vector magnitude, focusing purely on direction.

## Architectural Mechanics & Deep Dive
Cosine similarity is a mathematical metric used to measure the similarity between two non-zero vectors in a multi-dimensional space. It measures the cosine of the angle between the vectors, projecting a score from -1 to 1 (or 0 to 1 for non-negative spaces). In AI and search, it is the primary metric for comparing text embeddings, where a score close to 1 indicates highly aligned semantic meaning.

## Industry Applications & Real-World Use Cases
Vector search queries, semantic clustering, and RAG document matching

## Frequently Asked Questions

### What is the range of cosine similarity?
Between -1 and 1. In text embedding searches, the value is typically between 0 (orthogonal, unrelated) and 1 (aligned, identical semantic meaning).

### Why is cosine similarity preferred over Euclidean distance?
Euclidean distance is sensitive to vector length (e.g. document length), whereas cosine similarity measures semantic alignment regardless of length.

## Related Terminology
- [vector-database](https://spidits.com/ai-glossary/vector-database)
- [embedding](https://spidits.com/ai-glossary/embedding)
- [semantic-search](https://spidits.com/ai-glossary/semantic-search)

---
*From the SPIDITS AI Knowledge Base (336+ terms indexed). Explore full technical definitions: [https://spidits.com/ai-glossary](https://spidits.com/ai-glossary)*
