Dot Product

The dot product (also called the scalar product or inner product) is one of the most important operations in linear algebra. Given two vectors, the dot product combines them to produce a single real number — a scalar — rather than another vector. This makes it fundamentally different from vector addition or scalar multiplication, and it opens up a powerful way to measure relationships between vectors. The dot product encodes geometric information: it tells us how much two vectors point in the same direction. When two vectors are perpendicular (orthogonal), their dot product is exactly zero. When they point in the same direction, the dot product is at its maximum. This geometric meaning connects the algebraic formula to real-world applications in physics (work done by a force), computer graphics (lighting calculations), and machine learning (similarity measures). Understanding the dot product also unlocks the concept of vector projection — the process of finding how much of one vector lies along the direction of another. Projection is essential for decomposing forces in physics, computing distances in geometry, and solving systems of equations efficiently. Together, the dot product and projection form the foundation of much of modern applied mathematics.

Key takeaways
  • The Algebraic Definition
  • The Geometric Definition
  • Finding the Angle Between Two Vectors
  • Vector Projection
  • Key Properties

The Algebraic Definition

For two vectors in n-dimensional space, the dot product is computed by multiplying corresponding components and summing the results. In 2D: if a = (a₁, a₂) and b = (b₁, b₂), then a · b = a₁b₁ + a₂b₂. In 3D: if a = (a₁, a₂, a₃) and b = (b₁, b₂, b₃), then a · b = a₁b₁ + a₂b₂ + a₃b₃. For example, (3, 4) · (2, −1) = (3)(2) + (4)(−1) = 6 − 4 = 2.

The Geometric Definition

Geometrically, the dot product is defined as a · b = |a| |b| cos θ, where |a| and |b| are the magnitudes (lengths) of the vectors and θ is the angle between them (0 ≤ θ ≤ π). This formula reveals why the dot product is so powerful: it directly encodes the cosine of the angle between two vectors. If a · b > 0, the angle is acute (less than 90°). If a · b = 0, the vectors are perpendicular. If a · b < 0, the angle is obtuse (greater than 90°).

Finding the Angle Between Two Vectors

By combining both definitions, we can solve for the angle θ: cos θ = (a · b) / (|a| |b|). To find the angle between a = (1, 2) and b = (3, 1): compute a · b = 3 + 2 = 5, |a| = √5, |b| = √10, so cos θ = 5 / (√5 · √10) = 5 / √50 = 5 / (5√2) = 1/√2. Therefore θ = arccos(1/√2) = 45°.

Vector Projection

The scalar projection of b onto a is the signed length of the shadow that b casts along a: comp_a(b) = (a · b) / |a|. The vector projection of b onto a is the actual vector in the direction of a: proj_a(b) = [(a · b) / |a|²] a = [(a · b) / (a · a)] a. For example, to project b = (3, 2) onto a = (4, 0): proj_a(b) = [(12 + 0) / 16](4, 0) = (3/4)(4, 0) = (3, 0). This makes geometric sense: (3, 0) is the horizontal component of b.

Key Properties

The dot product satisfies three essential properties: (1) Commutativity: a · b = b · a. (2) Distributivity over addition: a · (b + c) = a · b + a · c. (3) Scalar multiplication: (λa) · b = λ(a · b). Also, a · a = |a|², so the dot product of a vector with itself gives the square of its length. These properties make the dot product an extremely flexible tool in algebraic manipulations.

The Key Equation

a⋅b=∣a∣ ∣b∣cos⁡θ=∑i=1naibi\mathbf{a} \cdot \mathbf{b} = |\mathbf{a}|\,|\mathbf{b}|\cos\theta = \sum_{i=1}^{n} a_i b_i
  • \mathbf{a} \cdot \mathbf{b} — Dot Product (dimensionless (or product of input units)): The scalar result of the dot product operation between vectors a and b.
  • |\mathbf{a}| — Magnitude of a (same as vector components): The length of vector a, computed as √(a₁² + a₂² + … + aₙ²).
  • \theta — Angle between vectors (radians or degrees): The angle formed between vectors a and b when placed tail-to-tail, ranging from 0 to π.
  • a_i,\, b_i — Component pairs (same as vector components): The i-th components of vectors a and b respectively, multiplied together and then summed.

Worked Example

Problem. Let a = (2, 3, −1) and b = (4, −1, 2). (a) Find a · b. (b) Find the angle θ between a and b. (c) Find the vector projection of b onto a.

a⋅b=3,θ≈79.9∘,proja(b)=314(2,3,−1)\mathbf{a}\cdot\mathbf{b}=3,\quad \theta\approx79.9^\circ,\quad \text{proj}_{\mathbf{a}}(\mathbf{b})=\tfrac{3}{14}(2,3,-1)

Answer. a · b = 3; θ ≈ 79.9°; proj_a(b) = (3/7, 9/14, −3/14)

Figure
Diagram
Dot Product and Vector Projectionxybaprojₐ(b)θa · b = |a||b|cos θprojₐ(b) = [(a·b)/(a·a)] aO
Origins · 1 minHermann Grassmann and how this was discovered
HG
Hermann Grassmann
1809–1877 · German

Hermann Grassmann developed the foundations of modern linear algebra in his 1844 work 'Die lineale Ausdehnungslehre' (The Theory of Linear Extension). He introduced abstract vector spaces and the inner product (dot product) as part of a sweeping generalization of algebra and geometry. His work was decades ahead of its time and initially ignored, but it later became central to the development of modern mathematics and physics. Grassmann was largely self-taught in mathematics and was actually better known during his lifetime as a linguist — he wrote an important Sanskrit dictionary and made contributions to the study of ancient Indian languages.

  • Vector Magnitude and Direction — The dot product formula uses the magnitudes |a| and |b|, so understanding how to compute and interpret vector length is a direct prerequisite.
  • Cross Product — The cross product is the companion vector operation to the dot product — while the dot product gives a scalar measuring parallelism, the cross product gives a vector measuring perpendicularity.
  • Cosine and the Unit Circle — The geometric definition of the dot product relies directly on the cosine function, making trigonometry essential for understanding the angle interpretation.
  • Matrix Multiplication — Each entry of a matrix product is computed as a dot product of a row vector with a column vector, so the dot product is the building block of all matrix multiplication.
  • Work Done by a Force — In physics, work is defined as W = F · d (the dot product of force and displacement vectors), making this a direct real-world application of the dot product.