Vector Projection: The Story of a Shadow

Understand how to decompose vectors into orthogonal components by visualizing them as shadows.

Theory

Imagine you have two vectors, a and b. The vector projection of a onto b is like finding the "shadow" that vector a would cast on the line defined by vector b if there were a light source shining from directly above.

This "shadow" vector, denoted as projb(a), has two key properties:

  1. It points in the exact same (or opposite) direction as vector b.
  2. The line connecting the tip of vector a to the tip of the projection vector is perpendicular (orthogonal) to vector b.

To calculate it, we first find a scalar value that tells us how long the shadow is relative to b. This scalar is found by calculating the dot product of a and b, and then dividing by the squared length of b.

scalar=abbb=abb2\text{scalar} = \frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{b} \cdot \mathbf{b}} = \frac{\mathbf{a} \cdot \mathbf{b}}{\|\mathbf{b}\|^2}

Once we have this scalar, we simply multiply it by vector b to get the final projection vector.

projb(a)=(abbb)b\text{proj}_{\mathbf{b}}(\mathbf{a}) = \left( \frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{b} \cdot \mathbf{b}} \right) \mathbf{b}
Interactive Demo
Practice Problems

Practice problems coming soon.

Quant Finance Application

In finance, projecting a stock's returns onto the market's returns is a key part of calculating its beta in the Capital Asset Pricing Model (CAPM).