One twin stays on Earth while the other travels at to a star light years away and comes back. Here .
In the Earth frame the round trip takes years. The traveller's clock runs at of the rate both out and back, so on return it has advanced only years.
The clocks in the figure stop and show their readings at departure, turnaround and return: the Earth clock reads , and years, the traveller's clock , and years.
Time dilation holds both ways. In the traveller's frame it is the Earth that moves, and the Earth clock should be the one running at of the rate.
If that reasoning were right, at the reunion each twin would say the other is younger.
The reunion is a single event at a single place, and laying the two clocks side by side gives one reading: years and years. The traveller's reasoning must be missing something.
Each can claim the other's clock is slow only while both stay in frames moving uniformly. The twin on Earth stays in one and the same frame from start to finish.
The traveller turns around at the star. During the turn the traveller is pressed away from the Earth, and an accelerometer on board would measure the change of direction.
The traveller switches between two uniformly moving frames, the outbound one and the return one. The two twins are not on equal footing, and the traveller's reasoning cannot be carried through from the outbound leg to the return leg.
Draw on a spacetime diagram the straight world line of the twin on Earth and the bent world line of the traveller. The traveller's lines of simultaneity slope up to the right at on the way out, and down to the right at on the way back.
Just before the turnaround, the outbound line of simultaneity meets the Earth's world line at years. While the traveller's clock advances years the Earth clock advances only , agreeing with the claim that it runs at of the rate.
Just after the turnaround, the return line meets the Earth's world line at years. In the instant of changing frames, the Earth time the traveller counts as now jumps ahead by years.
On the way back the Earth clock again advances only years. Adding out, in the jump and back gives years, matching the Earth clock.
The time ticked by a clock moving uniformly between two events is given by . The larger the sideways distance , the more is subtracted.
On the outbound leg light years and light years, so light years, that is years. The return leg is another years, in all. For the twin on Earth , and the answer stays years.
On an ordinary plane the straight line between two points is the shortest. On a spacetime diagram it is the other way round: of all world lines joining two events, the straight one has the longest proper time.