PLEASE. I am frustrated.

Stu hiked a trail at an average rate of 3 miles per hour. He ran back on the same trail at an average rate of 5 miles per hour. He traveled for a total of 3 hours. NOTE: I know I have to use 3t = 5(3-t) but what I want to know is why? Can someone explain why the equation is written the way it is written?