A car travels a distance of 60 miles at an average speed of 30 miles per hour. How fast does the car need to travel on the way back (taking the same road) in order to average 40 miles per hour over the course of the entire trip?

You need to build the following equation:

The total distance that needs to be traveled both ways is 120 miles. The average speed that we need to obtain is 40 miles; therefore, the car must travel for 3 hours in order to achieve that:

120 miles/40 miles per hour = 3 hours

The car has already traveled for two hours:

60 miles/30 miles per hour = 2 hours

So, on the way back it needs to travel only 1 hour. The distance is 60 miles. Hence the car needs to travel at 60 miles per hour.