Vector Projection Calculator — Projection, Rejection & Angle

Project vector a onto vector b: scalar projection, vector projection, rejection, angle between vectors, decomposition table, visual breakdown, and orthogonality verification.

Vector Projection Calculator

Vector a (to project)

Vector b (onto)

Scalar Projection
3.646738
comp_b(a) = a · b / ‖b‖ = 32.0000 / 8.7750 — signed length of a's shadow on b.
Vector Projection
(1.6623, 2.0779, 2.4935)
proj_b(a) = (a · b / b · b) b — the component of a along b's direction. ‖proj‖ = 3.6467
Vector Rejection
(-0.6623, -0.0779, 0.5065)
a − proj_b(a) — the component of a perpendicular to b. ‖rej‖ = 0.8374
Angle Between
12.9332°
θ = arccos(a · b / (‖a‖ · ‖b‖)) = arccos(0.974632)
Dot Product a · b
32.000000
(1.00)(4.00) + (2.00)(5.00) + (3.00)(6.00) = 32.0000
a · b / ‖b‖²
0.415584
The scalar coefficient used to form the vector projection.
Relationship
General
Angle: 12.93° — neither parallel nor perpendicular.
Verification
✓ Orthogonal
proj · rej = -0.0000000000. Must be ≈ 0 (projection and rejection are perpendicular).

Decomposition Table

Quantityxyz‖ ‖
a1.00002.00003.00003.7417
b4.00005.00006.00008.7750
projb(a)1.66232.07792.49353.6467
rejb(a)-0.6623-0.07790.50650.8374
proj + rej1.00002.00003.00003.7417

Decomposition Visual

‖a‖ (total)
3.742
Projection: 3.647 (97.5%)Rejection: 0.837 (22.4%)

Component-wise Breakdown

x
p:1.66 r:-0.66
y
p:2.08 r:-0.08
z
p:2.49 r:0.51

Projection Formulas

FormulaDescription
compb(a) = a · b / ‖b‖Scalar projection — signed length of shadow
projb(a) = (a · b / b · b) bVector projection — component of a along b
rejb(a) = a − projb(a)Vector rejection — component of a perpendicular to b
a = projb(a) + rejb(a)Decomposition — a splits into parallel + perpendicular parts
proj · rej = 0Verification — projection and rejection are always orthogonal
‖a‖² = ‖proj‖² + ‖rej‖²Pythagorean theorem for vector decomposition
Planning notes, formulas, and examples

About the Vector Projection Calculator — Projection, Rejection & Angle

Vector projection decomposes a vector a into two orthogonal components: one parallel to a reference vector b (the projection) and one perpendicular to b (the rejection). This decomposition is one of the most widely used operations in linear algebra, physics, and engineering — from resolving forces along inclined planes to computing the closest point on a line.

This calculator computes both the scalar projection (comp_b(a) = a · b / ‖b‖, a signed scalar measuring how far a extends in b's direction) and the vector projection (proj_b(a) = (a · b / b · b) b, the actual vector component along b). The rejection a − proj_b(a) is the leftover perpendicular part. Together, projection + rejection perfectly reconstruct the original vector a.

The output also includes the angle between a and b, the dot product, and a relationship check (parallel, perpendicular, or general). A verification card confirms that projection and rejection are orthogonal by checking their dot product equals zero — a built-in sanity check.

The decomposition table shows a, b, projection, rejection, and their sum (which should match a) side by side. A stacked bar visualization illustrates how the magnitudes of projection and rejection partition ‖a‖, while component-wise bars break the decomposition down by axis. Six presets cover textbook scenarios including perpendicular vectors (projection = 0), parallel vectors (rejection = 0), and general cases.

Understanding vector projection is essential for least-squares regression, the Gram-Schmidt process, work computation in physics (W = F · d), and graphics (shadow casting, light reflection). This calculator makes the geometry of projection tangible through numbers and visuals.

When This Page Helps

Computing the projection requires a dot product, a second dot product (or magnitude squared), a scalar division, and a vector scaling — four operations where mixing up a and b or miscomputing the denominator yields the wrong result entirely. This calculator computes scalar projection, vector projection, rejection, and the angle between a and b for 2D and 3D vectors. It verifies orthogonality (proj · rej ≈ 0), shows a decomposition bar chart, and includes 6 presets covering textbook, perpendicular, and parallel cases. Essential for understanding work, least squares, and Gram-Schmidt.

How to Use the Inputs

  1. Select 2D or 3D mode
  2. Enter the components of vector a (the vector to project)
  3. Enter the components of vector b (the direction to project onto)
  4. Read scalar projection, vector projection, and rejection from the output cards
  5. Check the decomposition table and stacked bar for visual understanding
  6. Verify that proj · rej ≈ 0 (orthogonality check)
Formula used
comp_b(a) = a · b / ‖b‖; proj_b(a) = (a · b / b · b) b; rej_b(a) = a − proj_b(a); θ = arccos(a · b / (‖a‖‖b‖))

Example Calculation

Result: proj_b(a) ≈ (1.662, 2.078, 2.494), rej_b(a) ≈ (−0.662, −0.078, 0.506), θ ≈ 12.93°

a · b = 4 + 10 + 18 = 32. b · b = 16 + 25 + 36 = 77. proj = (32/77)(4, 5, 6) ≈ (1.662, 2.078, 2.494). rej = a − proj ≈ (−0.662, −0.078, 0.506). θ = arccos(32 / (√14 · √77)) ≈ 12.93°.

Tips & Best Practices

  • If a and b are perpendicular, the projection is the zero vector and the rejection equals a
  • If a and b are parallel, the rejection is zero and the projection equals a (possibly scaled)
  • The scalar projection is negative when the angle between a and b exceeds 90° — the shadow falls "behind" b
  • Work in physics equals W = F · d = ‖F‖ · comp_d(F) — the scalar projection of force along displacement
  • Swapping a and b gives a completely different projection — projection is NOT symmetric

Scalar vs. Vector Projection

The **scalar projection** of a onto b is comp_b(a) = a · b / ‖b‖, a signed number representing how far a extends in b’s direction. The **vector projection** is proj_b(a) = (a · b / b · b) b, which is the actual vector component of a along b. The projection is positive when the angle is acute, zero when perpendicular, and negative (pointing opposite to b) when obtuse. Crucially, proj_b(a) ≠ proj_a(b) — projection is **not symmetric**, and swapping a and b produces a vector in a different direction.

Rejection and Orthogonal Decomposition

The **rejection** rej_b(a) = a − proj_b(a) is the component of a perpendicular to b. Together, projection and rejection produce an **orthogonal decomposition**: a = proj_b(a) + rej_b(a), with proj ⊥ rej. This decomposition is the heart of the **Gram-Schmidt process**, which builds an orthonormal basis by repeatedly subtracting projections onto previously orthogonalized vectors. The Pythagorean theorem applies: ‖a‖² = ‖proj‖² + ‖rej‖², providing a consistency check.

Applications: Work, Least Squares, and Beyond

In **physics**, work W = F · d = ‖F‖ · comp_d(F) is the scalar projection of force along displacement. In **least squares regression**, the solution â = proj_{col(X)} b projects the observation vector onto the column space of X, minimizing the residual (rejection). In **signal processing**, projecting a signal onto a basis function extracts that frequency component (Fourier analysis). In **robotics**, projecting a desired trajectory onto the feasible space produces the closest achievable motion. Understanding projection and rejection is how mathematicians and engineers decompose complex problems into simpler, orthogonal parts.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • The scalar projection is a single number measuring how far a extends in b's direction (positive or negative). The vector projection is the actual vector component of a along b — it has both magnitude and direction (along b).