Let the speed of the train be x km/h.
Time at speed x: x360 hours.
Time at speed (x+5): x+5360 hours.
The faster trip takes 1 hour less:
x360−x+5360=1.
Combine the fractions:
360(x(x+5)(x+5)−x)=1
x(x+5)360×5=1
1800=x2+5x
x2+5x−1800=0.
Factorise (product −1800, sum +5 gives 45 and −40):
(x+45)(x−40)=0.
So x=−45 or x=40. Speed cannot be negative, so x=40.
The speed of the train is 40 km/h.