Glossary Math & Statistics

Vector

A vector is a quantity with both a size and a direction, written as a list of components such as (3, 4).

Last reviewed:

AdSense Placeholder
Slot: header_reference_page

In more detail

The length (magnitude) of (3, 4) is √(3² + 4²) = 5, by the Pythagorean theorem. Vectors add component by component, (2, 1) + (1, 3) = (3, 4), which is the same as placing them head to tail. Multiplying by a number scales the length. Dividing a vector by its length gives a unit vector pointing the same way: (3, 4) / 5 = (0.6, 0.8). The dot product multiplies matching components and adds them; it equals |a| × |b| × cos θ, so it tells you how aligned two vectors are and is zero when they are perpendicular.

Why it matters

Vectors describe anything with a direction: forces, velocities, wind, displacements on a map, colours in RGB space, and the rows of data fed to machine-learning models. Adding magnitudes instead of vectors is a common error: walking 3 km east then 4 km north puts you 5 km from the start, not 7. In 3D, the cross product gives a vector perpendicular to two others, used for surface normals in graphics.

Example

a = (2, 1), b = (1, 3)
a · b = 2 × 1 + 1 × 3 = 5
|a| = √5 = 2.236     |b| = √10 = 3.162
cos θ = 5 / (√5 × √10) = 0.7071   →   θ = 45°

(3, 4) · (4, −3) = 12 − 12 = 0    →   perpendicular
(1, 2, 3) × (4, 5, 6) = (−3, 6, −3)
AdSense Placeholder
Slot: footer_leaderboard