Sub topic 11
Time and distance of closest approach
This chapter assumes you know vector components, the relation vAB = vA − v_B, and basic trigonometry. The goal is to find when two moving bodies are nearest to each other and how near they get.
Reduce the problem to one body
Treat A as if it were at rest and let B move with the relative velocity. Two numbers describe B's motion as seen from A:
- r: the position of B relative to A at t = 0, so r = rB − rA.
- v: the velocity of B relative to A, so v = vB − vA.
Both bodies must move with constant velocity. Then B travels in a straight line as seen from A, and the closest approach is the point on that line nearest to A.
Derivation
At time t, the relative position is r + vt. The squared separation is
d² = r² + 2(r·v)t + v²t²
This is a quadratic in t with a positive leading coefficient. It is smallest where its derivative is zero:
t_min = −(r·v) / v²
Substituting back gives the minimum distance:
d_min = |r × v| / |v| = r sinφ
Here φ is the angle between −r (the line from B back to A) and v. In words, dmin is the perpendicular distance from A to B's relative path. At tmin the relative position is perpendicular to the relative velocity.
Worked example
B is 10 m directly north of A. B moves east at 4 m/s. A moves with velocity (1, 4) m/s, with east as x and north as y.
- r = (0, 10) and v = (4, 0) − (1, 4) = (3, −4).
- v² = 25 and r·v = 0·3 + 10·(−4) = −40.
- t_min = 40/25 = 1.6 s.
- d_min = |0·(−4) − 10·3| / 5 = 30/5 = 6 m.
Check: at t = 1.6 s the relative position is (4.8, 3.6). Its dot product with v is 14.4 − 14.4 = 0, so it is perpendicular to v, as the derivation requires.
The same calculation in Python:
import math
def closest_approach(r, v):
"""r: position of B relative to A at t = 0, as (x, y).
v: velocity of B relative to A, as (vx, vy).
Returns (time of closest approach, minimum distance) for t >= 0."""
vv = v[0] ** 2 + v[1] ** 2
if vv == 0:
return 0.0, math.hypot(*r)
t = max(0.0, -(r[0] * v[0] + r[1] * v[1]) / vv)
return t, math.hypot(r[0] + v[0] * t, r[1] + v[1] * t)
print(closest_approach((0.0, 10.0), (3.0, -4.0)))The output is 1.6 and 6, apart from floating-point rounding.
Common errors
| Error | Why it is wrong | Fix | Column | Column |
|---|---|---|---|---|
| Using r = r_A − r_B with v = v_B − v_A | The signs are inconsistent, so t comes out wrong | Define both as "B relative to A" | ||
| Ignoring the sign of t | A negative t means the closest approach was in the past | If r·v ≥ 0, the answer is t = 0 and d = \ | r\ | |
| Setting d_min = 0 as a collision test | This is true only if r is parallel to −v | Compute d_min and check whether it is 0 | ||
| Subtracting speeds instead of velocities | The directions are lost | Subtract components |
Useful checks
- If dmin = 0, the bodies collide at tmin.
- If the two bodies have the same velocity, v = 0 and their separation never changes.
- Only the relative velocity matters. Adding the same velocity to both bodies changes nothing.
Exercise
Ship P is at the origin and moves north at 6 m/s. Ship Q is 8 m east of P and moves west at 2 m/s. Taking Q relative to P, find the time of closest approach and the minimum distance.
Show answer
r = (8, 0) and v = (−2, 0) − (0, 6) = (−2, −6). Then v² = 40 and r·v = −16. So t_min = 16/40 = 0.4 s. The minimum distance is |r × v|/|v| = |8·(−6) − 0·(−2)|/√40 = 48/√40 ≈ 7.6 m.