Length observed by a moving frame of reference

The rod is moving in the observer's reference frame and he has to measure each end at the same time in his frame. You are using the same time, t, in the frame of the first observer who is at rest with respect to the rod. What's simultaneous (same t) in the first observer's frame is not simultaneous in the moving observer's frame.

So the difference in ′ coordinates that you calculate is not the length in the moving observer's frame.

You want to measure the location of both ends at the same time, let us say when $$t'=0$$. Given the Lorentz transformations, the point $$(x,t)=(0,0)$$ maps to $$(x',t')=(0,0)$$, and $$(L,0)$$ to $$(\gamma L,\gamma v L/c^2)$$. But this is the position of the other extreme of the rod at $$t'\ne 0$$. The position at $$t'=0$$ is $$L'=x'-vt'$$, replacing we get $$L'=L/\gamma$$

The spatial distance between 2 points supposes being taken at the same time. In this case, the moving observer must measure the distance $$0a$$ at the same time t'.

If we take t = 0 and t'= 0 for x = 0 and x' = 0 things are easier to understand. The moving observer must measure the distance for $$t' = 0$$.

$$0 = t' = \gamma(t - ux_a)$$ (for c = 1) => $$t = ux_a$$

$$x'_a = \gamma(x_a - u^2x_a)$$ => $$x'_a = \gamma x_a(1 - u^2))$$

$$x'_a = \frac{x_a\gamma}{\gamma^2} = \frac{x_a}{\gamma}$$