DOC

How calculators work

Vectors, Dot Products, and the Geometry of Work

See how the dot product connects vector components, projections, angles, mechanical work, line integrals, and power—with units, rearrangements, examples, and limits.

A force can be large and still do no mechanical work. Hold a heavy bag while walking across a level floor: the supporting force is mostly vertical while the displacement is horizontal. Push against a wall that never moves and the displacement is zero. Pull a sled at an angle and only part of the pull points along its motion.

The dot product is the operation that separates these cases. Algebraically, it pairs matching components. Geometrically, it measures alignment through a cosine. Physically, it selects the part of a force that acts along a displacement. Those are not three unrelated tricks; they are three views of the same scalar.

A person pulls a loaded sled with an angled rope while a shorter horizontal band shows the force projection along the motion
The full pull has magnitude and direction. Work depends on the signed projection of that pull along the displacement.
One scalar, three viewsa · b = Σ aibi = |a||b| cos θ
componentspair like directions
geometrymeasure alignment
physicskeep the force along motion

A vector is more than a list of numbers

In an orthonormal Cartesian basis, a vector can be written as

a = axî + ayĵ + az

The unit vectors carry direction and are dimensionless. The scalar components carry the vector's physical unit.

For displacement, the components are measured in metres; for force, newtons. A displacement is a change in position, d = rf − ri, not the final position vector by itself. Moving the coordinate origin must not change physical work.

The component formula also carries a hidden contract: both vectors must use the same orthonormal basis, reference frame, and compatible units. Pairing “east, north, up” components with numbers expressed in a rotated body frame has no physical meaning until one vector is transformed. NASA/JPL’s NAIF documentation states this operational requirement directly for vector-rate calculations. In a non-orthonormal basis, a raw sum of component products is generally wrong; a metric or Gram matrix is needed.

a, bnonzero vectors when finding an angleunits depend on the quantities
ai, biscalar components in one common basissame units as their vectors
|a|, |b|Euclidean magnitudesnonnegative, same units as vectors
θsmaller angle between nonzero vectors0 to π radians, or 0° to 180°
a · bsigned scalar resultproduct of the two vector units

Why component multiplication becomes a cosine

For two nonzero vectors, form the triangle whose sides are a, b, and a − b. The law of cosines says

geometry|a − b|² = |a|² + |b|² − 2|a||b| cos θ
components|a − b|² = (a − b) · (a − b) = |a|² + |b|² − 2a · b
compare the middle termsa · b = |a||b| cos θ

The equality explains the sign:

acute angle0° ≤ θ < 90°a · b > 0

The vectors mostly point together.

right angleθ = 90°a · b = 0

Neither has a component along the other.

obtuse angle90° < θ ≤ 180°a · b < 0

The vectors mostly oppose one another.

This sign rule is stated in the official OpenStax treatment of products of vectors. The zero case is called orthogonality, but a zero dot product does not tell you which vector has what magnitude. It reports alignment, not size by itself.

Projection turns alignment into a usable component

Let b̂ = b/|b| be the unit vector along a nonzero b. The signed scalar projection of a onto b is the amount of a in that direction:

scalar projectioncompba = a · b̂ = (a · b)/|b|

A signed scalar with the units of a.

vector projectionprojba = [(a · b)/(b · b)]b

A vector pointing along or opposite b.

perpendicular remaindera = a − projba

Check: a · b = 0.

The OpenStax Calculus projection formulas make the geometry explicit. Projection onto the zero vector is undefined because there is no target direction and b · b is zero.

The angle can be recovered when both vectors are nonzero:

find the angleθ = arccos[(a · b)/(|a||b|)]
find a parallel force componentF = W/d
find constant-force workW = Fd cos θ
find force magnitudeF = W/(d cos θ)
find displacement magnituded = W/(F cos θ)
find the force–displacement angleθ = arccos[W/(Fd)]

These inverse forms have domains. Do not divide by zero displacement or by cos θ = 0. For angle recovery, reject zero norms and ratios genuinely outside [−1,1]. Software may clamp only a tiny floating-point overshoot such as 1 + ε; clamping a materially invalid ratio hides bad inputs. Label degrees versus radians.

A craftsperson aligns three pairs of component blocks in matching grooves and their signed overlap pieces collect on one weighing pan
Component arithmetic pairs matching directions and adds their signed contributions. The final dot product is one scalar, not another vector.

Mechanical work is a force–displacement dot product

For a constant force acting while its point of application undergoes displacement d,

W = F · d = Fd cos θ = Fd
Wwork done by the stated forcejoules, J
Fconstant force magnitudenewtons, N
ddisplacement magnitudemetres, m
θangle between force and displacementdegrees or radians, consistently

This is work done by that force, not necessarily net work. During one motion, gravity, friction, a normal force, tension, and an applied force can make separate positive, negative, or zero contributions. Their sum is net work.

The unit check is direct:

force1 N = 1 kg·m·s−2
×
displacement1 m
=
work1 J = 1 N·m = 1 kg·m²·s−2

The BIPM/CIPM definition describes one joule as the work done when a one-newton force moves its point of application one metre in the force direction. Torque has the same base dimensions but is a different quantity: it comes from a cross product and is conventionally written in N·m, never joules. Both the current BIPM SI Brochure and NIST’s SI guide preserve that distinction.

Worked example 1: an angled pull across level ground

A constant force of 120 N acts 25° above the horizontal while its point of application moves 18.0 m horizontally to the right. Treat the values as supporting three significant figures.

1. Choose axes+x right, +y up
2. Resolve the forceF = (120 cos25°, 120 sin25°) = (108.7569, 50.7142) N
3. Write displacementd = (18.0, 0) m
4. Pair componentsW = Fxdx + Fydy = (108.7569)(18.0) + (50.7142)(0)
5. Calculate workW = 1957.6248 J ≈ 1.96 kJ
6. Geometric checkFd cosθ = (120)(18.0)cos25° = 1957.6248 J

The magnitude check √(108.7569² + 50.7142²) = 120.0000 N confirms the component split. The vertical force component does zero work because vertical displacement is zero. The result is positive and less than the aligned maximum Fd = 2160 J, consistent with an acute nonzero angle.

Worked example 2: negative work in three dimensions

Let a constant force and displacement be

F = (4, −2, 5) Nd = (3, 6, −1) m
1. Dot productW = 4(3) + (−2)(6) + 5(−1) = 12 − 12 − 5 = −5 J
2. Magnitudes|F| = √45 = 6.70820 N; |d| = √46 = 6.78233 m
3. Alignmentcosθ = −5/(√45√46) = −0.1098967
4. Angleθ = arccos(−0.1098967) = 96.3094°
5. Scalar projectioncompdF = −5/√46 = −0.737210 N
6. Vector projectionprojdF = (−5/46)(3,6,−1) ≈ (−0.326087, −0.652174, 0.108696) N

The obtuse angle agrees with negative work: the force’s parallel component points opposite the displacement. A forward check gives |F||d|cosθ = −5 J. Subtracting the vector projection from F leaves a perpendicular remainder whose dot product with d is zero apart from floating-point roundoff.

Negative work does not mean “negative energy exists.” It means this force transfers energy out of the chosen object or system under the stated sign convention.

A curved path turns one dot product into a line integral

The compact formula F · Δr is exact when the force vector is constant over the motion. If magnitude or direction changes with position, divide the path into infinitesimal displacements:

local workdW = F(r) · dr
work along path CWA→B = ∫C F(r) · dr = ∫C(Fxdx + Fydy + Fzdz)
instantaneous powerP = dW/dt = F · v
average powerPavg = ΔW/Δt

The OpenStax work chapter identifies this as a line integral. The curve matters for a general force because the local force is projected onto each local path direction. Average power is not generally Favg · vavg; the instantaneous relation and time averaging must be kept distinct, as shown in the OpenStax power treatment.

A person pushes a cart along a winding path where four local force streamers create short tangent contributions that accumulate into one trail
Along a curved path, the relevant alignment changes point by point. A line integral accumulates those local force–displacement dot products.

Path independence belongs only to conservative forces

For a conservative force, work between two endpoints is independent of the path and work around a closed loop is zero. Its potential energy satisfies

WA→B, cons = −ΔU = UA − UB

This relation applies to the work of the conservative force whose potential energy is being used. It does not turn friction or an arbitrary applied force into an endpoint-only calculation.

A curved path can still give path-independent work for a conservative force. A straight path does not make a nonconservative force path independent. Geometry alone is not the test; the force field is. OpenStax gives the endpoint and closed-loop criteria in its treatment of conservative and nonconservative forces.

Common failures and what they change

FailureWhy it failsRepair
Use final position instead of displacementWork would change when the coordinate origin moves.Compute rf − ri.
Multiply mismatched component listsDifferent frames or bases pair different physical directions.Transform both vectors into one common orthonormal basis.
Mix component unitsThe terms cannot represent one scalar sum.Convert compatible units before multiplying.
Ignore angle modecos25° and cos25 rad are different numbers.State and verify degrees or radians.
Find an angle with a zero vectorThe norm product is zero and the vector has no direction.Return undefined; do not invent an angle.
Assume motion means positive workEach force has its own signed alignment with displacement.Compute each force's dot product separately.
Use F · Δr for a varying forceOne vector cannot represent changing magnitude or direction.Evaluate the path line integral.
Write torque in joulesTorque and work share dimensions but are different quantities.Use N·m for torque and J for work.

The dot product is compact because it carries so much structure at once: basis, units, direction, sign, and projection. A reliable calculation keeps that structure visible. It asks not merely “how large is the force?” but “how much of this force acts along this displacement, in this frame, over this path?”