Let and be positive integers. Mr. Pisut starts walking from the point to the point in such a way that:
* each of his steps is of 1 unit length in the direction parallel to either the X-axis or the Y-axis;
* for each point on his path, and .
For each step, he measures the distance from himself to the axis to which his step is parallel. If the step takes him farther away from the origin, he records the distance as a positive value; otherwise it is recorded in negative.
Prove that after he finishes his walk, the sum of all distances recorded is zero.
, 2014
Solution
Suppose that Mr. Pisut walks steps in total and the -th step is from the point to the point . Notice that if the -th step is parallel to the X-axis, then and he records . Likewise, if the -th step is parallel to the Y-axis, then and he records . So the distance he records for the -th step, regardless of the direction, is . Therefore, the sum of all distances recorded is
Solution 2:
First notice that if the path contains a step parallel to the X-axis followed immediately by a step parallel to the Y-axis – i.e. left-up, left-down, right-up, or right-down – then the sum of the distances recorded will remain unchanged if we swap (the directions of) those two steps, as one of the two distances recorded will increase by 1 while the other will decrease by 1. Notice also that the new path after such a swap will still satisfy all conditions for the walk.
Therefore, we can repeatedly swap two such steps as many times as possible. Notice that this procedure must terminate, resulting in a path that is parallel to the Y-axis at first, then to the X-axis later. That is, the final path consists of a walk along the Y-axis from to and a walk along the X-axis from to . The distance recorded for each step in this final path is 0, making the sum of all distances recorded zero. Since this sum remains unchanged throughout the procedure, we conclude that the sum of all distances recorded for the original path is zero as well.
Solution 3:
For each step that Mr. Pisut takes, we write or in each unit square between the step and the axis to which the step is parallel, where the choice of sign agrees with that of the recorded distance. Then the sum of all numbers written in each step is equal to the recorded distance for that step. Thus, it suffices to show that, after he finishes the walk, the sum of all numbers written in each unit square in the first quadrant is zero.
Consider the unit square with the lower left corner at , where and are non-negative integers. Notice that in this square we write only for every rightward step above the square and for every upward step on the right of the square. Similarly, we write only for every leftward step above the square and for every downward step on the right of the square. In other words, we write in whenever Mr. Pisut enters the region , and we write whenever he exits this region. Since he starts and ends his walk outside the region, the number of entries must be the same as the number of exits. Thus, the number of 's written in is equal to the number of 's, yielding the sum of zero as desired.

For each step, we write or in each unit square between the step and the axis.

This path enters and exits the shaded region twice, so we write two 's and two 's in the square .