I recently learned about special relativity and different reference frames. The conversion from two inertial reference frames is given by Lorentz transformations: $$x' = \frac{x-ut}{\sqrt{1-\frac{u^2}{c^2}}}$$ and $$x = \frac{x'+ut'}{\sqrt{1-\frac{u^2}{c^2}}}$$. In my question, S' is a reference frame which moves with speed $u$ relative to S, along OX axis. Suppose the observer from S' measures at the same time two points $x'_1$ and $x'_2$. The distance from these 2 points is $x'_2 - x'_1$. In all the books I've seen so far, they calculate the distance in S using the first formula above. However, if we use the second one, we obtain that $$x_2-x_1 = \frac{x'_2-x'_1}{\sqrt{1-\frac{u^2}{c^2}}}$$. We conclude that the length perceived by the observer in S is bigger than the length perceived by the observer in S. However, this is not the correct answer. Why we cannot use the second formula to get the answer?
Thank you!