Let's call the speed y and the time x.

The time for the freight train is x + 2.5

The speed for the express train is y + 20

Let's multiply both of these equations by the denominators on the right hand side.

So, as both the equations are equal, both sides are equal.

We can subtract xy from both sides.

We can use 8x to express y from now on. Going back to the equation for the express train:

We now have a quadratic equation. I'll divide both sides by 4 to make it easier:

Time to factorise it:

Now in real life we can't have a negative time, so x = 5

The original units were hours, and we have not converted these so it took the express train 5 hours to travel 300 miles.