Take the origin at the initial position of A and positive x-axis towards B. At a time t, xA and xB are the Co-ordinates of the particles. Gap = G = xB−xA
G=(20+12×1×t2)−(5t)
∴ The gap is minimum when dGdt=0
⇒ t=5 seconds
Minimum gap =20+12×(5)2−5(5)=7.5m=1.5×5(m)