The problem is as follows:
Two trains which have different lengths each are going to meet by traveling on different tracks with speeds $v_{1}$ and $v_{2}$ respectively. They take $20\,s$ to cross each other. If they go to meet with speeds $v_{1}$ and $\frac{8}{5}v_{2}$ respectively they require $15\,s$. How long will they need to cross each other if they travel on the same direction with speeds $v_{1}$ and $v_{2}$?
The answer in my book is : $180\,s$
I assumed that the catch here is to make a system of equations. What I could spot here was:
$d_1: \textrm{length of the first train}$ $d_2: \textrm{length of the second train}$
But I came stuck at how to relate when they are traveling in opposite directions. Since both are moving against each other I'm assuming that their speeds subtract from each other, but how does this account for the length of each train?.
I thought this:
$\textrm{v_total} \times t_{cross}=d_{1}+d_2$
$\textrm{v_total= sum of the vectors from the speeds}$
$(v_1-v_2)20= d_1+d_2$
But this doesn't specifically indicates which is faster.
The other equation would be
$\left(v_1-\frac{8}{5}v_2\right)15=d_1+d_2$
Dividing both equations I'm getting:
$\frac{v_1-v_2}{5v_1-8v_2}=\frac{3}{20}$
Rearranging this results in:
$20v_{1}-20v_{2}=15v_1-24v_2$
Which is reduced to:
$5v_{1}+4v_2=0$
Which gets a negative quantity:
$v_{1}=-\frac{4}{5}v_2$
But from this I became confused exactly on what to do?. Can someone help me here?. Am I understanding this the correct way?. Is my assumption regarding the subtraction in speeds correct?. Because that's the part where I'm struggling the most. All and all, what would be the most appropiate way to solve this?. If a sketch could accompany the solution it would help a lot, since I'm getting confused. Any help please?.
If they are traveling in opposite directions, the speeds add to get the crossing speed. Transform to the frame of train $2$. In that frame train $1$ is traveling at $v_1+v_2$. The front of train $1$ has to travel the total length of both trains before the crossing is done, so the time it takes is $\frac {d_1+d_2}{v_1+v_2}$. With this correction your approach is correct.