It can be said that most of the required information's are already given in the question.
Let us assume the speed of the passenger train = x
Speed of the freight train = y
x = y + 40
The second equation will be
6 * x = 10 * y
6x = 10y
Dividing both sides by 2, we get
3x = 5y
x = 5y/3
Putting the value of "x" in the first equation, we get
x = y + 40
5y/3 = y + 40
5y = 3y + 120
5y - 3y = 120
2y = 120
y = 60 mph
Putting the value of y in the first equation, we get
x = y + 40
= 60 + 40
= 100 mph
From the above deduction, we can conclude that the passenger train is traveling at 100 mph and the freight train is traveling at 60 mph.