Q:

When will these two trains meet each other

I cant seem to solve this problem. 

A train leaves point A at 5 am and reaches point B at 9 am. Another train leaves point B at 7 am and reaches point A at 10:30 am.When will the two trains meet ? Ans 56 min 

Here is where i get stuck.
I know that when the two trains meets the sum of their distances travelled will be equal to the total sum , here is what I know so far
Time traveled from A to B by Train 1 = 4 hours
Time traveled from B to A by Train 2 = 7/2 hours
Now if S=Total distance from A To B and t is the time they meet each other then
$$\text{Distance}_{\text{Total}}= S =\frac{St}{4} + \frac{2St}{7} $$ 
Now is there any way i could get the value of S so that i could use it here. ??

A:

We do not need $S$.
The speed of the train starting from $A$ is $S/4$ while the speed of the train starting from $B$ is $S/(7/2) = 2S/7$.
Let the trains meet at time $t$ where $t$ is measured in measured in hours and is the time taken by the train from $B$ when the two trains meet. Note that when train $B$ is about to start train $A$ would have already covered half its distance i.e. a distance of $S/2$.
Hence, the distance traveled by train $A$ when they meet is $\dfrac{S}2 + \dfrac{S \times t}4$.
The distance traveled by train $B$ when they meet is $\dfrac{2 \times S \times t}7$.
Hence, we get that $$S = \dfrac{S}2 + \dfrac{S \times t}{4} + \dfrac{S \times 2 \times t}{7}$$ We can cancel the $S$ since $S$ is non-zero to get $$\dfrac12 = \dfrac{t}4 + \dfrac{2t}7$$ Can you solve for $t$ now? (Note that $t$ is in hours. You need to multiply by $60$ to get the answer in minutes.)

