5. For ALL APPLICANTS.
A particular robot has three commands: F: Move forward a unit distance; L: Turn left $90 ^ { \circ }$; R: Turn right $90 ^ { \circ }$.
A program is a sequence of commands. We consider particular programs $P _ { n }$ (for $n \geqslant 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 \geqslant 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 }$.
(i) Write down the program $P _ { 2 }$.
(ii) How far does the robot travel during the program $P _ { n }$ ? In other words, how many $\mathbf { F }$ commands does it perform?
(iii) 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$.
(iv) The robot starts at the origin, facing along the positive $x$-axis. What direction is the robot facing after performing the program $P _ { n }$ ?
(v) The left-hand diagram on the opposite page shows the path the robot takes when it performs the program $P _ { 1 }$. On the right-hand diagram opposite, draw the path it takes when it performs the program $P _ { 4 }$.
(vi) Let $\left( x _ { n } , y _ { n } \right)$ be the position of the robot after performing the program $P _ { n }$, so $\left( x _ { 0 } , y _ { 0 } \right) = ( 1,0 )$ and $\left( x _ { 1 } , y _ { 1 } \right) = ( 1,1 )$. Give an equation relating $\left( x _ { n + 1 } , y _ { n + 1 } \right)$ to $\left( x _ { n } , y _ { n } \right)$.
What is $\left( x _ { 8 } , y _ { 8 } \right)$ ? What is $\left( x _ { 8 k } , y _ { 8 k } \right)$ ? [Figure] [Figure]
\section*{5. For ALL APPLICANTS.}
A particular robot has three commands:\\
F: Move forward a unit distance;\\
L: Turn left $90 ^ { \circ }$;\\
R: Turn right $90 ^ { \circ }$.\\
A program is a sequence of commands. We consider particular programs $P _ { n }$ (for $n \geqslant 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 \geqslant 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 }$.\\
(i) Write down the program $P _ { 2 }$.\\
(ii) How far does the robot travel during the program $P _ { n }$ ? In other words, how many $\mathbf { F }$ commands does it perform?\\
(iii) 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$.\\
(iv) The robot starts at the origin, facing along the positive $x$-axis. What direction is the robot facing after performing the program $P _ { n }$ ?\\
(v) The left-hand diagram on the opposite page shows the path the robot takes when it performs the program $P _ { 1 }$. On the right-hand diagram opposite, draw the path it takes when it performs the program $P _ { 4 }$.\\
(vi) Let $\left( x _ { n } , y _ { n } \right)$ be the position of the robot after performing the program $P _ { n }$, so $\left( x _ { 0 } , y _ { 0 } \right) = ( 1,0 )$ and $\left( x _ { 1 } , y _ { 1 } \right) = ( 1,1 )$. Give an equation relating $\left( x _ { n + 1 } , y _ { n + 1 } \right)$ to $\left( x _ { n } , y _ { n } \right)$.

What is $\left( x _ { 8 } , y _ { 8 } \right)$ ? What is $\left( x _ { 8 k } , y _ { 8 k } \right)$ ?\\
\includegraphics[max width=\textwidth, alt={}, center]{57150e89-9c08-4eab-97c4-06ccb6339e05-15_815_753_322_259}\\
\includegraphics[max width=\textwidth, alt={}, center]{57150e89-9c08-4eab-97c4-06ccb6339e05-15_809_751_328_1082}