I was reading the book, "Relativity: The special and general theory" by Einstein. At some point it discusses the awkwardness of "relativity of simultaneity" with using universal time axis for all inertial frames. And to fix it uses Lorentz's transformation(the attached image shows two inertial frames(page 22 of the book).
To explain length dilation after this, it uses below example,
I am not able to derive the last line.