In this lesson you’ll learn the cross product (a key 3D operation) and vector projection, which tells you how much of one vector lies in the direction of another.
The projection of vector u onto vector v tells you “how much of u points in the direction of v.”
projvu=(∥v∥2u⋅v)v
Think of it as the “shadow” of u cast onto v. The dashed line drops straight down (perpendicular) from the tip of u to the line of v:
In the diagram: u=⟨3,4⟩ (blue) is projected onto the x-axis direction v=⟨5,0⟩. The orange arrow is the projection projvu=⟨3,0⟩. The dashed purple line shows the perpendicular drop from the tip of u down to the projection. The y-component is stripped away, leaving only the part of u that lies along v.
In the 3D scene above: u=⟨1,2,3⟩ (blue) and v=⟨4,5,6⟩ (green) lie in a plane shown by the shaded purple parallelogram. The cross product u×v=⟨−3,6,−3⟩ (orange) sticks straight out of that plane, perpendicular to both input vectors. Drag to rotate and see how the orange arrow is always at a right angle to the purple surface.
Example 2: Magnitude of Cross Product
Using the same vectors:
∥u×v∥=(−3)2+62+(−3)2=9+36+9=54=36
This equals ∥u∥∥v∥sinθ and represents the area of the parallelogram formed by u and v.
Example 3: Vector Projection
Project u=⟨3,4⟩ onto v=⟨5,0⟩ (along the x-axis).
Step 1: u⋅v=(3)(5)+(4)(0)=15
Step 2: ∥v∥2=52+02=25
Step 3: projvu=2515⟨5,0⟩=53⟨5,0⟩=⟨3,0⟩
The y-component is removed. The projection lies entirely on the x-axis.
Cross Product: Used to calculate surface normals (for lighting), torque in physics, and angular momentum
Projection is used in games for:
Finding how much force applies in a certain direction
Calculating the closest point on a line or plane
Implementing “sliding” collision response
AI sight cones and threat detection
Example: When a character runs into a wall at an angle, projection helps calculate the sliding direction along the wall instead of stopping completely.