Why do graphics, physics, and ML all steal the same arrow?
. Is that a point on a screen, an arrow showing how to move, a velocity, or
a feature representation of an apple? It depends on what you’re doing — and that is the whole reason
In the widget below: one tuple , one tuple , the result . Click the role buttons — generic, graphics, physics, ml — and the labels change without the picture changing. The picture can’t change; only the story you tell about it can.
One tuple, several jobs
The notation is a finger pointing somewhere — but it can point at very different things. As a position on a 2D plane, it’s the point three units right and four up. As a
The same ambiguity is what makes vectors useful. Every application that wants to talk about “two-or-more-numbers-bundled-together-and-treated-as-one” inherits the same tools — a single arithmetic, a single set of identities — and the application’s job is to interpret the bundle in its specific way.
Point: where
When the role is “location,” the tuple is an address in space. It answers where, not how to move. A position changes when you choose a different origin — the very same physical point becomes in one coordinate system and in a system whose origin sits at that point. Positions are origin-dependent.
Vector: how to move
When the role is “displacement,” the tuple is a recipe for motion: from wherever you are, change your x by 3 and your y by 4. Crucially, this is origin-free — moving the coordinate system’s origin doesn’t change the displacement between two points. That is why the projectile-motion equations and the gradient-descent update equation look the same regardless of where you place your axes.
Subtracting two points gives a vector: is the displacement from A to B. Adding a vector to a point gives another point: . Two points and one vector live in the same picture, but only the vector is dimension-of-direction.
# A vector is a tuple. Component-wise addition. Scalar multiplication.
# That's the whole arithmetic — every role uses these two operations.
def add(u, v):
return tuple(a + b for a, b in zip(u, v))
def scale(c, v):
return tuple(c * a for a in v)
A = (2, 1)
v = (3, 4)
add(A, v) # → (5, 5) (location → location)
scale(2, v) # → (6, 8) (twice the displacement)
scale(-1, v) # → (-3, -4) (the reverse)
add(A, scale(-1, v)) # → (-1, -3) (going backward from A)Components: split, work, reassemble
A 2D vector decomposes into x- and y-
The decompose-compute-recompose pattern is so universal you stop noticing it. The projectile-motion page splits a launch velocity into and runs each component as a 1D motion. The gradient-descent update writes as a vector subtraction, but every real implementation does it component-wise on the underlying array. Components are how vector arithmetic becomes scalar arithmetic in software.
# Same arithmetic, four roles. The tuple is the same; the application slot
# is what gives it meaning.
# graphics: shift one Bezier control point by v.
control = (200, 60)
new_control = add(control, v) # the curve translates with it.
# physics: a position-and-velocity update.
pos = (0.0, 0.0)
vel = (10.0, 14.0) # m/s
dt = 0.05 # s
new_pos = add(pos, scale(dt, vel)) # one Euler step.
# ML: one gradient-descent step on a 2-parameter weight vector.
weights = (0.0, 0.0)
grad = (-2.4, -1.8) # ∇L at current weights
lr = 0.1
new_weights = add(weights, scale(-lr, grad))
# In every block: add(point, scale(c, vector)). Same six characters of math.Two operations, no exceptions
Vector arithmetic has only two operations: add two vectors, scale one by a number. Together they describe everything called a “linear” operation in this entire stack of math. From these two you can build:
- Linear interpolation. — one add and two scales. The same primitive that builds Bezier curves.
- Translation. Move every point of a shape by the same vector — replace every coordinate with .
- Linear combination. Any expression of the form . Convex combinations (where all coefficients sum to 1) are how the Bezier widget collapses control points layer by layer.
- Decomposition into bases. Any vector in a 2D plane is . Choose a different basis and the components change without changing the vector — exactly the situation arc 6 of the projectile-motion page hints at when it discusses the independence of horizontal and vertical motion.
The promise: any quantity that admits component-wise addition and scalar scaling can use this entire toolkit. Numbers, points, colors, sounds, function spaces, neural-network parameters — all of them count. The tuple’s silence on role is what lets the toolkit travel.
Where this shows up — one object, four faces
A vector is not “an arrow.” It is a thing you can add and scale. The face changes by pillar; the arithmetic doesn’t.
graphics : coordinates, directions, control points physics : position, velocity, force ml : feature vectors, embeddings, gradients finance : portfolio weights, returns, risk directions
Every Lemma application that ships consumes vectors as one of those four faces. The widget’s role toggle is the four-line table above made interactive — each toggle corresponds to a live application doing exactly that arithmetic.
- graphics — Bezier curves treat
as positions and use convex combinations of them; why JPEG throws pixels away reinterprets an 8×8 pixel block as a single 64-dimensional vector and changes its basis.control points - physics — Projectile motion decomposes a launch velocity into and runs each component independently; why falling stops speeding up sums two opposing force vectors (gravity down, drag up) and reads where they cancel.
- ml — Gradient descent is one-line vector subtraction with the parameter, gradient, and step all vectors; TF-IDF represents each document as a high-dimensional weight vector and ranks queries by cosine of the angle between vectors.
- finance — Portfolio risk is the squared-length identity reapplied: covariance is a dot product on returns, correlation is the cosine, and the cross-term is what makes a mix of risky assets less risky than either alone.
Same operation, different nouns. If you can add two of them and scale one of them, the vector machinery has already started.
The tuple is silent on role. Add component-wise. Scale by a number. The arithmetic stays the same; what changes is the costume the application gives the answer.
, . Compute , , and . Sketch all three on graph paper and explain in one sentence why the first answers “where do I end up?”, the second “where did I come from?”, and the third “what if my step is twice as long?”
A ball is thrown at at angle above horizontal. Decompose the velocity into using , . After 0.4 s of flight (ignoring gravity for this exercise), what’s the displacement vector?
On a Bezier curve with control points , the tangent at points in the direction . Why is that vector — not the position of by itself — the right thing to call the “starting direction”?
The toy gradient-descent page has one parameter and one gradient — both scalars. With two parameters , the loss has two partial derivatives . Write the descent step in component form. Which arithmetic from this module are you using?