Bring the mental model from Vector Spaces; this page will reuse it instead of restarting from zero.
Dot Product
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
The dot product answers the question: “How much does one vector point in the direction of another?”
- If two arrows are aligned, the dot product is large and positive.
- If they’re perpendicular, it’s zero.
- If they point in opposite directions, it’s negative.
In ML, this becomes a similarity score (cosine similarity) and the core operation behind attention: queries and keys are compared using dot products.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
Let u,v∈Rn, with coordinates
The dot product is the coordinate-wise multiply-and-sum operation
This definition is algebraic, but it is designed to preserve geometry. The squared length of a vector is
so ∥u∥=u⋅u. If θ is the angle between two nonzero vectors, the same operation satisfies
You can read this as:
That ratio is cosine similarity. It removes the lengths and keeps only direction, which is why embeddings often use it as a normalized similarity score.
That immediately gives:
- Orthogonality: u⊥v⟺u⋅v=0.
- Alignment: u⋅v>0 means the angle is acute, while u⋅v<0 means the angle is obtuse.
- Scaling: (au)⋅v=a(u⋅v), so making one vector twice as long doubles the score.
- Projection: the component of u along v is
The scalar v⋅vu⋅v says how many copies of v fit inside the part of u that points along v. The leftover
is perpendicular to v, because
In attention, this same operation appears as q⋅k: a query vector receives a larger score when it points in a similar direction to a key vector.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
u = np.array([2.0, 1.0])
v = np.array([-1.0, 2.0])
dot = float(u @ v)
nu = float(np.linalg.norm(u))
nv = float(np.linalg.norm(v))
cos = dot / (nu * nv)
proj_u_on_v = (dot / float(v @ v)) * v
print("u·v =", dot)
print("cos(theta) =", cos)
print("proj_v(u) =", proj_u_on_v)
print("perp component =", u - proj_u_on_v)
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
Live Concept Demo
Explore Dot Product
The stage is code-native and interactive. Use it to test the explanation against the mechanism.
Manipulate one control and predict the visible change.
Choose what to inspect in Dot Product. This shared fallback is an observation guide, not evidence of learning.
Drag u and v, then predict whether the signed projection of u along v points with v, nearly vanishes, or points against v. Reveal after committing to connect that signed projection with the signs of u⋅v and cosθ.
Copy-only prompts — each action copies a page-grounded prompt to your clipboard. Nothing is sent by this site.
Concept: Dot Product
What is the smallest example that makes Dot Product click without losing the math?
Object contextLinear Algebra
concept:linear-algebra/dot-productDot Product
What is the smallest example that makes Dot Product click without losing the math?
Start with the prediction checkpoint, then compare the reveal to the mental model.
Take this moveStudy modes
Keep the object fixed; change the lens.Route back through the notebook
Carry the same object through intuition, math, code, and demo.
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.
The next edge should feel earned: use the demo prediction here before following Scaled Dot-Product Attention & Transformer Layers.
After The First Pass
Turn the concept into an inspected object.
The lower panels are one second act: keep the object fixed, inspect it visually, check source boundaries, practice transfer, then attach the research question.Mechanism Storyboard
See the idea move before the page explains it
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.

Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Dot Product should make visible.
Visual Inquiry
Make the image answer a mathematical question
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.
Which visible object should carry the first intuition?
Pick the cue that should make Dot Product easier to reason about before the page gives the answer.
Source Grounding
Canonical references for the mechanism on this page.
What is the smallest example that makes Dot Product click without losing the math?
concept:linear-algebra/dot-productsources: deisenroth-2020-mml
Open the closest source note before trusting the local explanation.
1 selected-object source shown first; 1 reference total.
Audit the claim boundary, then ask from the same selected object.
Grounds inner products, vector geometry, and the linear algebra notation reused across attention and optimization.
MML introduces inner products as algebraic operations with induced norms, angles, orthogonality, and projections; the page's formulas and demo instantiate those relationships in 2D and co...
Applies to finite-dimensional real vectors with v != 0, and to angle/cosine only when both vectors are nonzero. Dot-product magnitude still includes vector lengths; cosine normalizes dire...
Claim Review
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.
What is the smallest example that makes Dot Product click without losing the math?
concept:linear-algebra/dot-productsources: deisenroth-2020-mml
Treat every claim as provisional until source support and a local witness agree.
1 structured claim check on this concept.
Run the prediction or practice transfer before asking for a grounded review.
Publisher-side editorial review is not independent replication. Claims without it still need exact source-support review. 1 reference and 3 local witnesses are available for inspection.
MML introduces inner products as algebraic operations with induced norms, angles, orthogonality, and projections; the page's formulas and demo instantiate those relationships in 2D and connect normalized dot...
Applies to finite-dimensional real vectors with v != 0, and to angle/cosine only when both vectors are nonzero. Dot-product magnitude still includes vector lengths; cosine normalizes direction only. Excludes...
MML substantively supports the claim: it defines the R^n dot product as x^T y=sum_i x_i y_i, uses inner products to induce norms/angles/orthogonality, defines cos omega=<x,y>/(||x||||y||), and derives projection onto span(b) as (<x,b>/<b,b>)b. With the dot product this is proj_v(u)=(u dot v)/(v dot v)v; local math/code/demo match.
Reviewer: codex+oracle; reviewed 2026-05-07Practice notebook
Use the idea, then test it somewhere new
The dot product measures alignment: it connects angles, lengths, and projections, and underlies cosine similarity in ML.
What is the smallest example that makes Dot Product click without losing the math?
concept:linear-algebra/dot-productsources: deisenroth-2020-mml
Use one state from Dot Product to explain what changes, why it changes, and which assumption the explanation needs.
No learner move yet; no learning state is inferred.
Write first, use only the help you need, then try a new case without it.
Use one state from Dot Product to explain what changes, why it changes, and which assumption the explanation needs.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Write an attempt before asking the companion.
0 of 3 progressive hints opened.
This draft and any AI response do not establish mastery; a later unassisted case can.
- ObjectConceptDot Product
- PredictBefore revealDot Product prediction
- WitnessCompare codeDot Product code witness 1
- RoomAsk groundedChecking local snapshot
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Dot Product
What is the smallest example that makes Dot Product click without losing the math?
These are fixed, deterministic perspectives derived from the selected object. They do not represent people, community contributions, or independent review.
Source ids deisenroth-2020-mml must support the exact object, not just the surrounding topic.
Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion.
Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo.
The learner can state the mechanism in their own words
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:linear-algebra/dot-product.
- Source ids to inspect: deisenroth-2020-mml
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Dot Product Object key: concept:linear-algebra/dot-product Context: Linear Algebra Anchor id: concept/concept-notebook/linear-algebra/dot-product Open question: What is the smallest example that makes Dot Product click without losing the math? Evidence to inspect: - Source ids to inspect: deisenroth-2020-mml - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan Deterministic role lenses for this object: - Boundary: fixed perspectives, not people, community contributions, or independent review - Source-checking summary: Treat this as a mechanism object: connect the definition to one equation, code witness, or demo before broadening the discussion. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Teach/transfer move: Turn the mechanism into one sentence that predicts a neighboring concept. - Assumptions: - Source ids deisenroth-2020-mml must support the exact object, not just the surrounding topic. - The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. - The concept explanation is local atlas prose until checked against its math, code, and source support. - Prerequisite gaps should become a repair route, not a reason to leave the object vague. - Role-lens requests: - Learner: ask for "Ask what would make "Dot Product" feel predictable rather than familiar." | assumption: Source ids deisenroth-2020-mml must support the exact object, not just the surrounding topic. | next action: The learner can state the mechanism in their own words - Researcher: ask for "Source ids to inspect: deisenroth-2020-mml" | assumption: The stable content-object key lets local drafts, prompts, and route memory attach without changing the source page. | next action: The learner can name the prerequisite that would repair confusion - Experimenter: ask for "Choose one variable or condition to perturb before asking for an explanation." | assumption: The concept explanation is local atlas prose until checked against its math, code, and source support. | next action: The learner can predict how the mechanism changes under one perturbation - Professor: ask for "Find the smallest transferable rule a learner could reuse without the AI." | assumption: Prerequisite gaps should become a repair route, not a reason to leave the object vague. | next action: Teach or transfer: Turn the mechanism into one sentence that predicts a neighboring concept. What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action. Current deterministic role lens for this object: - Role lens: Learner - Evidence request: Ask what would make "Dot Product" feel predictable rather than familiar. - Assumption to keep visible: Source ids deisenroth-2020-mml must support the exact object, not just the surrounding topic. - Proposed experiment: Ask the learner to perturb one representation, then check whether the same invariant survives in math, code, and demo. - Next action: The learner can state the mechanism in their own words
concept/concept-notebook/linear-algebra/dot-product
concept:linear-algebra/dot-product