Vector Dot Product & Projection

The dot product combines two vectors into a single number (scalar) measuring how much they point in the same direction: . Projection uses it to find the "shadow" one vector casts on another. Used everywhere in physics (work, flux), computer graphics, and machine learning. Foundational since the late 1800s (Gibbs, Heaviside).

The dot product (also called the scalar product or inner product) is an operation that takes two vectors and returns a single real number. Geometrically, it captures the degree of alignment between two vectors; algebraically, it is the sum of the products of their corresponding components. Its importance lies in turning geometric questions — Are these vectors perpendicular? What is the angle between them? How much of one lies along another? — into simple arithmetic. The projection of one vector onto another, built directly from the dot product, decomposes a vector into a component parallel to a given direction and a component perpendicular to it. A surprising fact: although the dot product is defined using a geometric angle, it can be computed knowing only the components — the angle never has to be measured.

The Core Insight

The dot product answers one question: "How much do these two vectors agree in direction?" When they point the same way, it is large and positive; when perpendicular, it is exactly zero; when opposed, it is negative. This single number unlocks angles, perpendicularity tests, work in physics, and the decomposition of any vector into useful directions.

Formal Statement

Dot Product — Two Equivalent Definitions

For vectors and in or , the dot product is a scalar defined geometrically by:

1
⟳This is the definition; is the angle between the two vectors when placed tail-to-tail, with .

Equivalently, in component form (with , ):

2
⟳Expand using distributivity over the standard basis and the facts , , etc.
Symbols: is the magnitude (length) of ; is the angle between them; are the scalar components of .

Magnitude from the Dot Product

The length of a vector is the square root of its dot product with itself:

3
⟳Set in equation [1]; since , , giving .

Angle Between Vectors

Solving equation [1] for gives a formula for the angle:

4
⟳Divide both sides of [1] by (valid for nonzero vectors).

Scalar and Vector Projection

The scalar projection of onto (the signed length of 's shadow along ) is:

5
⟳From [1], ; the shadow length is , so divide by .

The vector projection of onto (the shadow as an actual vector) is:

6
⟳Multiply the scalar projection [5] by the unit vector to give it the direction of .

Algebraic Properties

For vectors and scalar :

7
⟳Component products commute in [2].
8
⟳Expand using [2] and the distributivity of ordinary multiplication.
9
⟳Factor from each term in [2].

Perpendicularity Test

Two nonzero vectors are orthogonal (perpendicular) if and only if their dot product is zero:

10
⟳In [1], with nonzero magnitudes, forces , i.e. .

Why It Holds / Derivation

Equivalence of the Geometric and Algebraic Definitions

We show using the Law of Cosines.

Step 1. Place and tail-to-tail. The vector from the tip of to the tip of is . These three vectors form a triangle with sides , , and , with angle between the first two. Step 2. Apply the Law of Cosines to that triangle:
11
⟳Standard Law of Cosines with the included angle .
Step 3. Expand the left side using components. With :
12
⟳Expand each squared binomial and sum.
Step 4. Recognize and . Substitute [12] into [11]:
Step 5. Cancel from both sides and divide by :

This is exactly equations [2] = [1].

Josiah Willard Gibbs | 1839–1903

The American physicist and mathematician Gibbs, professor at Yale, developed modern vector analysis in the 1880s as a streamlined alternative to Hamilton's quaternions. In his lecture notes (later published as Vector Analysis, 1901, co-authored with E. B. Wilson) he introduced the now-standard dot and cross product notation. Working independently, the British engineer Oliver Heaviside reached very similar formulations. Their notation triumphed because it cleanly separated the two natural products of vectors — the scalar dot product and the vector cross product — into distinct, physically meaningful operations.

Building Intuition

Think of the dot product as measuring shadow length times length. If the sun is directly above the direction of , then casts a shadow onto the line of . The length of that shadow is . Multiply by and you get the dot product.

Three signposts make the sign intuitive:

  • Same general direction (): shadow points along , dot product positive.
  • Perpendicular (): no shadow, dot product zero.
  • Opposing directions (): shadow points backward, dot product negative.

Equation [3], , reveals that the dot product secretly contains the Pythagorean theorem — distance is just a dot product in disguise.

Vector projection of b onto a: the shadow of b along the direction of a

vector a vector b proj a b θ

Worked Examples

Angle Between Two Vectors

Given: and . Find the angle between them. Step 1 — Dot product (eq [2]):
Step 2 — Magnitudes (eq [3]):
Step 3 — Cosine (eq [4]):
Step 4 — Angle:

Work Done by a Force

Given: A constant force newtons acts on an object as it moves through displacement metres. Find the work done. Step 1 — Work is the dot product of force and displacement:
Step 2 — Compute (eq [2]):
Step 3 — Interpret: Only the force component along the displacement (the -direction) does work; the vertical component is perpendicular to motion and does none.

Vector Projection

Given: Project onto . Step 1 — Numerator (eq [2]): . Step 2 — Denominator: . Step 3 — Vector projection (eq [6]):

The shadow of on the -axis has length 4 — exactly the -component of , as expected.

Common Misconceptions

The Dot Product Is Not a Vector

The result of a dot product is always a scalar (a single number), never a vector. Writing "" is wrong. Do not confuse the dot product with the cross product, which yields a vector. Also note: there is no "vector division," and expressions like are meaningless.

Projection of b onto a ≠ Projection of a onto b

While the dot product is commutative (), projection is not symmetric. The scalar projection divides by , whereas projecting the other way divides by . They are generally different lengths in different directions.

Zero Dot Product Does Not Mean a Vector Is Zero

One might think implies one of the vectors is zero (as with ordinary numbers, where forces or ). False. Take and . Then , yet both vectors are nonzero. The dot product vanishes simply because they are perpendicular — the "zero-product property" does not transfer to vectors.

Connections

The dot product sits at the centre of a web of related ideas. It is one of two fundamental products of vectors; the other, the Cross Product, produces a perpendicular vector and measures area rather than alignment. The angle formula [4] depends on the Law of Cosines, and the magnitude formula [3] is a restatement of the Pythagorean Theorem in vector form. Projection generalizes to the Gram-Schmidt Process for building orthogonal bases, and the abstract version of the dot product is the Inner Product Space, which underlies advanced linear algebra and quantum mechanics. The concept of Orthogonality — defined by a zero dot product — is one of the most reused ideas in all of mathematics.

Real-World Applications

  • Physics — Work: computes mechanical work done by a force along a displacement; only the aligned component counts.
  • Computer Graphics — Lighting: The Lambertian shading model uses (surface normal dotted with light direction) to determine how brightly a surface is lit.
  • Machine Learning — Cosine Similarity: Search engines and recommendation systems compare documents or users by the cosine of the angle between their feature vectors, computed via equation [4].
  • 3D Game Engines — Back-Face Culling: A polygon is hidden if its normal's dot product with the view direction is positive, letting engines skip rendering unseen faces.
  • Engineering — Flux: The amount of fluid, heat, or electromagnetic field passing through a surface is computed as a dot product of the field with the surface's normal vector.
  • Robotics & Navigation: Determining whether a target lies ahead or behind a robot uses the sign of the dot product between the heading and the target direction.
  • Signal Processing: The correlation between two signals (and the Fourier transform's projections onto sine/cosine basis functions) are dot products in disguise.

Historical Development

  • 1799–1828: Caspar Wessel, Jean-Robert Argand, and Carl Friedrich Gauss develop the geometric representation of complex numbers, an early hint of 2D vector arithmetic.
  • 1843: William Rowan Hamilton discovers quaternions; their multiplication contains, hidden inside, both the dot and cross products of 3D vectors.
  • 1844: Hermann Grassmann publishes Die lineale Ausdehnungslehre, introducing an abstract "inner product" decades ahead of its time but in nearly unreadable form.
  • 1853: Augustin-Louis Cauchy and others formalize inequalities (the Cauchy–Schwarz inequality) that govern dot products.
  • 1881: J. Willard Gibbs prints private lecture notes at Yale introducing clean dot and cross product notation.
  • 1880s: Oliver Heaviside independently develops vector analysis to reformulate Maxwell's electromagnetism.
  • 1901: Gibbs and Edwin Bishop Wilson publish Vector Analysis, cementing the modern notation .
  • Early 1900s: David Hilbert and others generalize the dot product to infinite-dimensional inner product spaces, foundational to functional analysis and quantum mechanics.

Subtleties & Limits

The dot product as taught here lives comfortably in Euclidean space, but its generalizations raise deep questions. In special relativity, the relevant "inner product" (the Minkowski metric) uses a minus sign — — so a nonzero vector can have zero length (a "null" or light-like vector), breaking the comforting rule that is always positive. More abstractly, which spaces admit an inner product compatible with their structure, and how inner products interact with curvature (in Riemannian geometry), remains an active area where the simple high-school dot product becomes a varying field of metrics. Even the question of how to best define "angle" and "projection" in high-dimensional data spaces — where intuition fails and most random vectors are nearly orthogonal — drives ongoing research in data science.

See Also

Cross Product · Inner Product Space · Orthogonality · Law of Cosines · Vectors and Components · Cosine Similarity · Gram-Schmidt Process

Before this

Where this leads