Lemma
math, backwards
the hook · same arrow, four costumes

Why do graphics, physics, and ML all steal the same arrow?

(3,4)(3, 4). 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 are the most-shared piece of mathematics across applications. The tuple is the same. The arithmetic is the same. The role changes, and so does the costume.

In the widget below: one tuple AA, one tuple vv, the result A+cvA + cv. 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.

Widget — Vector roles
point A · (2.0, 1.0)
displacement v · (3.0, 3.0)
A + v · (5.0, 4.0)
A is a location. v is how to move. A + v is where you end up. The most stripped-down reading.
the arc
1

One tuple, several jobs

The notation (3,4)(3, 4) 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 , it’s an instruction: “go three right, four up, from wherever you are.” As a velocity, it’s a rate: three horizontal units per second, four vertical. As a feature vector for a fruit-classifier, it might be (sweetness 3, tartness 4) — coordinates in an abstract feature space with no geometric interpretation at all. The tuple is silent on which one it is.

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.

2

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 (3,4)(3, 4) in one coordinate system and (0,0)(0, 0) in a system whose origin sits at that point. Positions are origin-dependent.

3

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: v=BAv = B − A is the displacement from A to B. Adding a vector to a point gives another point: A+v=BA + v = B. 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)
4

Components: split, work, reassemble

A 2D vector decomposes into x- and y-: v=(vx,vy)=vxx^+vyy^v = (v_x, v_y) = v_x · \hat{x} + v_y · \hat{y}, where x^\hat{x} and y^\hat{y} are the unit vectors along each axis. Adding two vectors is component-wise: (a,b)+(c,d)=(a+c,b+d)(a, b) + (c, d) = (a + c, b + d). Multiplying a vector by a cc stretches each component: c(a,b)=(ca,cb)c · (a, b) = (c·a, c·b).

The decompose-compute-recompose pattern is so universal you stop noticing it. The projectile-motion page splits a launch velocity into (v0cosθ,v0sinθ)(v₀ \cos θ, v₀ \sin θ) and runs each component as a 1D motion. The gradient-descent update writes wηLw − η·∇L 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.
5

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. lerp(A,B,t)=(1t)A+tBlerp(A, B, t) = (1 − t)·A + t·B — one add and two scales. The same primitive that builds Bezier curves.
  • Translation. Move every point of a shape by the same vector vv — replace every coordinate PP with P+vP + v.
  • Linear combination. Any expression of the form c1v1+c2v2+c₁v₁ + c₂v₂ + ⋯. 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 vxx^+vyy^v_x · \hat{x} + v_y · \hat{y}. 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.

6

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.

  • graphicsBezier 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.
  • physicsProjectile motion decomposes a launch velocity into (v0cosθ,v0sinθ)(v₀ \cos θ, v₀ \sin θ) and runs each component independently; why falling stops speeding up sums two opposing force vectors (gravity down, drag up) and reads where they cancel.
  • mlGradient descent is one-line vector subtraction wwηLw ← w − η·∇L 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.
  • financePortfolio risk is the squared-length identity a+b2=a2+b2+2ab|a + b|² = |a|² + |b|² + 2 a · b 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.

exercises · 손으로 풀기
1add by handno calculator

A=(2,1)A = (2, 1), v=(3,4)v = (3, 4). Compute A+vA + v, AvA − v, and 2v2v. 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?”

2decompose a launch velocityno calculator

A ball is thrown at v0=10m/sv₀ = 10 m/s at angle θ=30°θ = 30° above horizontal. Decompose the velocity into (vx,vy)(v_x, v_y) using cos30°=3/20.87\cos 30° = \sqrt{3}/2 ≈ 0.87, sin30°=1/2\sin 30° = 1/2. After 0.4 s of flight (ignoring gravity for this exercise), what’s the displacement vector?

3the tangent vector

On a Bezier curve with control points P0,P1,P2,P3P₀, P₁, P₂, P₃, the tangent at t=0t = 0 points in the direction P1P0P₁ − P₀. Why is that vector — not the position of P1P₁ by itself — the right thing to call the “starting direction”?

4the gradient is a vector

The toy gradient-descent page has one parameter ww and one gradient L(w)L'(w) — both scalars. With two parameters (w1,w2)(w₁, w₂), the loss has two partial derivatives (L/w1,L/w2)(∂L/∂w₁, ∂L/∂w₂). Write the descent step wwηLw ← w − η · ∇L in component form. Which arithmetic from this module are you using?

glossary · used on this page · 5
vector·벡터
A quantity that has both magnitude and direction. Concretely a tuple of numbers — `(3, 4)` in 2D, `(1, 0, −2)` in 3D — but the _meaning_ of those numbers depends on what you're doing. In graphics they describe a control-point offset; in physics, a velocity or force; in ML, a parameter update or a feature representation. The tuple is the same; the _role_ changes. The arithmetic — addition component-wise, scaling by a number — is the same in every role, which is why one set of math serves all of them.
displacement·변위
The vector that takes you from one point to another: `displacement = end − start`. Unlike a position (which depends on where the origin sits), a displacement is _coordinate-free_ in spirit — moving the origin doesn't change the displacement between two points. Velocity is displacement per unit time; force is something that changes velocity (and thus, eventually, displacement). When physicists, graphics designers, and ML engineers all "subtract two points," what they get back is a displacement vector — the same object in three costumes.
component·성분
One coordinate of a vector. The vector `v = (3, 4)` has x-component `3` and y-component `4`. Decomposing a vector into components is just rewriting it as a sum of axis-aligned pieces: `v = 3·x̂ + 4·ŷ`. Components depend on the choice of axes — rotate the coordinate system and the components change, even though the underlying vector hasn't moved. Most calculations split a vector into components, do scalar arithmetic on each, then reassemble.
scalar·스칼라
A single number, distinct from a vector. In `c · v`, `c` is the scalar and `v` is the vector; multiplying a vector by a scalar stretches (or shrinks, or flips) it without changing its direction. Loss values, learning rates, masses, and individual probabilities are scalars; positions, velocities, gradients, and feature embeddings are vectors. The word survives from a time when "scale" meant "stretch by a number" — exactly what scalar multiplication still does.
control point·제어점
One of the handles that defines a Bezier curve. The curve starts at the first control point, ends at the last, and bends toward the inner ones without touching them. Move a control point and only the part of the curve nearest it changes — that _local control_ is the property a designer relies on. The polygon connecting consecutive control points is called the control polygon; it bounds the curve (Bezier curves lie inside the convex hull of their controls) but is never the curve itself.