distance traveled by particle 'a' (s1)
s1=u1*t +1/2 *a1*t2
s1=3*t + t2 / 2
distance traveled by particle 'b'(s2)
s2= u2 *t + 1/2*a2*t2
s2= t + t2
s1 - s2= 2t-t2/2
Minimizing s1 - s2 differentiate the above equation and equate it with zero
we get t=2sec
put the value of t in s1 and s2 and get the required distance