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. ??

Let $d$ be the distance between $A$ and $B$, and assume the trains travel at constant speed. Let $a(t)$ denote the position of the train leaving $A$, and $b(t)$ denote the position of the train leaving $B$. Then we have (assuming $t \in [5,9]$):
$$a(t) = \frac{d}{4} (t-5).$$
Similarly for the other train (and remembering that the train is starting at distance $d$, we have (assuming $t \in [7,10.5]$):
$$ b(t) = d - \frac{d}{3.5} (t-7).$$
To find the time they meet (crash?), we solve for $a(t) = b(t)$, which gives after a minor amount of rearranging (and canceling $d$, which is assumed non-zero), $t = \frac{119}{15}$, which is 7:56 (and lies in $[7,9]$, so the formulae for $a,b$ apply). Thus the trains meet at 7:56, which is 56 minutes after the train departs from $B$.
