Vectors in 2D and 3D — Dot and Cross Products

⚡ Key Takeaways

Vectors are quantities with both magnitude and direction. The dot product a⋅b=∣a∣∣b∣cos⁡θ\mathbf{a}\cdot\mathbf{b}=|\mathbf{a}||\mathbf{b}|\cos\theta yields a scalar measuring alignment; the cross product a×b\mathbf{a}\times\mathbf{b} (3D only) yields a vector perpendicular to both with magnitude ∣a∣∣b∣sin⁡θ|\mathbf{a}||\mathbf{b}|\sin\theta. Used everywhere in geometry, physics, engineering, and computer graphics. The dot product dates to Hamilton/Grassmann (1840s), formalised by Gibbs and Heaviside (1880s).

💡 The Core Insight

Two vectors carry two independent pieces of relational information: how much they point the same way (captured by the dot product, a scalar involving cos⁡θ\cos\theta) and how much they sweep out area between them (captured by the cross product, whose magnitude involves sin⁡θ\sin\theta). Together cos⁡θ\cos\theta and sin⁡θ\sin\theta fully determine the geometric relationship between two directions, so these two products let you answer essentially any metric question about vectors algebraically.

Formal Statement

DefinitionVector in component form

A vector in 2D is an ordered pair, and in 3D an ordered triple, of real numbers (its components):

1
a=⟨a1,a2⟩(2D),a=⟨a1,a2,a3⟩(3D).\quad \mathbf{a} = \langle a_1, a_2 \rangle \quad (\text{2D}), \qquad \mathbf{a} = \langle a_1, a_2, a_3 \rangle \quad (\text{3D}).

Derivation hint: components are the signed projections of the vector onto the coordinate axes ı^,ȷ^,k^\hat{\imath},\hat{\jmath},\hat{k}. Here a1,a2,a3a_1,a_2,a_3 are real scalars. The standard basis vectors are ı^=⟨1,0,0⟩\hat{\imath}=\langle1,0,0\rangle, ȷ^=⟨0,1,0⟩\hat{\jmath}=\langle0,1,0\rangle, k^=⟨0,0,1⟩\hat{k}=\langle0,0,1\rangle, so a=a1ı^+a2ȷ^+a3k^\mathbf{a}=a_1\hat{\imath}+a_2\hat{\jmath}+a_3\hat{k}. The magnitude (length, norm) is

2
∣a∣=a12+a22+a32.\quad |\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2}.

Derivation hint: apply the Pythagorean theorem twice, once in the xyxy-plane and once including the zz-axis.

DefinitionDot product

For vectors a\mathbf{a} and b\mathbf{b}, the dot product is defined componentwise and equivalently geometrically:

3
a⋅b=a1b1+a2b2+a3b3=∣a∣ ∣b∣cos⁡θ,\quad \mathbf{a}\cdot\mathbf{b} = a_1 b_1 + a_2 b_2 + a_3 b_3 = |\mathbf{a}|\,|\mathbf{b}|\cos\theta,

Derivation hint: equate the componentwise sum with the Law of Cosines applied to the triangle formed by a\mathbf{a}, b\mathbf{b}, a−b\mathbf{a}-\mathbf{b}. where θ∈[0,π]\theta\in[0,\pi] is the angle between the two vectors. The result is a scalar. (For 2D, drop the third term.)

DefinitionCross product

For 3D vectors, the cross product is the vector

4
a×b=⟨ a2b3−a3b2,  a3b1−a1b3,  a1b2−a2b1 ⟩,\quad \mathbf{a}\times\mathbf{b} = \langle\, a_2 b_3 - a_3 b_2,\; a_3 b_1 - a_1 b_3,\; a_1 b_2 - a_2 b_1 \,\rangle,

Derivation hint: expand the formal determinant det⁡(ı^ȷ^k^a1a2a3b1b2b3)\det\begin{pmatrix}\hat{\imath}&\hat{\jmath}&\hat{k}\\a_1&a_2&a_3\\b_1&b_2&b_3\end{pmatrix} along the first row. with magnitude and direction

5
∣a×b∣=∣a∣ ∣b∣sin⁡θ,\quad |\mathbf{a}\times\mathbf{b}| = |\mathbf{a}|\,|\mathbf{b}|\sin\theta,

Derivation hint: square equation [4], add the squared dot product, and use cos⁡2θ+sin⁡2θ=1\cos^2\theta+\sin^2\theta=1 (the Lagrange identity). The direction of a×b\mathbf{a}\times\mathbf{b} is perpendicular to both a\mathbf{a} and b\mathbf{b}, given by the right-hand rule.

TheoremKey algebraic properties

The dot product is commutative and distributive:

6
a⋅b=b⋅a,a⋅(b+c)=a⋅b+a⋅c.\quad \mathbf{a}\cdot\mathbf{b} = \mathbf{b}\cdot\mathbf{a}, \qquad \mathbf{a}\cdot(\mathbf{b}+\mathbf{c}) = \mathbf{a}\cdot\mathbf{b} + \mathbf{a}\cdot\mathbf{c}.

Derivation hint: both follow immediately from componentwise definition [3] and the commutativity/distributivity of real-number arithmetic. The cross product is anticommutative and not associative:

7
a×b=−(b×a),a×a=0.\quad \mathbf{a}\times\mathbf{b} = -(\mathbf{b}\times\mathbf{a}), \qquad \mathbf{a}\times\mathbf{a} = \mathbf{0}.

Derivation hint: swapping a\mathbf{a} and b\mathbf{b} swaps two rows of the determinant in [4], negating it; a matrix with two equal rows has determinant zero.

Why It Holds / Derivation

ProofGeometric form of the dot product

We show the componentwise formula [3] equals ∣a∣∣b∣cos⁡θ|\mathbf{a}||\mathbf{b}|\cos\theta.

Step 1. Place a\mathbf{a} and b\mathbf{b} tail-to-tail. The vector a−b\mathbf{a}-\mathbf{b} closes the triangle, opposite the angle θ\theta between them.

Step 2. By the Law of Cosines,

8
∣a−b∣2=∣a∣2+∣b∣2−2∣a∣∣b∣cos⁡θ.\quad |\mathbf{a}-\mathbf{b}|^2 = |\mathbf{a}|^2 + |\mathbf{b}|^2 - 2|\mathbf{a}||\mathbf{b}|\cos\theta.

Derivation hint: standard Law of Cosines with sides ∣a∣|\mathbf{a}|, ∣b∣|\mathbf{b}| and included angle θ\theta.

Step 3. Expand the left side using components and [2]:

9
∣a−b∣2=(a1−b1)2+(a2−b2)2+(a3−b3)2=∣a∣2+∣b∣2−2(a1b1+a2b2+a3b3).\quad |\mathbf{a}-\mathbf{b}|^2 = (a_1-b_1)^2 + (a_2-b_2)^2 + (a_3-b_3)^2 = |\mathbf{a}|^2 + |\mathbf{b}|^2 - 2(a_1b_1+a_2b_2+a_3b_3).

Derivation hint: expand each square and regroup the cross terms.

Step 4. Compare [8] and [9]. The ∣a∣2+∣b∣2|\mathbf{a}|^2+|\mathbf{b}|^2 terms cancel, leaving

10
a1b1+a2b2+a3b3=∣a∣∣b∣cos⁡θ.■\quad a_1b_1+a_2b_2+a_3b_3 = |\mathbf{a}||\mathbf{b}|\cos\theta. \qquad\blacksquare

Derivation hint: divide both leftover terms by −2-2.

∎
JW
Josiah Willard Gibbs
1839–1903

The American physicist and chemist Gibbs, while teaching at Yale, distilled Hamilton's cumbersome quaternion algebra into the clean dot- and cross-product notation used today. His privately printed lecture notes Elements of Vector Analysis (1881–84) — together with parallel work by the British engineer Oliver Heaviside — replaced quaternions with the two-product vector calculus that became the universal language of physics. Gibbs is also a founder of chemical thermodynamics and statistical mechanics.

Building Intuition

🧠 Intuition

Think of the dot product as asking: "How much of a\mathbf{a} goes in the direction of b\mathbf{b}?" If they point the same way, cos⁡θ=1\cos\theta=1 and the product is large and positive. Perpendicular vectors share no direction, so cos⁡90∘=0\cos90^\circ=0 and the dot product vanishes — this is the algebraic test for being at right angles. Opposing vectors give a negative dot product. The cross product answers a different question: "What is the area of the parallelogram these two vectors span, and which way is its surface facing?" The magnitude ∣a∣∣b∣sin⁡θ|\mathbf{a}||\mathbf{b}|\sin\theta is exactly that parallelogram's area, vanishing when the vectors are parallel (zero area). The direction sticks straight out of the plane — curl the fingers of your right hand from a\mathbf{a} toward b\mathbf{b}, and your thumb points along a×b\mathbf{a}\times\mathbf{b}.

Figure
Dot and cross product geometry: projection (left) and parallelogram area (right)
b a |a|cosθ θ Dot: projection of a onto b b a a×b area = |a||b|sinθ Cross: ⊥ vector, magnitude = area

Worked Examples

ExampleDot product: angle and work

Given: a=⟨3,4,0⟩\mathbf{a} = \langle 3, 4, 0 \rangle and b=⟨4,0,3⟩\mathbf{b} = \langle 4, 0, 3 \rangle. Find the angle between them. Then, treating b\mathbf{b} as a force in newtons and a\mathbf{a} as a displacement in metres, find the work done.

Step 1 — magnitudes: ∣a∣=9+16+0=5|\mathbf{a}| = \sqrt{9+16+0}=5, ∣b∣=16+0+9=5\quad |\mathbf{b}|=\sqrt{16+0+9}=5.

Step 2 — dot product (componentwise): a⋅b=(3)(4)+(4)(0)+(0)(3)=12\mathbf{a}\cdot\mathbf{b} = (3)(4)+(4)(0)+(0)(3) = 12.

Step 3 — angle: cos⁡θ=a⋅b∣a∣∣b∣=1225=0.48\cos\theta = \dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|} = \dfrac{12}{25} = 0.48, so θ=arccos⁡(0.48)≈61.3∘\theta = \arccos(0.48) \approx 61.3^\circ.

Step 4 — work: W=b⋅a=12W = \mathbf{b}\cdot\mathbf{a} = 12.

θ≈61.3∘,W=12 J\boxed{\theta \approx 61.3^\circ, \qquad W = 12 \text{ J}}
ExampleCross product: area and perpendicular

Given: Triangle with vertices P=(1,0,0)P=(1,0,0), Q=(2,2,0)Q=(2,2,0), R=(0,1,3)R=(0,1,3). Find the triangle's area and a vector normal to its plane.

Step 1 — edge vectors: u=PQ→=⟨1,2,0⟩\mathbf{u}=\overrightarrow{PQ}=\langle 1,2,0\rangle, v=PR→=⟨−1,1,3⟩\quad \mathbf{v}=\overrightarrow{PR}=\langle -1,1,3\rangle.

Step 2 — cross product (formula [4]):

u×v=⟨(2)(3)−(0)(1),  (0)(−1)−(1)(3),  (1)(1)−(2)(−1)⟩=⟨6,−3,3⟩.\mathbf{u}\times\mathbf{v} = \langle (2)(3)-(0)(1),\;(0)(-1)-(1)(3),\;(1)(1)-(2)(-1)\rangle = \langle 6, -3, 3\rangle.

Step 3 — magnitude: ∣u×v∣=36+9+9=54=36|\mathbf{u}\times\mathbf{v}| = \sqrt{36+9+9} = \sqrt{54} = 3\sqrt{6}.

Step 4 — triangle area (half the parallelogram): A=12 (36)=362≈3.67A = \tfrac12\,(3\sqrt6) = \tfrac{3\sqrt6}{2} \approx 3.67.

n=⟨6,−3,3⟩,A=362≈3.67 units2\boxed{\mathbf{n}=\langle 6,-3,3\rangle, \qquad A = \tfrac{3\sqrt6}{2} \approx 3.67 \text{ units}^2}

Common Misconceptions

⚠️ Common mistake

The cross product does not exist in 2D. Equation [4] requires three components. For 2D vectors, the closest analogue is the scalar a1b2−a2b1a_1b_2 - a_2b_1 — the zz-component you'd get by embedding the vectors in 3D. Treat this as a signed area, not a vector.

Do not confuse the two products. a⋅b\mathbf{a}\cdot\mathbf{b} is a scalar; a×b\mathbf{a}\times\mathbf{b} is a vector. Writing "a⋅b\mathbf{a}\cdot\mathbf{b}" where a direction is needed (or vice versa) is a type error.

The cross product is not associative. In general (a×b)×c≠a×(b×c)(\mathbf{a}\times\mathbf{b})\times\mathbf{c} \neq \mathbf{a}\times(\mathbf{b}\times\mathbf{c}). Use the BAC–CAB identity a×(b×c)=b(a⋅c)−c(a⋅b)\mathbf{a}\times(\mathbf{b}\times\mathbf{c}) = \mathbf{b}(\mathbf{a}\cdot\mathbf{c}) - \mathbf{c}(\mathbf{a}\cdot\mathbf{b}) when expanding triple products.

Counterexample

A student claims "a⋅b=0\mathbf{a}\cdot\mathbf{b}=0 means a=0\mathbf{a}=\mathbf{0} or b=0\mathbf{b}=\mathbf{0}," by analogy with real-number multiplication. Counterexample: a=⟨1,0⟩\mathbf{a}=\langle1,0\rangle, b=⟨0,1⟩\mathbf{b}=\langle0,1\rangle gives a⋅b=0\mathbf{a}\cdot\mathbf{b}=0 though neither vector is zero. The dot product can vanish for nonzero vectors — precisely when they are perpendicular. Likewise a×b=0\mathbf{a}\times\mathbf{b}=\mathbf{0} does not force either factor to vanish; it happens whenever the vectors are parallel.

Connections

connection

The dot product is the prototype of an inner product, generalising to function spaces and underpinning Orthogonality and Fourier Series. The expression ∣a∣=a⋅a|\mathbf{a}|=\sqrt{\mathbf{a}\cdot\mathbf{a}} links it to the Pythagorean Theorem and the Euclidean metric. The cross product determinant in [4] connects directly to Determinants and the Scalar Triple Product, which computes volumes. Both products are bilinear, foreshadowing Linear Transformations and Matrix Multiplication. In physics, the dot product defines Work and Energy while the cross product defines Torque and Angular Momentum.

Real-World Applications

🔬 Where this appears

Historical Development

⏳ History
- 1799 / 1806: Caspar Wessel and Jean-Robert Argand independently represent complex numbers as directed segments in the plane — an embryonic 2D vector idea.
- 1843: William Rowan Hamilton discovers quaternions, inventing the words scalar and vector; quaternion multiplication secretly contains both dot and cross products.
- 1844: Hermann Grassmann publishes Die lineale Ausdehnungslehre, a far-reaching but largely ignored theory of nn-dimensional vector spaces and outer products.
- 1853: Hamilton's Lectures on Quaternions spreads the framework, despite its complexity.
- 1881–1884: J. W. Gibbs prints Elements of Vector Analysis for his Yale students, isolating the clean dot and cross products.
- 1880s: Oliver Heaviside, reformulating Maxwell's equations, independently develops the same vector calculus, championing it for physics.
- 1893–1894: The "Great Quaternion Debate" rages in Nature; Gibbs and Heaviside defend vectors against quaternion purists like Peter Tait.
- 1901: Edwin Bidwell Wilson publishes Vector Analysis, based on Gibbs's lectures — the first textbook in the modern notation, cementing today's conventions.

Subtleties & Limits

open-problem

The cross product as a bilinear, perpendicular-producing operation exists in only two dimensions: 3 and 7 — a deep result tied to the existence of the quaternions and octonions (Hurwitz's theorem on normed division algebras). In all other dimensions, "the area and normal of two vectors" is captured instead by the wedge product a∧b\mathbf{a}\wedge\mathbf{b} of exterior algebra, which produces a bivector rather than a vector. The 3D cross product is really the wedge product followed by the Hodge star that, by happy coincidence of dimension, maps bivectors back to vectors. This is why a×b\mathbf{a}\times\mathbf{b} is technically a pseudovector (axial vector): it flips sign under reflection, unlike ordinary (polar) vectors — a subtlety that matters in physics whenever mirror symmetry is involved.

See Also

Vector Addition · Orthogonality · Projections · Scalar Triple Product · Determinants · Torque · Work and Energy · Quaternions