Mathematics

Vectors and space

Vectors, dot and cross products, planes, and distance in 3D.

Basics

Vectors

A vector has magnitude and direction. Add componentwise; scalar multiplication stretches or flips. A position vector runs from the origin to a point; a displacement runs between points. In the basis {i, j, k}, a = a_x i + a_y j + a_z k. A unit vector keeps only direction; the zero vector has length 0. Force, velocity, and electric field speak this language.

Dot and cross products

The dot product a·b = |a||b|cosθ is a scalar. Zero means perpendicular; work is W=F·s. The cross product a×b is a vector of size |a||b|sinθ, perpendicular by the right-hand rule. Parallel vectors have cross product 0; it gives parallelogram area and torque τ=r×F. The familiar vector cross product is 3D; in 2D one often keeps a scalar “signed area”.

Planes

A plane through r₀ with normal n satisfies n·(r − r₀) = 0, or ax+by+cz = d. The cross product of two direction vectors gives a normal. Three points fix a plane unless they are collinear. Planes are parallel when their normals are. Intersect a line with a plane by substituting the parametric line into the plane equation.

Distance in 3D

Distance between points is √((Δx)²+(Δy)²+(Δz)²) — Pythagoras stacked once more. Point-to-plane is |ax₀+by₀+cz₀−d| / √(a²+b²+c²). Skew lines meet a common perpendicular whose length is the distance. The shortest path is always the perpendicular; optimization, graphics, and mechanics reuse the same formulae.

Formulas

Dot product

a · b = a_x b_x + a_y b_y + a_z b_z = |a| |b| cosθ

Zero means perpendicular. The projection onto û is (a·û) û.

Symbols

  • θ angle between the vectors

Cross product (components)

a × b = (a_y b_z − a_z b_y, a_z b_x − a_x b_z, a_x b_y − a_y b_x)

Right-hand perpendicular. |a×b| is parallelogram area.

Plane equation

n · (r − r₀) = 0

Normal n, one point r₀. Same as ax+by+cz = d.

Symbols

  • n normal vector
  • r₀ a point on the plane

Point-to-plane distance

dist = |a x₀ + b y₀ + c z₀ − d| / √(a² + b² + c²)

Plane ax+by+cz = d and point (x₀,y₀,z₀).

Symbols

  • (x₀,y₀,z₀) the point

Key table

Unit vector â = a / |a| (|a| ≠ 0)
Scalar triple product a · (b × c) = signed parallelepiped volume
Two-point distance |r₂ − r₁| = √(Δx² + Δy² + Δz²)

In this field