Question

A particular robot has three commands:

  • \(\mathbf{F}\): Move forward a unit distance;
  • \(\mathbf{L}\): Turn left \(90^{\circ}\);
  • \(\mathbf{R}\): Turn right \(90^{\circ}\).

A program is a sequence of commands. We consider particular programs \(P_n\) (for \(n \ge 0\)) in this question. The basic program \(P_0\) just instructs the robot to move forward: \[P_0 = \mathbf{F}.\]

The program \(P_{n+1}\) (for \(n \ge 0\)) involves performing \(P_n\), turning left, performing \(P_n\) again, then turning right: \[P_{n+1}= P_n\, \mathbf{L}\, P_n\, \mathbf{R}.\]

So, for example, \(P_{1} = \mathbf{F\, L\, F\, R}\).

  1. Write down the program \(P_2\).

  2. How far does the robot travel during the program \(P_n\)? In other words, how many \(\mathbf{F}\) commands does it perform?

  3. Let \(l_n\) be the total number of commands in \(P_n\); so, for example, \(l_0 = 1\) and \(l_1 = 4\).

    Write down an equation relating \(l_{n+1}\) to \(l_n\). Hence write down a formula for \(l_n\) in terms of \(n\). No proof is required. Hint: consider \(l_n + 2\).

  4. The robot starts at the origin, facing along the positive \(x\)-axis. What direction is the robot facing after performing the program \(P_n\)?

  5. The first diagram below shows the path the robot takes when it performs the program \(P_1\). On the second (blank) diagram, draw the path it takes when it performs the program \(P_4\).

  6. Let \((x_n, y_n)\) be the position of the robot after performing the program \(P_n\), so \((x_0, y_0) = (1,0)\) and \((x_1, y_1) = (1,1)\). Give an equation relating \((x_{n+1}, y_{n+1})\) to \((x_n, y_n)\).

    What is \((x_8, y_8)\)? What is \((x_{8k}, y_{8k})\)?