Unit Vectors
In previous lessons, we saw that the length (magnitude) of a vector is completely independent of its orientation (angle). This means that infinite vectors can point in the exact same direction while having vastly different lengths.
Any set of vectors pointing along the same line are scalar multiples of each other. In many linear algebra, engineering, and machine learning applications, we want to strip away the length of a vector and focus entirely on its direction.
To do this, we scale the vector so that its length is exactly $1$. A vector with a magnitude of $1$ is called a Unit Vector.
1. Formal Definition
A unit vector is algebraically and geometrically defined as a scaled version of a vector that satisfies a length constraint of one.
Algebraic Definition
If we scale a vector by a scalar factor , the scaled vector is a unit vector if and only if:
Geometric Definition
Geometrically, scaling any non-zero vector by the correct positive scalar contracts or expands it so that its tip lies exactly on the boundary of a unit circle (in 2D) or unit sphere (in 3D), representing a length of $1$:

2. Normalizing a Vector (How to Choose )
To transform an arbitrary vector into a unit vector pointing in the same direction, we must select the appropriate scaling factor .
The Numerical Analogy
Think about a regular real number, for example, $3$. If you want to scale this number to equal the "unit number" (which is $1$), what scalar must you multiply it by?
You multiply it by its reciprocal:
The Vector Generalization
We apply the exact same reciprocal concept to vectors. To scale any non-zero vector to have a length of $1$, we choose as the reciprocal of the vector's magnitude:
Multiplying the vector by this scalar yields the normalized unit vector (often written as or with a hat symbol ):
3. The Zero Vector Exception
A crucial mathematical exception to unit vectors is the Zero Vector (). The zero vector does not have a corresponding unit vector.
This makes absolute sense both geometrically and algebraically:
- Geometrically: The zero vector is simply a single point located at the origin. It has no length, no magnitude, and thus no defined direction. It is impossible to point in "the same direction" as a point.
- Algebraically: The magnitude of the zero vector is . If we attempt to compute the normalization scalar , we encounter a division-by-zero error, which is undefined.
- Numerical Analogy: There is no real number that can multiply $0$ to equal $1$ ().
4. Python Implementation
In NumPy, we normalize a vector by first computing its Euclidian norm using np.linalg.norm() and then dividing the vector by that norm:
import numpy as np
import matplotlib.pyplot as plt
# 1. Define a 2D vector
v1 = np.array([ -3, 6 ])
# 2. Compute the normalization scalar (mu = 1 / norm)
v1_norm = np.linalg.norm(v1)
mu = 1 / v1_norm
v1n = v1 * mu
print(f"Original Vector v1 : {v1}")
print(f"Vector Magnitude : {v1_norm:.4f}")
print(f"Normalization Scalar: {mu:.4f}")
print(f"Unit Vector v1-norm : {v1n}")
print(f"Normalized Length : {np.linalg.norm(v1n):.1f}")
# 3. Plot original vector vs normalized vector
plt.figure(figsize=(6, 6))
plt.plot([0, v1[0]], [0, v1[1]], 'b', label='Original Vector v1', linewidth=3)
plt.plot([0, v1n[0]], [0, v1n[1]], 'r', label='Unit Vector v1-norm', linewidth=5)
plt.axis('square')
plt.axis(( -7, 7, -7, 7 ))
plt.grid(True, linestyle='--', alpha=0.6)
plt.legend()
plt.title("Vector Normalization Visualization")
plt.show()Here is the resulting visualization showing the original vector and its normalized unit equivalent pointing in the exact same direction but scaled to a length of exactly $1$:

Key Takeaways
- Unit Vector: A vector with a magnitude of exactly $1$ (), representing direction only.
- Vector Normalization: The process of scaling any non-zero vector by to create a unit vector in the same direction.
- Zero Vector Boundary: The zero vector has a magnitude of $0$ and no defined direction, meaning it cannot be normalized (division-by-zero is mathematically undefined).