1. A robot is located in one of the cells of an infinite grid paper, to which the following commands can be given:

- up (the robot moves to the adjacent cell above);
- down (the robot moves to the adjacent cell below);
- left (the robot moves to the adjacent cell to the left);
- right (the robot moves to the adjacent cell to the right).

For example, if the robot executes a sequence of four commands (up, right, down, left), it will obviously return to the initial position, i.e., it will end up in the same cell from which it started. How many different sequences of 4 commands exist that return the robot to its initial position?
Solution. For brevity, let's denote the command to move left as L, right as R, up as U, and down as D. For the robot to return to its initial position, it is necessary and sufficient that the number of L commands equals the number of R commands, and the number of U commands equals the number of D commands. Let $k$ be the number of L commands in the sequence. We will calculate the number $N_{k}$ of the desired sequences for $k$ from 0 to 2.

- $\boldsymbol{k}=\mathbf{0}$. The sequence consists only of U and D commands. Since they are equal in number, U commands must occupy 2 out of 4 positions, and D commands must occupy the remaining 2 positions. The number of ways to choose 2 positions out of 4 is $C_{4}^{2}$. Therefore, $N_{0}=C_{4}^{2}=6$;
- $\boldsymbol{k}=\mathbf{1}$. Each of the commands L, R, U, and D appears in the sequence exactly once. The number of permutations of 4 elements is $4!$. Therefore, $N_{1}=4!=24$;
- $\boldsymbol{k}=\mathbf{2}$. Here, there are two L commands, two R commands, and no U or D commands. The two L commands can be placed in $C_{4}^{2}$ ways. Thus, $N_{2}=C_{4}^{2}=6$.

Therefore, the total number of sequences is $N_{0}+N_{1}+N_{2}=36$.

Answer: 36.