A is 2mi away from B

Let r = rate of A

And s = rate of B

And, say, r is faster than s.

Be consistent with units.

units for distance is mi.

units for time is hr.

units for rate in mi/hr.

So, 12 minutes = 12/60 = 1/5 hr

distance = rate * time

They jog toward each other

r(1/5) +s(1/5) = 2

So,

r +s = 10 -------------(1)

They jog in the same direction

(distance traveled by A) = (2 mi. + distance traveled by B)

r(2.0) = 2 +s(2.0)

2r = 2 +2s

r = 1 +s

r -s = 1 ---------(2)