Orthogonality
Orthogonal projections, bases, and distances
Orthogonalization
Projections & Decompositions
Distance Geometry
💡 Need Help?
- • Enter fractions like
1/2 - • Use decimals like
0.5 - • Click "Load Example" to try a preset
- • Click any step to copy LaTeX
Projection Onto A Vector Calculator
The projection of vector u onto vector v gives the component of u that lies in the direction of v. This is fundamental for understanding vector components, physics forces, and geometric relationships between vectors.
📑 Quick Navigation
What is Vector Projection?
Vector projection answers a fundamental question: "How much of vector u points in the direction of vector v?"
Definition: The projection of vector u onto vector v (denoted proj_v(u)) is the vector parallel to v that represents the "shadow" of u when light shines perpendicular to v.
🌞 Intuitive Example: Imagine the sun shining straight down. The shadow of a flagpole on the ground is the projection of the flagpole onto the ground.
- Flagpole (u) = vector pointing up at an angle
- Ground (v) = horizontal direction
- Shadow (proj) = how much the flagpole extends horizontally
💡 Key Insight: Projection splits any vector into two parts: one that's parallel to v, and one that's perpendicular to v.
The Projection Formula
Where:
- u · v = dot product =
u₁v₁ + u₂v₂ + ... + uₙvₙ - ‖v‖² = squared magnitude =
v₁² + v₂² + ... + vₙ² - The fraction
λ = (u·v)/(‖v‖²)is called the scalar projection coefficient
Scalar Projection (Component)
The scalar projection gives the signed length of the projection vector. It's positive when u and v point in similar directions, negative when they point opposite.
For 2D Vectors
For 3D Vectors
Step-by-Step Calculation
How to Compute proj_v(u)
Step 1: Compute the dot product u·v
Step 2: Compute the squared magnitude ‖v‖²
Step 3: Calculate the scalar coefficient λ = (u·v) / ‖v‖²
Step 4: Multiply λ by v
Step 5: Find perpendicular component: u⟂ = u - proj_v(u)
Quick Formula for 2D:
Special Case: Unit Vector
If v is a unit vector (‖v‖ = 1), the formula simplifies dramatically:
Parallel and Perpendicular Components
Any vector u can be decomposed into two orthogonal components relative to v:
📐 Parallel Component (u∥)
This is the projection itself:
It points in the same direction as v (or opposite if λ is negative).
📐 Perpendicular Component (u⟂)
This is what's left over:
It is orthogonal to v: u⟂ · v = 0
✨ Pythagorean Theorem for Vectors:
The squared length of u equals the sum of squared lengths of its components.
Complete Examples
Example 1: Projection in 2D
Vectors: u = (3, 4), v = (1, 0) (horizontal axis)
Step 1: Dot product u·v
Step 2: Squared magnitude ‖v‖²
Step 3: Scalar coefficient
Step 4: Projection vector
Step 5: Perpendicular component
Interpretation: The projection (3,0) is how far u extends horizontally. The perpendicular component (0,4) is entirely vertical. Check: (3,0)·(0,4) = 0 ✓
Example 2: Projection onto a Diagonal Vector
Vectors: u = (4, 2), v = (2, 1)
Step 1: Dot product u·v
Step 2: Squared magnitude ‖v‖²
Step 3: Scalar coefficient
Step 4: Projection vector
Step 5: Perpendicular component
Note: The projection equals u itself because u is already parallel to v (u = 2·v). The perpendicular component is zero.
Example 3: Projection onto Perpendicular Vector
Vectors: u = (3, 4), v = (0, 1) (vertical axis)
Dot product: u·v = (3)(0) + (4)(1) = 4
Squared magnitude: ‖v‖² = 0² + 1² = 1
Scalar coefficient: λ = 4/1 = 4
Projection: proj_v(u) = 4·(0,1) = (0,4)
Interpretation: The projection is the vertical component of u. The horizontal component (3,0) is perpendicular to v.
Example 4: 3D Projection
Vectors: u = (2, 3, 1), v = (1, 0, 0) (x-axis)
Dot product: u·v = (2)(1) + (3)(0) + (1)(0) = 2
Squared magnitude: ‖v‖² = 1² + 0² + 0² = 1
Scalar coefficient: λ = 2/1 = 2
Projection: proj_v(u) = 2·(1,0,0) = (2,0,0)
Result: The projection extracts the x-component of u. The perpendicular component is (0, 3, 1).
Special Cases
| Case | Condition | Projection Result | Perpendicular Result |
|---|---|---|---|
| u ∥ v (parallel) | u = k·v | proj = u | u⟂ = 0 |
| u ⟂ v (perpendicular) | u·v = 0 | proj = 0 | u⟂ = u |
| v = 0 (zero vector) | ‖v‖² = 0 | Undefined | N/A |
| u = 0 (zero vector) | u = (0,0,...) | proj = 0 | u⟂ = 0 |
| Unit vector v | ‖v‖ = 1 | (u·v) v | u - (u·v)v |
⚠️ Important: Projection onto the zero vector is undefined because you cannot divide by ‖v‖² = 0. Always use a non-zero direction vector.
Geometric Interpretation
In 2D Plane
- proj_v(u) = shadow of u cast onto the line spanned by v
- u∥ = component along the line
- u⟂ = component perpendicular to the line
- The projection is the closest point on the line to the tip of u
Think of v defining a line through the origin. The projection is where u "lands" on that line when you drop a perpendicular.
In 3D Space
- v defines a line through the origin
- Projection is the point on that line closest to u's tip
- Distance from u to line = ‖u⟂‖
🔑 Key Geometric Fact: The projection is the orthogonal projection—the line connecting u to its projection is perpendicular to v.
Real-World Applications
⚙️ Physics: Forces on an Incline
When an object rests on an inclined plane, gravity decomposes into:
- Parallel component: Pulls object down the slope (causes motion)
- Perpendicular component: Presses object into the surface (causes friction)
🏗️ Engineering: Stress Analysis
Forces on a surface are decomposed into:
- Normal stress: Perpendicular to surface (pushing/pulling)
- Shear stress: Parallel to surface (sliding)
📐 Computer Graphics
- Shadows: Project points onto planes/lines
- Reflections:
reflect(u) = 2·proj_n(u) - u - Collision detection: Find closest point on line
📊 Machine Learning
- Principal Component Analysis (PCA): Projects data onto principal components
- Linear Regression: Projects data onto best-fit line
- Feature extraction: Find components along important directions
🎮 Game Development
- Camera projections: 3D to 2D screen projection
- Movement along surfaces: Project velocity onto surface
- AI pathfinding: Project positions onto paths
📈 Statistics: Linear Regression
The least squares regression line is the projection of the data vector onto the column space of the design matrix—a direct application of projection!
Related: Least Squares Calculator
Frequently Asked Questions
Q: What's the difference between projection and component?
A:
Vector projection (proj): A vector (has direction and magnitude)
Scalar projection (comp): Just a number (signed length)
Relationship: proj_v(u) = comp_v(u) · (v/‖v‖)
Q: Can I project onto a zero vector?
A: No! Projection onto the zero vector is undefined. Always use a non-zero direction vector.
Q: What if u and v are perpendicular?
A: Then proj_v(u) = 0. The projection is the zero vector, and u is entirely perpendicular.
Q: What if u and v are parallel?
A: Then proj_v(u) = u. The projection equals u itself, and the perpendicular component is zero.
Q: Can the scalar projection be negative?
A: Yes! When u and v point in opposite directions (angle > 90°), the dot product is negative, making λ negative. This means the projection points opposite to v.
Q: How is projection related to distance?
A: The shortest distance from the tip of u to the line spanned by v is exactly ‖u⟂‖ = ‖u - proj_v(u)‖.
Q: Does projection work in higher dimensions?
A: Yes! The formula works for any dimension (2D, 3D, 4D, etc.). The dot product generalizes naturally.
Practice Problems
Beginner
- Find
proj_v(u)foru = (5, 0),v = (1, 0) - Find
proj_v(u)foru = (0, 4),v = (1, 0) - Find the scalar projection of
u = (3, 4)ontov = (1, 0)
Intermediate
- Compute
proj_v(u)foru = (2, 5),v = (3, 1) - Find the perpendicular component when projecting
u = (4, 7)ontov = (2, 2) - If
proj_v(u) = (2, 4)andv = (1, 2), what is the scalar coefficient λ?
Advanced
- For
u = (1, 2, 3)andv = (1, 1, 1), find both parallel and perpendicular components. - Verify the Pythagorean theorem for vectors: ‖u‖² = ‖u∥‖² + ‖u⟂‖² using
u = (3, 4)andv = (2, 1). - If
u = (a, b)andv = (1, 2), find a and b such thatproj_v(u) = (2, 4).
Click to reveal solutions
1. proj = (5, 0) (u is already parallel to v)
2. proj = (0, 0) (u is perpendicular to v)
3. comp = 3
4. λ = (2·3 + 5·1)/(3²+1²) = (6+5)/10 = 11/10 = 1.1
proj = 1.1·(3,1) = (3.3, 1.1)
5. λ = (4·2 + 7·2)/(2²+2²) = (8+14)/8 = 22/8 = 2.75
proj = 2.75·(2,2) = (5.5, 5.5)
u⟂ = (4,7) - (5.5,5.5) = (-1.5, 1.5)
6. λ = 2 (since proj = λ·v → (2,4) = λ·(1,2) ⇒ λ=2)
7. λ = (1+2+3)/(1+1+1) = 6/3 = 2
proj = 2·(1,1,1) = (2,2,2)
u⟂ = (1,2,3) - (2,2,2) = (-1,0,1)
8. ‖u‖² = 9+16=25, ‖u∥‖²=‖(4.4,2.2)‖²=19.36+4.84=24.2, ‖u⟂‖²=‖(-1.4,1.8)‖²≈1.96+3.24=5.2, sum=29.4? Wait, recalculate carefully: u=(3,4), v=(2,1): λ=(6+4)/5=10/5=2, proj=(4,2), u⟂=(-1,2). Then ‖u‖²=25, ‖proj‖²=16+4=20, ‖u⟂‖²=1+4=5, sum=25 ✓
9. proj = λ·(1,2) = (λ, 2λ) = (2,4) ⇒ λ=2
λ = (a·1 + b·2)/(1²+2²) = (a+2b)/5 = 2 ⇒ a+2b=10
Any (a,b) satisfying a+2b=10 works, e.g., (10,0), (8,1), (6,2), etc.
Summary
🎯 Key Formulas to Remember
- Vector Projection:
proj_v(u) = (u·v)/(v·v) · v - Scalar Projection:
comp_v(u) = (u·v)/‖v‖ - Parallel Component:
u∥ = proj_v(u) - Perpendicular Component:
u⟂ = u - proj_v(u) - Orthogonality Check:
u⟂ · v = 0 - Pythagorean:
‖u‖² = ‖u∥‖² + ‖u⟂‖²
💡 Quick Check: The projection is always parallel to v, and the difference u - proj is always perpendicular to v.
Try It Yourself!
Use the calculator above to compute vector projections:
- Enter vector u (the vector being projected)
- Enter vector v (the direction vector)
- Click "Calculate" to see:
- The projection vector proj_v(u)
- The perpendicular component u⟂
- The scalar projection coefficient λ
- Verification that u = proj + u⟂
- Visualization of the projection
📐 Try these examples:
- 2D Example:
u = (3, 4),v = (1, 0)→ Project onto x-axis - 2D Diagonal:
u = (4, 2),v = (2, 1)→ Already parallel - Perpendicular:
u = (3, 4),v = (0, 1)→ Project onto y-axis - 3D Example:
u = (2, 3, 4),v = (1, 0, 0)→ Extract x-component
📐 Pro Tip: The scalar projection λ tells you "how much" of u points in the direction of v. If λ > 0, they point similarly; if λ < 0, they point oppositely.