We are told D has a 4-hour headstart, but it is more useful to determine how far away is he when R leaves. Then, consider that R goes 8 mph faster. That difference in speed is the rate at which R will close that distance.
Alternatively, let t be the time since R leaves (in hrs). His distance away from the library is given by a linear function in t. So is D's (D's is his speed times t plus his headstart distance). Set those two distances = and solve.