You can put this solution on YOUR website! A train travels half the distance from 30 km/hr and the remaining half with 60km/hr. What is it's average speed ?
----------
Avg = 2*30*60/(30+60) = 3600/90
Avg = 40 km/hr
================
This formula applies only if the distances are equal.