Derivatives and Integrals of Vector Functions
The derivative of a vector function is again a vector: it points along the curve and its length is the speed at which the curve is traced. This lesson defines it as a limit, proves that it can be computed component by component, establishes the product rules for dot and cross products, and integrates vector functions to recover positions from velocities.
For a first look at velocity vectors along curves, see Motion; the plane case is in Calculus with Parametric Curves.
The derivative
For a vector function , define
when the limit exists. Geometrically, is a secant vector from one point of the curve to a nearby one; dividing by rescales it, and as it turns into the tangent vector .
Theorem (componentwise). If with differentiable, then .
Proof: the difference quotient is
and the limit of a vector function is the vector of component limits.
Vocabulary:
| Term | Definition |
|---|---|
| tangent vector at | , provided exists and |
| unit tangent vector | |
| tangent line at | the line through with direction : |
| smooth parametrisation | is continuous and on the interval |
| piecewise smooth | made of finitely many smooth pieces joined continuously |
The condition matters. is differentiable everywhere, but and the curve (a semicubical parabola) has a sharp cusp at the origin. A zero derivative lets a curve turn on the spot, so "differentiable" alone does not mean "no corners".
import sympy as sp
t = sp.symbols("t")
r = sp.Matrix([sp.exp(t), t * sp.cos(t), 1 + t**2])
dr = r.diff(t)
print("r'(t) =", list(dr))
t0 = 0
P, v = r.subs(t, t0), dr.subs(t, t0)
T = v / v.norm()
print("point P =", list(P), " r'(0) =", list(v))
print("unit tangent T(0) =", list(sp.simplify(T)))
s = sp.symbols("s")
print("tangent line L(s) =", list(P + s * v))r'(t) = [exp(t), -t*sin(t) + cos(t), 2*t]
point P = [1, 0, 1] r'(0) = [1, 1, 0]
unit tangent T(0) = [sqrt(2)/2, sqrt(2)/2, 0]
tangent line L(s) = [s + 1, s, 1]
The second derivative is ; for a moving particle is velocity and acceleration (next lessons).
Differentiation rules
Let be differentiable vector functions, a scalar, a differentiable real function.
Proof of rule 4: write , . Then is a real function, and by the ordinary product rule
Rule 5 has the same proof applied to each component of the cross product (each is a sum of products like ); the order of factors is kept because the cross product is anticommutative.
Corollary (constant length perpendicular). If for all , then .
A curve on a sphere centred at the origin always moves tangent to the sphere. Applied to the unit tangent (), it gives , which is how the normal vector is defined in Arc Length and Curvature. Applied to velocity, a particle moving at constant speed has acceleration perpendicular to its velocity.
import sympy as sp
t = sp.symbols("t", real=True)
# a curve on the sphere of radius 3 (a "baseball seam"-like path)
r = 3 * sp.Matrix([sp.cos(t) * sp.cos(sp.sin(2*t)), sp.sin(t) * sp.cos(sp.sin(2*t)), sp.sin(sp.sin(2*t))])
print("|r|^2 simplifies to:", sp.simplify(r.dot(r)))
print("r . r' simplifies to:", sp.simplify(r.dot(r.diff(t))))
u = sp.Matrix([t, t**2, 1])
v = sp.Matrix([sp.sin(t), 0, t])
lhs = u.cross(v).diff(t)
rhs = u.diff(t).cross(v) + u.cross(v.diff(t))
print("cross-product rule holds:", sp.simplify(lhs - rhs) == sp.zeros(3, 1))|r|^2 simplifies to: 9
r . r' simplifies to: 0
cross-product rule holds: True
Integrals
Integrals are also taken componentwise:
This agrees with the Riemann-sum definition , since a sum of vectors is summed by components. The Fundamental Theorem of Calculus carries over: if then . Indefinite integrals have a constant vector instead of a constant number, and one initial condition (a vector) fixes all three constants at once.
import sympy as sp
t = sp.symbols("t")
v = sp.Matrix([2 * t, sp.cos(t), 1 / (1 + t)]) # velocity
r0 = sp.Matrix([1, 0, -2]) # position at t = 0
R = v.applyfunc(lambda c: sp.integrate(c, (t, 0, t))) # ∫₀ᵗ v
r = r0 + R
print("r(t) =", list(r))
print("check r'(t) == v(t):", sp.simplify(r.diff(t) - v) == sp.zeros(3, 1))
print("displacement over [0, pi]:", list(R.subs(t, sp.pi)))r(t) = [t**2 + 1, sin(t), log(t + 1) - 2]
check r'(t) == v(t): True
displacement over [0, pi]: [pi**2, 0, log(1 + pi)]
Note: Integration does not commute with taking lengths: , with equality only when keeps a fixed direction. Applied to velocity, this says displacement is at most the distance travelled.
In software
- Tangents for orientation. Games orient a vehicle, a camera on a rail or a projectile's sprite along . A zero derivative (a "stopped" spline segment, two equal control points of a Bézier curve) makes undefined, the source of sudden flips; engines guard it with a fallback direction.
- Smoothness classes. Splines are judged by which derivatives are continuous across joints: (no gaps), (no kinks in velocity), (no jumps in acceleration, felt as jerks in a camera move). Catmull-Rom splines are ; cubic B-splines are .
- Velocity to position. Physics engines integrate velocity to get position each frame, a numerical version of ; see Integrators.
- Automatic differentiation. Libraries like JAX or PyTorch differentiate vector-valued functions with exactly the componentwise rule; for the derivative is a column of partial derivatives (a Jacobian with one column).
Exercises
Exercise 1: Derivative and unit tangent
For , find and .
Answer
; .
Solution
Exercise 2: Tangent line
Find the tangent line to at the point .
Answer
.
Solution
is . , so . The line is .
Exercise 3: A definite integral
Evaluate .
Answer
.
Solution
import sympy as sp
t = sp.symbols("t")
res = [sp.integrate(c, (t, 0, 1)) for c in [3*t**2, 1/(1 + t), sp.exp(2*t)]]
print(res, [round(float(x), 4) for x in res])[1, log(2), -1/2 + exp(2)/2] [1.0, 0.6931, 3.1945]
Exercise 4: Constant speed
Prove: if a particle moves with constant speed, , then its acceleration is perpendicular to its velocity.
Answer
for all .
Solution
Apply the corollary to the vector function instead of :
So the acceleration can only change the direction of motion, not the speed, the situation of uniform circular motion.
Exercise 5: Derivative of a triple product (code)
Show that , and check it with SymPy for , , .
Answer
Here , and both sides equal . The identity follows from rules 4 and 5.
Solution
By rule 4, , and by rule 5, . Distribute the dot product.
import sympy as sp
t = sp.symbols("t")
u, v, w = sp.Matrix([t, 1, 0]), sp.Matrix([0, t**2, 1]), sp.Matrix([1, 0, sp.exp(t)])
lhs = sp.expand(u.dot(v.cross(w)).diff(t))
rhs = sp.expand(u.diff(t).dot(v.cross(w)) + u.dot(v.diff(t).cross(w)) + u.dot(v.cross(w.diff(t))))
print(lhs, "|", sp.simplify(lhs - rhs))t**3*exp(t) + 3*t**2*exp(t) | 0
Test yourself
If is constant, which statement is always true?
- is parallel to
- is constant
What is the correct derivative of ?
is differentiable everywhere. Why is it not a smooth parametrisation near ?
- Because
- Because , so the curve can form a cusp
- Because its components are polynomials
- Because does not exist