distance = velocity x time
Assume the distance moved by your friend is "d" and that the time taken for you to catch to him is "t"
you are moving with a velocity of 18 mph and your friend is moving with a velocity of 12 mph.
distance covered by your friend (d) = 12t miles ......> equation 1
If you add 3 to your rate, your distance will be the same as your friend's. This means that:
d+3 = 18t miles ......> equation 2
Substitute by 1 in 2:
12t + 3 = 18t
3 = 6t
t = 0.5 hours
This means that you will catch up to your friend in half an hour.