Amr Elsayed said:
I hope you will tell me where I made a mistake in the following calculations:
the same train is moving with 0.9C and it has a proper length of 300000 kilometers. For an observer on the platform he will measure length of train as 13076696.83 meters and the train will have moved 619422481.5 meters in 2.500631499 seconds, so total distance traveled by light from perspective of a still person on the platform is 750189449.8 meters.
Your mistake is that you are using time dilation and length contraction. Until you stop using time dilation and length contraction you will get confusing and inconsistent results because those formulas do not apply to this problem.
For this "why does the speed of light come out to be ##c##?" problem, here's what you do:
First, we pick a frame. For this example, I'll pick the frame in which the platform is at rest because you've already done most of the work for that case, and I'll put the origin of the coordinates at the point in spacetime where the light flash is emitted.
Using this frame, we write down the ##(x,t)## coordinates of the point in spacetime where the light signal is emitted, which we call ##x_0## and ##t_0##; ##x_0=0## and ##t_0=0## because of where we put the origin.
Using this frame, write down the ##(x,t)## coordinates of the point in spacetime where the light is received. Call these ##(x_1,t_1)## and because you've done the calculation we know that ##x_1=750189449.8## meters and ##t_1=2.500631499## seconds.
We calculate the speed of light as measured in this frame: The speed is the distance divided by time ##(x_1-x_0)/(t_1-t_0)## and of course is comes out to be ##c##.
Now comes the part that you've been missing. To calculate the speed of light in the train frame, we do not use the time dilation and length contraction formulas.
Instead, we need the coordinates of both events in the frame in which the train is at rest (we'll call these ##(x'_0,t'_0)## for the light signal being emitted and ##(x'_1,t'_1)## for the light signal being received). Once we have these, we can calculate the speed of light in the frame at which the train is at rest: the speed is the distance divided by time, ##(x'_1-x'_0)/(t'_1-t'_0)##.
The Lorentz transformations tell us how to calculate ##x'_0## and ##t'_0## from ##x_0## and ##t_0## and how to calculate ##x'_1## and ##t'_1## from ##x_1## and ##t_1##. Try it... You will get ##x'_1=172105263##, ##t'_1=0.573684209##, ##x'_0=0## and ##t'_0=0##, and the speed of light calculated in the train frame will be ##c=3\times{10}^8## just as it was in the platform frame.