In relativity, when can time dilation be used in opposed to length contraction? I am an IB student. As such, I do not have an answer to the following question and while I think I have solved it, when I try to use other methods I get different answers and counter-intuitive solutions.
The question is

Two rockets A and B, are moving towards each other on the same path. From the frame of reference of Earth, an observer measures the speed of A to be 0.6c and the speed of B to be 0.4c. According to the observer on Earth, the distance between A and B is $6.0\cdot10^8m$
Determine, according to an observer in A, the time taken for B to meet A.

If the picture is needed, I will include it.
My initial solution
My initial solution was to determine the gamma factor of A in respect to the ground as,
$$\gamma = \dfrac{1}{\sqrt{1-\dfrac{v^2}{c^2}}} = 1.25$$
And as from the observer on the ground, the time until the two meet is
$$t =\dfrac{6\cdot10^8}{(0.6+0.4)c} = 2 s$$
I thought a good method was to use time dilation to say
$$t = \gamma t_p$$
where $t_p$ is the time observed from observer A.
This gives $t_p = \dfrac{2}{1.25} = 1.6$. This was what I thought was the solution.
Second solution
My teacher gave the second solution as follows.
The distance observed between A and B from the perspective of A is from length contraction,
$$\dfrac{6.0\cdot10^8}{\gamma}= 4.8\cdot10^8$$
The relative velocity of B observed from the perspective of A is
$$\dfrac{u-v}{1-\dfrac{uv}{c^2}} = \dfrac{-0.4c-0.6c}{1+\dfrac{0.6c\cdot0.4c}{c^2}}=-0.806c$$
Thus, the time observed from A will, under this approach,
$$t= \dfrac{4.8\cdot10^8}{0.806\cdot3\cdot10^8} = 1.98s$$
which is different from my initial approach.
However, the problem with this approach is that when I look from B's perspective, the time will be longer than 2 seconds which is observed on the ground.
May I ask what is the correct way of doing it and why the other way is wrong?
 A: You are right! Everything about your calculation is correct and well-stated.
Unfortunately, your teacher is wrong; they messed up the concept called relativity of simultaneity.
Imagine stationary buoys (in the Earth frame). Call them $\alpha$ and $\beta$. They are a distance $L$ apart. We will imagine that A passes buoy $\alpha$ at exactly the same time $B$ passes buoy $\beta$ in the Earth frame. Call the speeds of the rockets in the Earth frame $v_A$ and $v_B$.
From the frame of $A$, the distance between the buoys is $L/\gamma$. That's length contraction.
However, in the frame of $A$, the distance isn't the only thing that changes. Imagine the buoys have little clocks on them, and the clocks are synchronized in the Earth frame. Then A's frame, the clocks on the buoys are not synchronized. In fact, in A's frame, buoy $\beta$ has a time reading that is $Lv_A/c^2$ ahead of the other buoy's $\alpha$.
This is where your teacher's mistake came. They assumed that in $A$'s frame, the rockets passed the buoys simultaneously. That's wrong. In A's frame, when A gets to buoy $\alpha$, the clock on $\beta$ says $Lv_A/c^2$. That means $B$ already passed. It passed $\beta$ when its clock read zero, which was a time $\gamma Lv_A/c^2$ ago (due to time dilation of $\beta's$ clock in A's frame). 
$\beta$ is approaching A at speed $v_A$ in A's frame. So in A's frame, when $B$ passed $\beta$ it was a distance $L/\gamma + v_A\gamma Lv_A/c^2$ away. That simplifies to $\gamma L$. So even though the buoys are length-contracted to be closer by a factor $\gamma$, in A's frame, when B passed $\beta$, it was further away than $L$ by a factor $\gamma$. (The buoys were still a distance $L/\gamma$ apart at that time according to A, but A hadn't reached $\alpha$ yet at the time B reached $\beta$, according to A.)
The time for rocket $B$ to get from $\beta$ to meet A is the distance it traveled divided by its speed in A's frame. Your teacher got the speed right, so that time is $\frac{L\gamma}{(v_A+v_B)/(1+v_Av_B/c^2)}$. 
That was the time for B to get from $\beta$ to A in A's frame, but we want to know how long it is after A reaches $\alpha$, not how long after $B$ reaches $\beta$. We subtract the time $\gamma L v_A/c^2$ since that's the difference between those events in A's frame. Simplifying the algebra gives
$$t_A = \frac{L}{\gamma(v_A+v_B)}$$
That's the same as your solution. It took quite a bit of work to get there, so you probably don't want to do this "time delay from relativity of simultaneity" method a lot. On the other hand, your own solution was very straightforward, direct, and by using effects like time dilation, gives some extra insight into the problem you wouldn't get from using formal methods like Lorentz transformations to bash away at coordinates.
It's a good solution, and you had the right instinct to try to find out what specifically was wrong with the faulty method.
A: As a general rule I strongly advise students new to SR not to try and work by directly calculating time dilations or length contractions as it's easy to make mistakes. Indeed, Mark's answer shows how you teacher made exactly such a mistake by naively calculating the Lorentz contraction of the AB distance in A's frame. I recommend that the only safe way to proceed is to use the Lorentz transformations to calculate how spacetime points transform between the two frames.
The way I would set this up is so that A and B meet at the origin at time zero. The question doesn't say where the Earth is, so I'll put it at the origin as well. This way A and B and the Earth will agree on their positions and times at the moment all three meet. Then we just have to draw the positions at time $t = -2$ seconds:

At time $t = -2$ seconds we have $A$ at position $x = -3.6e8$ and moving with velocity $+0.6c$, and $B$ at position $x = +2.4e8$ and moving with velocity $-0.4c$. Then at time zero A and B will meet at the Earth.
Now, the Lorentz transformations are:
$$\begin{align}
 t' &= \gamma \left( t - \frac{xv}{c^2} \right ) \\
 x' &= \gamma \left( x - vt \right) 
\end{align}$$
In the Earth frame the position of $A$ is $(t=-2, x=-3.6e8)$ so we feed this into the Lorentz tranformations to find the position of $A$ in $A$'s rest frame. We only want the time for this question, so taking the equation for $t'$ gives us:
$$ t' = 1.25 \left( (-2) - \frac{-3.6e8 \times 0.6c}{c^2} \right) = -1.6 \,\text{seconds} $$
And there's your answer. When the Earth clock shows $-2$ seconds the clock on $A$ shows $-1.6$ seconds. Since we've set things up so all observers agree that the meeting time is $t=0$ that means $A$ measures $1.6$ seconds to the meeting.
You can do the same calculation for $B$ and this gives the time measured by $B$ as about $1.77$ seconds.
Let's have a closer look at this to see what your teacher got wrong. To make the arithmetic easier I'll write the distances in light seconds, so our initial diagram looks like:

Note that we traditionally write the positions as $(t,x)$ so the position of A at time $t = -2$ seconds is $(-2, -1.2)$.
We have the three spacetime points marking the positions of A, E and B at time $t = -2$ seconds, So the next step is to feed these positions into the Lorentz transformations and find out where these points are in the rest frame of A. This is straightforward arithmetic so I'll just give the results:
$$\begin{align}
A &= (-1.6, &0) \\
E &= (-2.5, &1.5) \\
B &= (-3.1, &2.5)
\end{align}$$
As above we find the time for A is $t_A = -1.6$ seconds, which is how we now the time to the meeting is $1.6$ seconds. The position of A is $x_A = 0$ and of course that's correct - we've transformed to the rest frame of A and A is stationary at the origin of its own rest frame. So far so good.
But when we look at the position of the Earth we find something a bit odd. The Lorentz transformation has given us the position of the Earth at $t=-2.5$ seconds not $t=-1.6$ seconds as we found for A. This happens because events that are simultaneous in one frame are in general not simultaneous in another frame. But the transformation still makes sense. We know all observers meet at $(0,0)$ so that means in A's frame the Earth has to travel $1.5$ light seconds in $2.5$ seconds making its speed $v = 1.5/2.5 = 0.6c$, which is correct.
To find the position of the Earth at $t=-1.6$ seconds we just subtract the distance travelled in the time from $t=-2.5$ to $t=-1.6$ i.e. $0.9$ seconds. And at $0.6c$ that's $0.54$ light seconds. So at $t=-1.6$ the AE distance is $1.5 - 0.54 = 0.96$ light seconds.
Does this match with the Lorentz contraction calculated in the Earth frame? Well in the Earth frame the distance is $1.2$ and $\gamma=1.25$. Dividing the distance by $\gamma$ gives $0.96$ light seconds, and that's exactly what we calculated above. That's why your calculation gave the correct answer.
But now let's look at the position of $B$ after the transformation i.e. $(-3.1, 2.5)$. Again we know that all observers meet at $(0,0)$ so B has to travel $2.5$ light seconds in $3.1$ seconds, and that makes its speed $v'_B = 2.5/3.1 = 0.806c$. And that's the result your teacher got - OK so far.
But again we've calculated the position of B at the wrong time. We want its position at $t=-1.6$ not $t=-3.1$. So we subtract off the distance travelled, and that is just the time difference of $1.5$ seconds times the speed of $0.806c$ giving us $1.29$ light seconds. But your teacher took the distance in the Earth frame, $2$ light seconds and divided by the Lorentz factor of $1.25$ to get the distance $1.6$ light seconds, which is wrong. And that's why your teacher got the wrong answer.
A: The term "distance" refers, in Newtonian mechanics, to a measurement of separation in three dimensional space. To extend the concept to relativity, one has to either specify two points in four dimensional space, or take it to be the space-like distance between two worldlines. The effect of Lorentz transforms differs depending on which is used. 
As analogy, suppose you have Alice and Bob, and they disagree as to which direction is "North". There are two lines drawn on the ground, and Alice wants to measure the East-West distance between the lines. So she picks two points on each line such that they, according to her calculations, have same North-South coordinate, and then measures the distance between those points to be x. Now Bob comes along and measures the East-West distance between those two points, using what he considers to be "East" and "West". He's going to measure this distance as smaller than x; remember, Alice thinks the NS distance is x and the ES distance is 0. They're going to agree on the total distance being x, but Bob thinks that x is the hypotenuse of a right triangle, and the EW distance is one of the legs.  So given two points, Bob is going to measure a shorter distance.
Now suppose Bob wants to measure the EW distance between the two lines. Now he's not going to measure the distance between the two points Alice picked, because to him, they don't have the same NS coordinate. Instead, he's going to pick two points that, according to him, have the same NS coordinate. If Alice's lines were, according to her, straight NS, then Bob is going to measure the EW distance as being larger than Alice did.
In this analogy, NS corresponds to time, and EW to space. The total distance refers to proper time/distance. True North corresponds being at rest. This isn't a perfect analogy: in that standard Euclidean norm, total distance squared is (NS^2) plus (EW^2); in relativity, proper time squared is (time^2) minus (distance^2). Because of this, the results will be reversed. That is, if Alice and Bob are in different reference frames, and Alice picks two points that she thinks have the same time coordinate, then Bob is going to measure them as having more space-like separation than Alice did. If Alice measures the distance between two objects that, according to her, are at rest, then Bob is going to measure the space-like separation between them as smaller than Alice did.
When we measure the "length" of an object, we measure the space-like separation between two points in four-dimensional space, one occupied by one end of the object, the other point by the other end, at the same time. When someone in another reference frame measures the length, they measure the space-like separation between two points that they consider to be at the same time. The two ends of the object are points in three-dimensional space, but traverse lines in four-dimensional space. So measuring the length of an object corresponds to finding the EW distance between two lines; in a Euclidean norm, that results in a longer distance, in SR it results in a shorter distance. 
So "length" refers to the space-like separation of the worldlines of the two ends of an object, and people in different reference frames are going to disagree what that space-like separation is. Note that this makes sense only if the separation is constant across time. For a rigid body, the distance between its end is constant, so it has a well-defined length in all reference frames. 
But for two objects coming towards each other, the "length" of the separation does not make sense without specifying a particular time. When the problem says "the distance between A and B is 6.0⋅108m", that makes no sense as a general property of A and B. It makes sense only if interpreted as "There are two particular location in four-dimensional space such that the first was occupied by A, the second was occupied by B, and the space-like separation between them was 6.0⋅108m". So we're not looking at the space-like separation between two worldlines, we're looking at the space-like separation between two points. Since this is measured in a reference frame in which the time-like separation is zero, all other reference frames are going to measure the space-like separation as larger.
Another way of looking at it: suppose someone on Earth looks at A and calculates it to be at $x_1$ at time $t_1$, and B to be at $x_2$ at $t_1$. Then someone on A is going to measure the space-like separation between $(t_1,x_1)$ and  $(t_2,x_2)$ as larger than 6.0⋅108m. But doesn't space "shrink" when you travel faster? Kinda. If we were to go to A at time $t_1$, and measure the distance to B, the distance would indeed be less than 6.0⋅108m. However, that's because Earth and A disagree what is the "same" time. Someone on A would be measuring how far away B is at their "now", which is going to be different from Earth's "now". Their "now" will, according to Earth, be later than $t_1$. From Earth's perspective, people on A are measuring B's position "too late", and thus seeing it as closer.
