Lets assume that s is the speed of the slower train and f is the speed of the faster train.
s = f - 16
f = 150 / t
s = 170 / ( t+2 )
-----------------------
170 / ( t+2 ) = 150 / t - 16 / t * ( t + 2 )
170 t = 150 * ( t + 2 ) - 16 t * ( t + 2 )
170 t = 150 t + 300 - 16 t² - 32 t
16 f² + 52 t - 300 = 0 / : 4 ( We will divide both sides of the equation by 4 )
4 t² + 13 t - 75 = 0
t 1/2 = ( -13 + √(169 + 1200 ) )/ 8
t = ( - 13 + 37 ) / 8 = 24 / 8 = 3
t = 3 h
s = 170 : ( 3 + 2 ) = 170 : 5 = 34 mph
Answer: The speed of the slower train is 34 mph.