Inner Products
Analytic Geometry
An inner product langle cdot, cdot rangle : V times V to mathbb{R} is a function that eats two vectors and returns a scalar, satisfying three properties: symmetry (langle mathbf{u}, mathbf{v}rangle = langle mathbf{v}, mathbf{u}rangle), linearity in each argument, and positive definiteness (langle ma
An inner product generalizes the dot product: symmetric, bilinear, positive definite.
No inner product, no cosine similarity, no kernel trick, no attention. Transformers literally compute softmax( Q K^T / √d ) · V — a matrix of inner products.
An inner product is a function that eats two vectors and returns a scalar, satisfying three properties: symmetry (), linearity in each argument, and positive definiteness (, with equality iff ). The most familiar example is the dot product: .
Every inner product induces a norm via . In with the standard dot product, this gives the familiar Euclidean norm. But we can build *weighted* inner products too: for any symmetric positive definite matrix . Different s produce different geometries on the same vector space.
A profound consequence of the axioms is the Cauchy–Schwarz inequality: , with equality iff the two vectors are parallel. This single inequality powers countless proofs — the triangle inequality falls out of it, as does the definition of the angle between vectors.
Inner products go far beyond . On the space of continuous functions on , the integral is an inner product. This is the foundation of Fourier analysis: the sine and cosine functions are *orthogonal* under this product, so expressing a signal as a sum of them is the analog of expressing a vector in an orthogonal basis.
Worked example — dot product: . Positive, so the vectors point in a generally similar direction (angle < 90°).
Compute $\langle (1,2,3), (4,-1,2) \rangle$ — element by element
- 1Standard inner product: pair up, multiply, sum.
- 2Multiply each pair.
- 3Reduce each product.
- 4Sum — positive, so the vectors generally agree (angle < 90°).
Worked example — verifying bilinearity: Take , , . Check , and ✓. The inner product distributes over addition.
In ML, inner products are the atom of similarity. Cosine similarity measures how aligned two vectors are regardless of magnitude — central to word embeddings and retrieval. Kernel methods (like the kernel trick in SVMs) replace the standard dot product with where implicitly maps data into a higher-dimensional feature space, never computing directly.
Exercises
Put your understanding to the test. Score + streak + speed all count.
Confirm you've got it
3 quick questions. Get 2 right to mark this lesson complete.