Mathematics for AI: Unit Vectors
A vector has both a magnitude (or length) and a direction. A unit vector is a vector with a magnitude of 1 pointing to some direction.
Unit Vector Notation
Unit vector notation uses a hat symbol ^ to show that the vector has a magnitude of 1. For example:
"v-hat" is a unit vector that has a length of 1 and points in some direction.
Unit vectors lie along the axes of a Cartesian coordinate system.
Unit Vectors in 2D Space
In 2D space, we use two unit vectors to show direction along the x-axis and y-axis.
These vectors each have a magnitude of 1:

Unit Vectors in 3D Space
In 3D space, we use three unit vectors to show direction along the x-axis, y-axis and z-axis.
These vectors each have a magnitude of 1:

Unit vectors are used to build or describe other vectors. By scaling and combining them, we can express any vector in terms of direction and magnitude. Let’s go through a worked example.
A Worked Example
Suppose we have a vector in 2D space:
This means the vector goes 2 units to the right and 3 units up.
We can express it using unit vectors:

Using these, we write:
This shows how any vector can be represented as a sum of scaled unit vectors.
The head-to-tail method helps us visualize vector addition:
- Start at the origin
- Move 2 units right → this is the vector
- From there, move 3 units up → this is the vector
- The tip now lands at , which is the head of


This method shows how vectors add together, especially when using unit vectors as building blocks.