Symbolic visualization of proj_v u = ((u · v) / ‖v‖²) · v — dot, square, divide, scale — and the perpendicular remainder u − proj_v u.
Scenario?The projection of u onto v is the part of u that points along v: the vector c·v with c = (u·v)/‖v‖². Its length is |u·v|/‖v‖, the scalar projection. What is left over, u − c·v, is perpendicular to v, so u splits into a piece along v and a piece at right angles to it. Both vectors must have the same length, and v must be non-zero.
Vector length (shared by u and v)
u, vlength3
u1×3
u1
u2
u3
·
v1×3
v1
v2
v3
→
u · v
?
Step 1 / 14
Step explanations
1Projection of u onto v, and the perpendicular remainder
u and v both have length 3. The projection of u onto v is the part of u that points along v: projv u = c · v with c = (u · v) / ‖v‖². The run computes u · v, then ‖v‖², then the coefficient c, then scales v by c, and finally subtracts the projection from u to expose the remainder, which is perpendicular to v.
Vector projection — the part of u that points along v: projvu=∥v∥2u⋅vv.
Scalar projection — the signed length of that part: compvu=∥v∥u⋅v.
Projection coefficient — the scalar c=∥v∥2u⋅v that multiplies v; it counts how many copies of v reach the foot of the perpendicular.
Remainder — u−projvu, the part of u perpendicular to v; also called the orthogonal component or rejection.
Orthogonal decomposition — the split u=projvu+(u−projvu) into a piece along v and a piece at right angles to it.
Foot of the perpendicular — the point on the line through v closest to the tip of u; the projection is the vector from the origin to that point.
Same-length requirement — u and v must have the same number of components, and v must be non-zero.
Getting Started with the Visualizer
Set the shared length of u and v, pick a scenario, then watch the projection build phase by phase.
• Use the Scenario pills to choose Projection only, which stops at projvu, or Projection and remainder, which continues to the perpendicular part and the full decomposition of u • Use the Dimensions stepper to set the length of u and v (1 to 5 components) • Hover the ? icon for a reminder of what the projection is and why the remainder is perpendicular to v • Press play or step manually through the scene player; the speed selector and step log let you control pace and review • Everything is symbolic — the coefficient is shown as c once it has been defined, so the later phases stay readable
The Six Phases
The visualizer breaks the projection into six phases, each a single idea.
• Phase 1 — pair: ui is paired with vi, one component per scene, and the running sum u1v1+u2v2+⋯ grows in the caption • Phase 2 — dot product: the u⋅v slot fills • Phase 3 — squared length: ∥v∥2=v⋅v fills its slot, in one scene • Phase 4 — coefficient: c=(u⋅v)/∥v∥2 fills • Phase 5 — scale: each component of v is multiplied by c, one per scene, filling projvu • Phase 6 — remainder: each component of the projection is subtracted from u, one per scene, filling u−projvu; this phase runs only in the decomposition scenario
The layout changes between phases because the inputs change: the dot product and squared length become inputs to the coefficient, the coefficient becomes an input to the scaling, and the projection becomes an input to the remainder.
The Opening Scene: Two Vectors and a Dot Product to Come
The player opens with u and v as rows of components and an empty slot for u⋅v. At the default length both have three components.
Nothing is computed yet. What the scene fixes is the plan: the projection is built from two dot products and one division, and only then does any vector get scaled.
Opening scene, frozen
u and v as three-component rows with an empty slot for u·v. The projection is built from two dot products and one division before any vector is scaled.
The precondition is the same as for the dot product, because the dot product is where the computation starts: u and v must have the same number of components. There is one more, specific to projection: v must be non-zero, since its squared length is about to be a divisor.
It helps to hold the geometric picture from the start. The projection is the shadow of u on the line through v, and everything the tool does is the arithmetic that locates that shadow.
Phase 1: Pairing Components Toward the Dot Product
The first sweep pairs ui with vi, one position at a time, and the running sum u1v1+u2v2+⋯ grows in the caption until the u⋅v slot can be filled.
The frozen picture below is the second pair at length 3: u2 and v2 highlighted together, the slot still pending.
Phase 1, mid-sweep
u2 and v2 highlighted as a pair, the u·v slot still pending. The inner product sweep, reused: how much u leans along v is the first thing a projection needs.
This is the inner product tool's sweep reused as a subroutine. The dot product measures how much u leans along v, which is exactly the information a projection needs: the more the two vectors align, the longer the shadow.
Phase 3 runs the same sweep with v against itself, producing ∥v∥2. The tool compresses it into one scene because every product is a square and the pattern is already familiar.
Phase 4: The Coefficient
With both dot products in hand, the coefficient is a single division: c=(u⋅v)/∥v∥2.
The frozen picture below shows the two slots dividing into c. From here on the tool writes c rather than the fraction, so the remaining phases stay readable.
Phase 4, the coefficient
u·v divided by ‖v‖² into c. Two factors of the length of v come in, so two are divided out - dividing by ‖v‖ once would give the scalar projection instead.
The division by ∥v∥2 rather than ∥v∥ is the step most often done wrong, and the reason for it is worth seeing. The dot product u⋅v grows with the length of v, and so does the vector v that c is about to multiply. Two factors of ∥v∥ come in, so two must be divided out, or the projection would change when v is merely rescaled.
Dividing by ∥v∥ once gives a different, also useful number: the scalar projection, the signed length of the shadow. If v is a unit vector the two coincide and c is just u⋅v.
Phase 5: Scaling v by the Coefficient
The next sweep multiplies every component of v by c, one slot at a time, filling projvu.
The frozen picture below is the second step: one component of the projection already reading c⋅v1, one being computed, one still a placeholder.
Phase 5, mid-sweep
Components of v being multiplied by c, one at a time, into the projection. One common factor, so the result is a multiple of v and lies along it.
This phase is scalar multiplication, and it is why the projection lies along v: every component is scaled by the same c, so the result is a multiple of v and cannot leave the line through it. If c is positive the projection points with v; if negative, against it; if zero, u was already perpendicular to v and the shadow is a point.
Among all multiples of v, this one is closest to u. That is the sense in which the projection is the best approximation of u by something along v.
Phase 6: The Perpendicular Remainder
In the decomposition scenario the last sweep subtracts the projection from u, one component at a time, filling u−projvu.
The frozen picture below is the second step: one component of the remainder already reading u1−c⋅v1, one being computed, one still a placeholder.
Phase 6, mid-sweep
Components of the projection being subtracted from u, one at a time, into the remainder. What is left is perpendicular to v, and the two pieces add back to u.
The remainder is perpendicular to v, and the reason is one line of algebra: dotting it with v gives u⋅v−c∥v∥2, and c was chosen precisely so that c∥v∥2=u⋅v. The two terms cancel.
Read across the phases and the orthogonal decomposition assembles itself: u is the projection plus the remainder, one piece along v and one at right angles to it. That split, repeated against several vectors in turn, is the Gram-Schmidt process, and the length of the remainder is the distance from the tip of u to the line through v.
Reading the Scene Player
Each scene combines highlights, arrows, and a caption.
• In phase 1, the active pair ui, vi is highlighted with the paired styles, the u⋅v slot shows a dashed pending outline, and two arrows flow from the pair into the slot • In phases 2 and 3, every contributing component is highlighted and the destination slot turns accent • In phase 4, the u⋅v slot is primary, the ∥v∥2 slot secondary, and c accent, with arrows from both into c • In phases 5 and 6, the two sources of each component are primary and secondary and the destination is accent, with arrows from both • Filled components show their symbolic content — c⋅vi in the projection, ui−c⋅vi in the remainder — at a font size that scales with the vector length • The step log on the right keeps a record of every completed step across all phases
Choosing Vector Length
The dimension stepper controls the length shared by u and v.
• Length 2 is the picture most people carry: a shadow dropped from the tip of u onto the line through v • Length 3 is the same construction in space, and the one used for the frozen pictures below • Longer vectors show that nothing in the formula depends on the dimension: one dot product, one squared length, one division, then one multiplication per component • Length 1 is degenerate but instructive: every vector lies along v, so the projection is all of u and the remainder is zero
What the Projection Is
The projection of u onto a non-zero vector v is
projvu=v⋅vu⋅vv=∥v∥2u⋅vv
It is the scalar multiple of v closest to u. Its signed length is the scalar projection,
compvu=∥v∥u⋅v=∥u∥cosθ
where θ is the angle between the vectors. The projection and the scalar projection are related by projvu=(compvu)v^, a signed length times the unit vector along v.
What is left after removing the projection,
u−projvu
is perpendicular to v: dotting it with v gives u⋅v−c(v⋅v)=u⋅v−u⋅v=0. So every vector splits uniquely into a part along v and a part orthogonal to it.
For projections onto subspaces, projection matrices and least squares, see the projections theory page.
Key Properties
The projection inherits its properties from the dot product.
• Along v: projvu is always a scalar multiple of v • Perpendicular remainder: (u−projvu)⋅v=0 • Linearity in u: projv(u1+u2)=projvu1+projvu2 and projv(ku)=kprojvu • Independence of the length of v: projkvu=projvu for any k=0 — only the line through v matters • Idempotence: projecting twice changes nothing, projv(projvu)=projvu • Perpendicular input: if u⊥v then u⋅v=0 and the projection is the zero vector • Parallel input: if u=kv then the projection is u itself and the remainder is zero • Unit v: if ∥v∥=1 the coefficient is simply u⋅v • Closest point: among all multiples of v, the projection minimizes ∥u−tv∥
Why It Matters
Projection is the basic tool for splitting a vector into the part that matters and the part that does not.
• Components of forces and velocities: the part of a force along a ramp, or of a velocity along a direction of travel, is a projection • Distance from a point to a line: the length of the remainder u−projvu • Gram-Schmidt: each new vector is made orthogonal to the previous ones by subtracting its projections onto them • Least squares: fitting a line or a model is projecting the data vector onto the column space of the design matrix • Coordinates in an orthogonal basis: the coefficient c is exactly the coordinate of u along v when the basis is orthogonal • Signal processing and statistics: Fourier coefficients and regression coefficients are projection coefficients
Worked Example
Take
u=123,v=111
Dot product: u⋅v=1+2+3=6.
Squared length: ∥v∥2=1+1+1=3.
Coefficient: c=6/3=2.
Scale:
projvu=2v=222
Remainder:
u−projvu=1−22−23−2=−101
Check: (−1,0,1)⋅(1,1,1)=−1+0+1=0, so the remainder is perpendicular to v. The scalar projection is 6/3=23, which is indeed the length of (2,2,2).
A planar example: u=(3,1), v=(2,2) gives u⋅v=8, ∥v∥2=8, c=1, projection (2,2) and remainder (1,−1). Set the visualizer to length 3 or 2 and step through to see the same six phases symbolically.
Common Mistakes
A few mistakes recur.
• Dividing by ∥v∥ instead of ∥v∥2 — that gives the scalar projection, a number, not the vector projection; the vector formula needs the square so that the length of v cancels • Projecting onto the wrong vector — projvu lies along v; projuv lies along u, and they are different vectors with different lengths • Expecting the projection to be shorter than u in every component — it is shorter overall, ∥projvu∥≤∥u∥, but individual components can be larger • Forgetting the sign — when the angle between u and v exceeds 90°, c is negative and the projection points against v • Projecting onto the zero vector — undefined, since ∥v∥2=0; there is no line to project onto • Confusing the projection with the remainder — the projection is the part along v; the remainder is the part perpendicular to it, and the two add back to u
Related Concepts
Dot product — supplies both the numerator u⋅v and the denominator v⋅v of the coefficient.
Magnitude and unit vector — ∥v∥2 is the squared magnitude; with a unit v^ the projection is (u⋅v^)v^.