Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Vector Projection


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.
Two dot products, one division, then a scaling - the shadow of u on the line through v. Learn more about the opening scene · what it is








Key Terms

Vector projection — the part of u\mathbf{u} that points along v\mathbf{v}: projvu=uvv2v\operatorname{proj}_{\mathbf{v}} \mathbf{u} = \dfrac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{v}\|^2}\,\mathbf{v}.

Scalar projection — the signed length of that part: compvu=uvv\operatorname{comp}_{\mathbf{v}} \mathbf{u} = \dfrac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{v}\|}.

Projection coefficient — the scalar c=uvv2c = \dfrac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{v}\|^2} that multiplies v\mathbf{v}; it counts how many copies of v\mathbf{v} reach the foot of the perpendicular.

Remainderuprojvu\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}, the part of u\mathbf{u} perpendicular to v\mathbf{v}; also called the orthogonal component or rejection.

Orthogonal decomposition — the split u=projvu+(uprojvu)\mathbf{u} = \operatorname{proj}_{\mathbf{v}} \mathbf{u} + (\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}) into a piece along v\mathbf{v} and a piece at right angles to it.

Foot of the perpendicular — the point on the line through v\mathbf{v} closest to the tip of u\mathbf{u}; the projection is the vector from the origin to that point.

Same-length requirementu\mathbf{u} and v\mathbf{v} must have the same number of components, and v\mathbf{v} must be non-zero.

Getting Started with the Visualizer

Set the shared length of u\mathbf{u} and v\mathbf{v}, pick a scenario, then watch the projection build phase by phase.

• Use the Scenario pills to choose Projection only, which stops at projvu\operatorname{proj}_{\mathbf{v}} \mathbf{u}, or Projection and remainder, which continues to the perpendicular part and the full decomposition of u\mathbf{u}
• Use the Dimensions stepper to set the length of u\mathbf{u} and v\mathbf{v} (1 to 5 components)
• Hover the ? icon for a reminder of what the projection is and why the remainder is perpendicular to v\mathbf{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 cc 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: uiu_i is paired with viv_i, one component per scene, and the running sum u1v1+u2v2+u_1 v_1 + u_2 v_2 + \cdots grows in the caption
Phase 2 — dot product: the uv\mathbf{u} \cdot \mathbf{v} slot fills
Phase 3 — squared length: v2=vv\|\mathbf{v}\|^2 = \mathbf{v} \cdot \mathbf{v} fills its slot, in one scene
Phase 4 — coefficient: c=(uv)/v2c = (\mathbf{u} \cdot \mathbf{v}) / \|\mathbf{v}\|^2 fills
Phase 5 — scale: each component of v\mathbf{v} is multiplied by cc, one per scene, filling projvu\operatorname{proj}_{\mathbf{v}} \mathbf{u}
Phase 6 — remainder: each component of the projection is subtracted from u\mathbf{u}, one per scene, filling uprojvu\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}; 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\mathbf{u} and v\mathbf{v} as rows of components and an empty slot for uv\mathbf{u} \cdot \mathbf{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.
u1×3u1u2u3·v1×3v1v2v3u · v?
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\mathbf{u} and v\mathbf{v} must have the same number of components. There is one more, specific to projection: v\mathbf{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\mathbf{u} on the line through v\mathbf{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 uiu_i with viv_i, one position at a time, and the running sum u1v1+u2v2+u_1 v_1 + u_2 v_2 + \cdots grows in the caption until the uv\mathbf{u} \cdot \mathbf{v} slot can be filled.

The frozen picture below is the second pair at length 33: u2u_2 and v2v_2 highlighted together, the slot still pending.
u1×3u1u2u3·v1×3v1v2v3u · v?
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\mathbf{u} leans along v\mathbf{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\mathbf{v} against itself, producing v2\|\mathbf{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=(uv)/v2c = (\mathbf{u} \cdot \mathbf{v}) / \|\mathbf{v}\|^2.

The frozen picture below shows the two slots dividing into cc. From here on the tool writes cc rather than the fraction, so the remaining phases stay readable.
u · vu·v÷‖v‖²v·v=cu·v/‖v‖²
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 v2\|\mathbf{v}\|^2 rather than v\|\mathbf{v}\| is the step most often done wrong, and the reason for it is worth seeing. The dot product uv\mathbf{u} \cdot \mathbf{v} grows with the length of v\mathbf{v}, and so does the vector v\mathbf{v} that cc is about to multiply. Two factors of v\|\mathbf{v}\| come in, so two must be divided out, or the projection would change when v\mathbf{v} is merely rescaled.

Dividing by v\|\mathbf{v}\| once gives a different, also useful number: the scalar projection, the signed length of the shadow. If v\mathbf{v} is a unit vector the two coincide and cc is just uv\mathbf{u} \cdot \mathbf{v}.

Phase 5: Scaling v by the Coefficient

The next sweep multiplies every component of v\mathbf{v} by cc, one slot at a time, filling projvu\operatorname{proj}_{\mathbf{v}} \mathbf{u}.

The frozen picture below is the second step: one component of the projection already reading cv1c \cdot v_1, one being computed, one still a placeholder.
cu·v/‖v‖²·v1×3v1v2v3=proj1×3c·v1c·v2?
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\mathbf{v}: every component is scaled by the same cc, so the result is a multiple of v\mathbf{v} and cannot leave the line through it. If cc is positive the projection points with v\mathbf{v}; if negative, against it; if zero, u\mathbf{u} was already perpendicular to v\mathbf{v} and the shadow is a point.

Among all multiples of v\mathbf{v}, this one is closest to u\mathbf{u}. That is the sense in which the projection is the best approximation of u\mathbf{u} by something along v\mathbf{v}.

Phase 6: The Perpendicular Remainder

In the decomposition scenario the last sweep subtracts the projection from u\mathbf{u}, one component at a time, filling uprojvu\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}.

The frozen picture below is the second step: one component of the remainder already reading u1cv1u_1 - c \cdot v_1, one being computed, one still a placeholder.
u1×3u1u2u3proj1×3c·v1c·v2c·v3=u − proj1×3u1c·v1u2c·v2?
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\mathbf{v}, and the reason is one line of algebra: dotting it with v\mathbf{v} gives uvcv2\mathbf{u} \cdot \mathbf{v} - c\,\|\mathbf{v}\|^2, and cc was chosen precisely so that cv2=uvc\,\|\mathbf{v}\|^2 = \mathbf{u} \cdot \mathbf{v}. The two terms cancel.

Read across the phases and the orthogonal decomposition assembles itself: u\mathbf{u} is the projection plus the remainder, one piece along v\mathbf{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\mathbf{u} to the line through v\mathbf{v}.

Reading the Scene Player

Each scene combines highlights, arrows, and a caption.

• In phase 1, the active pair uiu_i, viv_i is highlighted with the paired styles, the uv\mathbf{u} \cdot \mathbf{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 uv\mathbf{u} \cdot \mathbf{v} slot is primary, the v2\|\mathbf{v}\|^2 slot secondary, and cc accent, with arrows from both into cc
• 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 — cvic \cdot v_i in the projection, uicviu_i - c \cdot v_i 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\mathbf{u} and v\mathbf{v}.

• Length 22 is the picture most people carry: a shadow dropped from the tip of u\mathbf{u} onto the line through v\mathbf{v}
• Length 33 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 11 is degenerate but instructive: every vector lies along v\mathbf{v}, so the projection is all of u\mathbf{u} and the remainder is zero

What the Projection Is

The projection of u\mathbf{u} onto a non-zero vector v\mathbf{v} is

projvu=uvvvv=uvv2v\operatorname{proj}_{\mathbf{v}} \mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{\mathbf{v} \cdot \mathbf{v}}\,\mathbf{v} = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{v}\|^2}\,\mathbf{v}


It is the scalar multiple of v\mathbf{v} closest to u\mathbf{u}. Its signed length is the scalar projection,

compvu=uvv=ucosθ\operatorname{comp}_{\mathbf{v}} \mathbf{u} = \frac{\mathbf{u} \cdot \mathbf{v}}{\|\mathbf{v}\|} = \|\mathbf{u}\| \cos\theta


where θ\theta is the angle between the vectors. The projection and the scalar projection are related by projvu=(compvu)v^\operatorname{proj}_{\mathbf{v}} \mathbf{u} = (\operatorname{comp}_{\mathbf{v}} \mathbf{u})\,\hat{\mathbf{v}}, a signed length times the unit vector along v\mathbf{v}.

What is left after removing the projection,

uprojvu\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}


is perpendicular to v\mathbf{v}: dotting it with v\mathbf{v} gives uvc(vv)=uvuv=0\mathbf{u} \cdot \mathbf{v} - c\,(\mathbf{v} \cdot \mathbf{v}) = \mathbf{u} \cdot \mathbf{v} - \mathbf{u} \cdot \mathbf{v} = 0. So every vector splits uniquely into a part along v\mathbf{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\mathbf{v}: projvu\operatorname{proj}_{\mathbf{v}} \mathbf{u} is always a scalar multiple of v\mathbf{v}
Perpendicular remainder: (uprojvu)v=0(\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}) \cdot \mathbf{v} = 0
Linearity in u\mathbf{u}: projv(u1+u2)=projvu1+projvu2\operatorname{proj}_{\mathbf{v}}(\mathbf{u}_1 + \mathbf{u}_2) = \operatorname{proj}_{\mathbf{v}} \mathbf{u}_1 + \operatorname{proj}_{\mathbf{v}} \mathbf{u}_2 and projv(ku)=kprojvu\operatorname{proj}_{\mathbf{v}}(k\mathbf{u}) = k \operatorname{proj}_{\mathbf{v}} \mathbf{u}
Independence of the length of v\mathbf{v}: projkvu=projvu\operatorname{proj}_{k\mathbf{v}} \mathbf{u} = \operatorname{proj}_{\mathbf{v}} \mathbf{u} for any k0k \neq 0 — only the line through v\mathbf{v} matters
Idempotence: projecting twice changes nothing, projv(projvu)=projvu\operatorname{proj}_{\mathbf{v}}(\operatorname{proj}_{\mathbf{v}} \mathbf{u}) = \operatorname{proj}_{\mathbf{v}} \mathbf{u}
Perpendicular input: if uv\mathbf{u} \perp \mathbf{v} then uv=0\mathbf{u} \cdot \mathbf{v} = 0 and the projection is the zero vector
Parallel input: if u=kv\mathbf{u} = k\mathbf{v} then the projection is u\mathbf{u} itself and the remainder is zero
Unit v\mathbf{v}: if v=1\|\mathbf{v}\| = 1 the coefficient is simply uv\mathbf{u} \cdot \mathbf{v}
Closest point: among all multiples of v\mathbf{v}, the projection minimizes utv\|\mathbf{u} - t\mathbf{v}\|

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 uprojvu\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u}
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 cc is exactly the coordinate of u\mathbf{u} along v\mathbf{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)\mathbf{u} = \begin{pmatrix} 1 \\ 2 \\ 3 \end{pmatrix}, \quad \mathbf{v} = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix}


Dot product: uv=1+2+3=6\mathbf{u} \cdot \mathbf{v} = 1 + 2 + 3 = 6.

Squared length: v2=1+1+1=3\|\mathbf{v}\|^2 = 1 + 1 + 1 = 3.

Coefficient: c=6/3=2c = 6 / 3 = 2.

Scale:

projvu=2v=(222)\operatorname{proj}_{\mathbf{v}} \mathbf{u} = 2\,\mathbf{v} = \begin{pmatrix} 2 \\ 2 \\ 2 \end{pmatrix}


Remainder:

uprojvu=(122232)=(101)\mathbf{u} - \operatorname{proj}_{\mathbf{v}} \mathbf{u} = \begin{pmatrix} 1 - 2 \\ 2 - 2 \\ 3 - 2 \end{pmatrix} = \begin{pmatrix} -1 \\ 0 \\ 1 \end{pmatrix}


Check: (1,0,1)(1,1,1)=1+0+1=0(-1, 0, 1) \cdot (1, 1, 1) = -1 + 0 + 1 = 0, so the remainder is perpendicular to v\mathbf{v}. The scalar projection is 6/3=236 / \sqrt{3} = 2\sqrt{3}, which is indeed the length of (2,2,2)(2, 2, 2).

A planar example: u=(3,1)\mathbf{u} = (3, 1), v=(2,2)\mathbf{v} = (2, 2) gives uv=8\mathbf{u} \cdot \mathbf{v} = 8, v2=8\|\mathbf{v}\|^2 = 8, c=1c = 1, projection (2,2)(2, 2) and remainder (1,1)(1, -1). Set the visualizer to length 33 or 22 and step through to see the same six phases symbolically.

Common Mistakes

A few mistakes recur.

Dividing by v\|\mathbf{v}\| instead of v2\|\mathbf{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\mathbf{v} cancels
Projecting onto the wrong vectorprojvu\operatorname{proj}_{\mathbf{v}} \mathbf{u} lies along v\mathbf{v}; projuv\operatorname{proj}_{\mathbf{u}} \mathbf{v} lies along u\mathbf{u}, and they are different vectors with different lengths
Expecting the projection to be shorter than u\mathbf{u} in every component — it is shorter overall, projvuu\|\operatorname{proj}_{\mathbf{v}} \mathbf{u}\| \leq \|\mathbf{u}\|, but individual components can be larger
Forgetting the sign — when the angle between u\mathbf{u} and v\mathbf{v} exceeds 90°90°, cc is negative and the projection points against v\mathbf{v}
Projecting onto the zero vector — undefined, since v2=0\|\mathbf{v}\|^2 = 0; there is no line to project onto
Confusing the projection with the remainder — the projection is the part along v\mathbf{v}; the remainder is the part perpendicular to it, and the two add back to u\mathbf{u}