2D Vector Projection Calculator

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

2D Vector Projection Calculator

What is 2D Vector Projection?

Imagine you're playing with a flashlight and a stick. When you shine the light on the stick, it casts a shadow on the wall. This shadow is like a vector projection! In math terms, we're "projecting" one vector (the stick) onto another vector (the direction of the light).

How to Calculate 2D Vector Projection

To find the projection of vector \(\vec{a}\) onto vector \(\vec{b}\), we follow these friendly steps:

  • Find out how much \(\vec{a}\) and \(\vec{b}\) agree (using the dot product)
  • See how long \(\vec{b}\) is (its magnitude squared)
  • Divide these numbers and multiply by \(\vec{b}\)

Formula and Definition

The projection of \(\vec{a}\) onto \(\vec{b}\) is given by:

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

Where:

  • \(\vec{a} \cdot \vec{b}\) is the dot product of \(\vec{a}\) and \(\vec{b}\)
  • \(\|\vec{b}\|\) is the magnitude (length) of \(\vec{b}\)
  • \(\|\vec{b}\|^2\) is the magnitude of \(\vec{b}\) squared

Calculation Steps

  1. Calculate the dot product of \(\vec{a}\) and \(\vec{b}\): \(\vec{a} \cdot \vec{b}\)
  2. Calculate the magnitude of \(\vec{b}\) squared: \(\|\vec{b}\|^2\)
  3. Divide the dot product by \(\|\vec{b}\|^2\)
  4. Multiply this scalar by \(\vec{b}\) to get the projection vector

Example and Visual Representation

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

  1. Dot product: \(\vec{a} \cdot \vec{b} = (3 \times 1) + (4 \times 2) = 3 + 8 = 11\)
  2. Magnitude of \(\vec{b}\) squared: \(\|\vec{b}\|^2 = 1^2 + 2^2 = 1 + 4 = 5\)
  3. Scalar projection: \(\frac{11}{5} = 2.2\)
  4. Vector projection: \(2.2 \times (1, 2) = (2.2, 4.4)\)

So, the projection of \(\vec{a}\) onto \(\vec{b}\) is \((2.2, 4.4)\)

a b proj

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