Tom and Jerry stand at either end of a straight track. They then run at a constant (but different) speed to the other end of the Tom and Jerry stand at either end of a straight track. They then run at a constant (but different) speed to the other end of the track, turn and run back to their original end at the same speed they ran before. On their first leg, they pass each other 20m from one end of the track. When they are both on their return leg, they pass each other a second time 10m from the other end of the track. How many metres long is the track?
My approach is not leading to any solution:
Assuming Jerry faster than tom:  $R_j > R_t$
$D = r*t$
$D_J = D-20(1st-meeting) + 20 (end-of-track) + D-10(2nd-meeting) = {2D-10}$
$D_T= 20(1st-meeting) + D-20 (end-of-track) + 10(2nd-meeting) = D+10$
Their rates are different and so are their travelled distance, but the travelled time is the same.
$\frac{2D-10}{R_J}  = \frac{D+10}{R_T}$
From now on, I honestly don't have ideas on how to proceed.
 A: $$\overleftrightarrow{A\qquad \qquad \qquad \qquad  B}$$
Let $AB$ be the track of length $x$. Assuming that Tom starts from $A$ and Jerry from $B$ (Taking the opposite case will lead to same solution for $x$ as this assumption is independent of track length)
Now, Time taken for first meet (as both Tom and Jerry are on their first leg) $=$
$$\frac{20}{R_T}=\frac{x-20}{R_J} \tag{i}$$
(Assuming that their first meet occurs at a distance of $20$ units from $A$*)
Time interval between first and second meet (as both Tom and Jerry are on their return leg during second pass) $ = $
$$\frac{(x-20)+10}{R_T}=\frac{20+(x-10)}{R_J} \tag{ii}$$
since their second meet occurs at a distance of $10$ units from the other end, $B$.
Solving (i) and (ii), we'll get a quadratic equation $x^2-50x=0$. Thus, $x=50$ units. $(\because x\neq 0)$
*Taking the other case, their first meet occurs at a distance of 20 units from end $B$ will lead to same solution because, in (i) and (ii) if $R_T$ and $R_J$ are replaced by one another, the solution for $x$ will remain unchanged.
A: The formula is correct, $D=rt$.  There are two different distances where $D(T) + D(J) = D$ and there are two different rates $r(T)$ and $r(J)$ but the time is the same when they meet.  Use $D=rt$ twice to come up with two different formulas, for the two legs, and then you will have a system of equations where $t$ is the same since their rates $r(T)$ and $r(J) $ are each constant.
