Define
d = distance (km) traveled in either direction
t₁ = time (hours) to travel uphill
t₂ = time(hours) to tavel downhill
The time to travel uphill is
[tex]t_{1} = \frac{(d \, km)}{(40 \, \frac{km}{h})} = \frac{d}{40}\, hours [/tex]
Similarly, the time to travel downhill is
[tex]t_{2} = \frac{d}{60} \, hours[/tex]
The total travel time is
[tex]t=t_{1}+t_{2} = \frac{d}{40} + \frac{d}{60} = \frac{60d+40d}{2400} = \frac{d}{24}\, hours [/tex]
The total distance traveled = 2d km
The average speed is
[tex]v= \frac{(2d \, km)}{( \frac{d}{24} \, h)}=48\, \frac{km}{h} [/tex]
Answer: The average speed is 48 km/h