I just did it in my head.
The answer is 4 ½ hours. By the time the second cyclist sets of the first cyclist is 18 miles ahead (6 mph x 3 hours = 18 miles). So, from the point when the second cyclist sets off he is matching the first cyclists speed AND exceeding it at a rate of 4 mph (10mph - 6mph = 4mph).
So travelling for 4 ½ hours, catching the 2nd cyclist at a rate of 4mph reduces the 18 miles deficit to 0 (4 ½ hours x 4mph = 18).
I'm sure someone may be able to post an easy formula for you to remember.