Take into account the following formula for the speed of an object:
v = d/t
where d is the distance travaled in time t. Solve the previous expression for t:
t = d/v
Consider that the speeds of both trains are v1 and v2 respectively. They traveled distance d1 = 150 mi and d2 = 105 mi in the same time t.
Then, you have:
t = 150/v1
t = 105/v2
furthermore, take into account that the speed of A is 15 mi/h greater than speed of train B, that is
v1 = v2 + 15
next, equal the expression for t and replace the previoues expression for v1, as follow:
150/(v2 + 15) = 105/(v2)
solve for v2:
150/(v2 + 15) = 105/(v2) multiply by v2(v2 +15) both sides
150·v2 = 105(v2 + 15) apply distributive property
150·v2 = 105·v2 + 1,575 subtract 105·v2 both sides and simplify
150·v2 - 105·v2 = 1,575
45·v2 = 1,575 divide by 45 both sides
v2 = 35
next, replace the previous value into the expression v1 = v2 + 15, to obtain v1:
v1 = 35 + 15 = 50
Hence, the spped of both trains A and B are 50 miles per hour and 35 miles per hour respectively