Vector Projection Calculator

Calculate the orthogonal projection of one vector onto another in 2D or 3D space

Calculate Vector Projection

Vector A (to be projected)

Vector B (projection direction)

Projection Results

Error: Vector B cannot be the zero vector

Projection onto the zero vector is undefined

Example Calculations

Basic 2D Example

Vector A: [3, 4]

Vector B: [1, 1]

Calculation: proj_b(a) = ((3×1 + 4×1) / (1×1 + 1×1)) × [1, 1] = (7/2) × [1, 1] = [3.5, 3.5]

Result: Projection = [3.5, 3.5]

3D Physics Example

Vector A: [2, -3, 5] (force vector)

Vector B: [3, 6, -4] (direction vector)

Dot Products: a·b = 2×3 + (-3)×6 + 5×(-4) = -32, b·b = 9 + 36 + 16 = 61

Result: proj_b(a) = (-32/61) × [3, 6, -4] = [-1.574, -3.148, 2.098]

Orthogonal Vectors Example

Vector A: [2, 6, -3]

Vector B: [6, 4, 12]

Dot Product: a·b = 2×6 + 6×4 + (-3)×12 = 12 + 24 - 36 = 0

Result: Since vectors are orthogonal, projection = [0, 0, 0]

Projection Formulas

Vector Projection

proj_b(a) = ((a·b) / (b·b)) × b

Scalar Projection

comp_b(a) = (a·b) / |b|

Rejection Vector

ort_b(a) = a - proj_b(a)

Angle Between Vectors

θ = arccos((a·b) / (|a| × |b|))

Key Concepts

📐

Orthogonal Projection: Shadow of vector a cast onto vector b

📏

Scalar Projection: Length of the projection (can be negative)

Rejection Vector: Part of a perpendicular to b

Parallel Vectors: Projection equals the original vector

Real-World Applications

Physics

Force decomposition, work calculation

🎮

Computer Graphics

Lighting calculations, shadow mapping

📊

Data Science

Principal component analysis, regression

🏗️

Engineering

Structural analysis, load distribution

Understanding Vector Projection

What is Vector Projection?

Vector projection is like casting a shadow. When you project vector A onto vector B, you're finding the "shadow" that A casts in the direction of B. This shadow is the component of A that lies parallel to B.

Mathematical Intuition

The projection answers the question: "How much of vector A goes in the same direction as vector B?" It decomposes A into two parts: one parallel to B (the projection) and one perpendicular to B (the rejection).

a = proj_b(a) + ort_b(a)

Vector decomposition into parallel and orthogonal components

Formula Derivation

The projection formula comes from the requirement that the projection must be parallel to B and the rejection must be orthogonal to B. Using the properties of dot products, we derive:

Step 1: proj_b(a) = c × b (for some scalar c)
Step 2: ort_b(a) ⊥ b, so ort_b(a) · b = 0
Step 3: Since a = proj_b(a) + ort_b(a)
Step 4: a · b = (c × b) · b = c × (b · b)
Result: c = (a · b) / (b · b)

Special Cases

  • Orthogonal vectors: Projection is zero vector
  • Parallel vectors: Projection equals original vector
  • Zero vector: Projection is always zero