DAILY PRACTICEBuild your AI engineering skills, one problem at a time.Try today's challenge
InferenceAIStart learning path

Mathematics & Statistics · Beginner

Linear algebra intuition

Vectors represent quantities with magnitude and direction; dot products and norms help compare them.

TRY IT YOURSELF

Explore vector similarity

Compare a fixed unit vector with a second unit vector at the angle you choose.

cosine similarity0.707
−1 opposite · 0 perpendicular · +1 aligned

How it works

The dot product adds the products of matching coordinates. Dividing by both vector norms gives cosine similarity, which describes directional alignment for nonzero vectors.

A concrete example

If a = [1, 0] and b = [0, 1], their dot product and cosine similarity are 0: they are perpendicular.

Watch for this

Cosine similarity is undefined for a zero vector. Decide explicitly how your application handles that case.

Try it yourself

Move the angle to 0°, 90°, and 180°. Predict the similarity before checking the display.

Continue to practice →

Read the source: Google: embeddings and similarity ↗

Related concepts

Probability for models →

Statistical inference →

Gradient descent →