Start studying
Module 2 · Maths for Data Module contents
Module 2  ·  Card 6 / 13intermediate

Dot Product

The dot product multiplies matching components of two vectors together and sums those individual products into a single number.

It produces a scalar output from two vector inputs, which is why mathematicians also call it the scalar product.

For example, the dot product of two-element vectors [1, 2] and [3, 4] is three plus eight, which equals eleven.

Geometrically, it measures the extent to which two vectors point in the same direction, scaled by their lengths.

If two non-zero vectors are perpendicular, their dot product is zero, making it a test for geometric orthogonality.

Learn in depth ↓
Module 02 · Maths for Data · 13 concepts
In depth  /  15 lines

Dot Product, in more detail

The dot product is one of the most widely used algebraic operations in scientific computing and data science.

It takes two vectors of equal dimensionality and combines their paired elements into a single real scalar number.

The algebraic definition sums the product of corresponding components from the first dimension to the last.

The geometric definition states that the dot product equals the length of vector u times the length of v times the cosine of the angle between them.

When two vectors point in identical directions, the cosine of zero is one, maximising the resulting dot product.

When two vectors are perpendicular, the angle between them is ninety degrees and its cosine is exactly zero.

Therefore, a dot product of zero between non-zero vectors proves that they are orthogonal to each other.

When the angle between two vectors is obtuse, their dot product yields a negative scalar value.

Normalising both vectors to have a length of one before computing their dot product produces cosine similarity.

Cosine similarity evaluates directional alignment while completely ignoring differences in vector magnitudes.

In machine learning and search algorithms, dot products calculate weighted sums and measure document similarities.

A common beginner error is expecting the dot product of two vectors to return another vector.

The dot product always evaluates to a single scalar number, distinct from element-wise vector products.

Another frequent trap is trying to calculate the dot product between vectors of differing dimensionality.

Computing dot products efficiently across millions of vectors is a core capability of modern numerical computing libraries.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
Two non-zero feature vectors have a dot product equal to zero. What does this indicate about their geometric relationship?
Maths for Data

13 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close