AI & Machine Learning · reviewed in August 2026
Vector
In linear algebra applied to data and machine learning, a vector is an ordered list of numbers representing a point or a direction in an N-dimensional space — for example, the three coordinates of an RGB color, or the hundreds of numbers in a text embedding.
import numpy as np v = np.array([3.0, 4.0]) magnitude = np.linalg.norm(v) # 5.0
Frequently asked questions
What is a vector's magnitude (norm)?
It's its length in space, computed as the square root of the sum of its squared components (Euclidean norm); it's used, for example, to normalize vectors before comparing them.
What is the dot product between two vectors?
It's the sum of the products of their corresponding components; geometrically it relates to how aligned two vectors are, and it's the basis for computing cosine similarity.
How are vectors represented in code?
With a NumPy array (np.array([1, 2, 3])) in Python, which besides storing the numbers supports efficient vectorized operations like sums, products, and norms without explicit loops.