3D Vector Projection Calculator, Project Vector a onto b

Vector \(\vec{a}\)
Vector \(\vec{b}\)

3D Vector Projection Calculator

What is 3D Vector Projection?

Imagine you're shining a flashlight on a wall. The shadow you see is like a vector projection! In 3D space, vector projection is like finding the shadow of one vector onto another. It shows us how much of one vector points in the same direction as another.

How to Calculate 3D Vector Projection

To find the projection, we use a special math trick. We take two vectors, multiply them in a special way (called a dot product), and then divide by the length of one vector squared. This gives us a new vector that points in the same direction as one of our original vectors.

Formula

If we have two 3D vectors \(\vec{a}\) and \(\vec{b}\), the projection of \(\vec{a}\) onto \(\vec{b}\) is:

\[ \text{proj}_{\vec{b}} \vec{a} = \frac{\vec{a} \cdot \vec{b}}{\|\vec{b}\|^2} \vec{b} \]

Where:

  • \(\vec{a}\) is the vector being projected
  • \(\vec{b}\) is the vector we're projecting onto
  • \(\vec{a} \cdot \vec{b}\) is the dot product of \(\vec{a}\) and \(\vec{b}\)
  • \(\|\vec{b}\|\) is the magnitude (length) of vector \(\vec{b}\)

Calculation Steps

  1. Calculate the dot product of \(\vec{a}\) and \(\vec{b}\): \(\vec{a} \cdot \vec{b} = a_x b_x + a_y b_y + a_z b_z\)
  2. Calculate the magnitude of \(\vec{b}\) squared: \(\|\vec{b}\|^2 = b_x^2 + b_y^2 + b_z^2\)
  3. Divide the dot product by the magnitude squared: \(\frac{\vec{a} \cdot \vec{b}}{\|\vec{b}\|^2}\)
  4. Multiply this scalar by \(\vec{b}\) to get the projection vector

Example

Let's project \(\vec{a} = (3, 1, 2)\) onto \(\vec{b} = (2, 2, 1)\)

  1. Calculate dot product: \(\vec{a} \cdot \vec{b} = (3)(2) + (1)(2) + (2)(1) = 6 + 2 + 2 = 10\)
  2. Calculate \(\|\vec{b}\|^2 = 2^2 + 2^2 + 1^2 = 4 + 4 + 1 = 9\)
  3. Divide: \(\frac{10}{9}\)
  4. Multiply by \(\vec{b}\): \(\text{proj}_{\vec{b}} \vec{a} = \frac{10}{9}(2, 2, 1) = (\frac{20}{9}, \frac{20}{9}, \frac{10}{9}) \approx (2.22, 2.22, 1.11)\)

Visual Representation

a b proj_b a

This diagram shows vector \(\vec{a}\) (red), vector \(\vec{b}\) (blue), and the projection of \(\vec{a}\) onto \(\vec{b}\) (green) in 3D space. The dashed gray line shows how \(\vec{a}\) is "shadowed" onto \(\vec{b}\) to create the projection.