Question 948523
Speed is distance traveled over time.
Or {{{S = D/T}}}
We can rewrite the equation to solve for distance by multiplying both sides by T
{{{S*T = D}}}

Let F = Speed of the freight train
Let P = Speed of the passenger train
Let Tf = Time for freight train.
Let Tp = Time for passenger train
Tf = 2.5 hours
Tp = 2.5 - 1.5 = 1 hour

We can now write three equations.
Equation 1: {{{P = F + 18}}}
Equation 2: {{{F*Tf = D}}}
Equation 3: {{{P * Tp = D}}}

When the passenger train overtake the freight train the distance traveled will be the same. So the D's in equations 2 and 3 will be the same so we can set those two equations equal to each other.
{{{F*Tf = P*Tp}}}
Plug in the given values for the variables.
{{{F*2.5 = P*1}}}
Now look at equation 1. We know that P = F+18. Plug that into our equation.
{{{F*2.5 = (F+18)*1}}}
Simplify
{{{2.5*F = F+18}}}}
Subtract 1F from both sides.
{{{1.5*F = 18}}}
Divide both sides by 1.5
{{{highlight(F = 12)}}}
The freight train is traveling at 12mph.
Now plug 12 into equation 1 for F
Equation 1: {{{P = F + 18}}}
{{{P = (12) + 18}}}
{{{highlight_green(P = 30)}}}
The passenger train is traveling at 30mph