Let the speed of the slower train = x kmph
Then speed of the faster train = x + 5 kmph.
Distance = speed × Time
Distance travelled by the first train = 2(x + 5) = 2x + 10
Distance travelled by the second train = 2.x = 2x
By the Pythagoras Theorem
(hypotenuse)2 = (side)2 + (side)2
(2x)2 + (2x + 10)22 = 502
4x2 + (4x2 + 40x + 100) = 2500
4x2 + 4x2 + 40x + 100 = 2500
8x2 +40x - 2400 = 0
x2 + 5x - 300 = 0
x2 +20x - x - 300 = 0
x(x + 20) - x(x + 20) = 0
(x + 20)(x-) = 0
x - = 0 or x + 20 = 0
x = (or) -20
But x cant be negative.
∴ Speed of the slower train x = kmph
∴ Speed of the faster train x + 5 = + 5 = kmph