We know that distance = rate x time. We assume the distance traveled to the library is the same as the distance traveled on the way back from the library. Let t = the amount of time it took to travel to the library. Then (8 - t) = the time traveled coming back from the library. We can set up the following two equations using the formula for distance:
d = 9t
d = 15(8 - t) = 120 - 15t
Since the distance d is equal for both trips, let's set the two expressions of t equal to each other.
9t = 120 - 15t
24t = 120
t = 5
Therefore, Shane traveled for 5 hours at 9 mph and for 8 - 5 = 3 hours at 15 mph. Each rate will yield a distance traveled of 45 miles.