Sub topic 11
Time and distance of closest approach
This chapter assumes you can add and subtract vectors in components, use v = u + at for constant velocity motion, and solve a quadratic. It also assumes you know the relation vAB = vA − v_B from the previous chapter. Here we use that relation to answer a standard JEE question: two bodies move with constant velocities, so when are they nearest, and how near do they get?
The idea: freeze one body
Distance between two bodies depends only on their relative position. So you can ride along with A, treat A as at rest, and let B move with the relative velocity. If both bodies have constant velocity, the relative velocity is constant too. B then moves along a straight line past A, which sits at a fixed point.
The nearest point on a straight line to a fixed point is the foot of the perpendicular dropped from that point to the line. That one geometric fact gives both answers.
Define these quantities, all measured at t = 0:
- r is the position of B relative to A, r = rB − rA.
- v is the velocity of B relative to A, v = vB − vA.
- |v| is the relative speed.
At time t the separation vector is r + vt. Its length is the distance between the bodies.
Deriving the formulas
Write the squared distance as a function of time:
d²(t) = |r + vt|² = |r|² + 2(r·v)t + |v|²t²
This is a quadratic in t with a positive leading coefficient, so it has a minimum. Setting the derivative to zero gives 2(r·v) + 2|v|²t = 0, so
t_min = −(r·v) / |v|²
Substituting back gives the minimum distance. In 2D it is easiest to write it with the cross product:
dmin = |rx vy − ry v_x| / |v|
A geometric version avoids vector algebra. Let φ be the angle between the relative velocity v and the line from B back to A, which is the direction −r. Then the perpendicular from A to the relative path gives:
- d_min = |r| sin φ
- t_min = |r| cos φ / |v|
The second formula says that B travels the distance |r| cos φ along its relative path before reaching the foot of the perpendicular, at relative speed |v|.
Worked example: a near miss
At t = 0, body A has velocity (2, 5) m/s and body B has velocity (5, 1) m/s. B is 10 m directly "above" A, so r = (0, 10) m.
- Relative velocity: v = (5, 1) − (2, 5) = (3, −4) m/s, so |v| = 5 m/s.
- Dot product: r·v = 0·3 + 10·(−4) = −40. It is negative, so B is approaching A.
- Time: t = 40 / 25 = 1.6 s.
- Separation at that time: r + vt = (0 + 4.8, 10 − 6.4) = (4.8, 3.6), with length 6 m.
- Check with the cross product: |0·(−4) − 10·3| / 5 = 30 / 5 = 6 m.
- Check with the angle: cos φ = 40 / (10 × 5) = 0.8, sin φ = 0.6, so d_min = 10 × 0.6 = 6 m and t = 10 × 0.8 / 5 = 1.6 s.
All three routes agree. Now the same calculation in code:
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, 6.0), matching the hand calculation. Two details in the function matter. The max(0.0, ...) handles bodies that are already separating. The vv == 0 branch handles bodies with equal velocities, where the distance never changes.
Worked example: collision or miss?
Two cars approach a right-angle junction. Car A is 60 m west of the junction, driving east at 6 m/s. Car B is 80 m south of it, driving north at 8 m/s. Take the junction as the origin.
- A starts at (−60, 0) with velocity (6, 0).
- B starts at (0, −80) with velocity (0, 8).
- r = (60, −80) and v = (−6, 8), so |v| = 10 m/s.
- r·v = −360 − 640 = −1000, so t = 1000 / 100 = 10 s.
- r + vt = (60 − 60, −80 + 80) = (0, 0).
The separation is zero, so the cars collide at the junction after 10 s. Checking directly agrees: A needs 60/6 = 10 s to reach the junction, and B needs 80/8 = 10 s.
Now move B back to 100 m south of the junction. Then r = (60, −100), and v is unchanged.
- r·v = −360 − 800 = −1160, so t = 11.6 s.
- r + vt = (60 − 69.6, −100 + 92.8) = (−9.6, −7.2), with length 12 m.
- Cross product check: |60·8 − (−100)(−6)| / 10 = |480 − 600| / 10 = 12 m.
The cars miss by 12 m at t = 11.6 s. Note that the time of closest approach is not the time either car reaches the junction. Car A arrives at 10 s and car B at 100/8 = 12.5 s, and the closest approach falls between those times.
Collision condition
Bodies collide exactly when the relative path passes through A. That requires two things:
- r and v are antiparallel. Equivalently, r × v = 0 and r·v < 0.
- d_min = 0 at a finite t > 0.
In words: B must point its relative velocity straight at A. In JEE problems this is often phrased as "the line of sight does not rotate". If the direction of r stays constant while |r| shrinks, the bodies will collide. The junction example is exactly this case: r = (60, −80) is antiparallel to v = (−6, 8).
Special cases and edge cases
| Situation | Sign of r·v | Result | Column | Column |
|---|---|---|---|---|
| B approaching A | negative | closest approach at t = −(r·v)/\ | v\ | ² > 0 |
| B already receding | zero or positive | closest approach is at t = 0, so d_min = \ | r\ | |
| Equal velocities | v = 0 | distance is constant, no closest approach | ||
| Aimed straight at A | r × v = 0, r·v < 0 | collision |
def classify(r, v, tol=1e-9):
vv = v[0] ** 2 + v[1] ** 2
if vv == 0:
return "constant separation"
dot = r[0] * v[0] + r[1] * v[1]
cross = r[0] * v[1] - r[1] * v[0]
if dot >= 0:
return "separating"
if abs(cross) < tol:
return "collision"
return "near miss"
print(classify((60, -80), (-6, 8)))
print(classify((60, -100), (-6, 8)))
print(classify((3, 4), (1, 1)))The three calls print collision, near miss and separating.
Common errors
- Forgetting the t ≥ 0 check. The quadratic d²(t) has its minimum at the computed t even when that t is negative. A negative t means the nearest approach was in the past, so the answer for the future is d = |r| at t = 0.
- Measuring the minimum distance along an axis. The shortest distance is perpendicular to the relative path, not along x or y.
- Using this method when acceleration is not constant. The straight-line relative path needs a constant v. If the bodies have different accelerations, the relative path is a curve. Then fall back on minimising d²(t) by calculus, solving d(d²)/dt = 0 for t.
- Expecting the answer to change with the frame. Distance and time are the same in every inertial frame. Choose whichever frame makes r and v easiest to write, and A's frame is usually the right one.
Exercises
Exercise
At t = 0, body A is at the origin with velocity (5, 0) m/s. Body B is at (20, 0) m with velocity (2, 4) m/s. Find the time of closest approach and the minimum distance.
Show answer
Relative position r = (20, 0) m. Relative velocity v = (2, 4) − (5, 0) = (−3, 4) m/s, so |v|² = 25. The dot product r·v = −60, so t = 60/25 = 2.4 s. The separation then is r + vt = (20 − 7.2, 9.6) = (12.8, 9.6) m, with length 16 m. Check: |20·4 − 0·(−3)| / 5 = 16 m. So t = 2.4 s and d_min = 16 m.
Exercise
A is at the origin and B is at (3, 4) m. Their relative velocity (B with respect to A) is (1, 1) m/s. When are they closest, and what is the minimum distance?
Show answer
The dot product r·v = 3 + 4 = 7 is positive, so B is moving away from A. The formula gives t = −7/2 = −3.5 s, which is in the past. For t ≥ 0 the closest approach is at t = 0, and d_min = |r| = 5 m.