Arturo O. answered  02/21/20
Experienced Physics Teacher for Physics Tutoring
You can solve this without knowing the distance because it will cancel out. Suppose the distance between A and B is d.
d/10 = speed of train x
d/15 = speed of train y
Now suppose they meet at time t going in opposite directions. Suppose train x travels to the right and train y travels to the left. The two trains must arrive at the same point at time t. Train x arrives at position (d/10)t while train y arrives at position d - (d/15)t. These two positions must be the same, so
(d/10)t = d - (d/15)t ⇒
t/10 = 1 - t/15
Solve for t.
t = 10 - (2/3)t
(5/3)t = 10
t = 10(3/5) = 6
They meet in 6 hours.