Vectors in 2D and 3D
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll learn the fundamentals of vectors, the building blocks of linear algebra. You’ll see how vectors represent direction and magnitude, and how they behave in both 2D and 3D space.
The Concept
Section titled “The Concept”A vector is a quantity that has both magnitude (length) and direction.
Representing Vectors
Section titled “Representing Vectors”- In 2D: or
- In 3D: or
Here, , , and are called the components of the vector.
Notation You’ll See
Section titled “Notation You’ll See”Different textbooks and fields use different notation for vectors. Here’s a quick guide so you’re never caught off guard:
- Bold lowercase letters like or are vectors (common in textbooks and on this site)
- An arrow on top like or also means vector (common in handwriting and physics)
- Both mean the same thing:
- Bold uppercase letters like or usually represent matrices (grids of numbers), which we’ll cover soon
- Plain italic letters like , , are scalars (regular numbers)
On this site we’ll mostly use the bold notation (), but if you see in another resource, it’s the same idea.
Visualizing Vectors
Section titled “Visualizing Vectors”- Vectors are usually drawn as arrows.
- The tail is at the starting point, and the head points in the direction of the vector.
- The length of the arrow represents the magnitude.
Magnitude (Length) of a Vector
Section titled “Magnitude (Length) of a Vector”The magnitude (or norm) of a vector is:
In 3D:
Worked Examples
Section titled “Worked Examples”Example 1: Basic Vector
Draw the vector in 2D.
Magnitude:
Example 2: 3D Vector
Let .
Magnitude:
Example 3: Unit Vector
A unit vector has magnitude 1. To make a unit vector, divide by its magnitude:
Real-World Application
Section titled “Real-World Application”Vectors are everywhere in game development:
- Position vectors tell you where an object is.
- Velocity vectors tell you how fast and in what direction it’s moving.
- Force vectors (gravity, thrust, wind) are added together to determine movement.
Example: In a 3D game, the direction from your character to an enemy is a vector. The speed at which you’re moving is another vector. Adding them together helps the physics engine calculate realistic motion.
Retrying will remove your ✅ checkmark until you pass again.