The following functions are defined for all integers $a , b$ and $c$ : $$\begin{aligned}
p ( x ) & = x + 1 \\
m ( x ) & = x - 1 \\
s ( x , y , z ) & = \begin{cases} y & \text { if } x \leqslant 0 \\
z & \text { if } x > 0 \end{cases}
\end{aligned}$$ (i) Show that the value of $$s ( s ( p ( 0 ) , m ( 0 ) , m ( m ( 0 ) ) ) , s ( p ( 0 ) , m ( 0 ) , p ( p ( 0 ) ) ) , s ( m ( 0 ) , p ( 0 ) , m ( p ( 0 ) ) ) )$$ is 2 . Let $f$ be a function defined, for all integers $a$ and $b$, as follows: $$f ( a , b ) = s ( b , p ( a ) , p ( f ( a , m ( b ) ) ) ) .$$ (ii) What is the value of $f ( 5,2 )$ ? (iii) Give a simple formula for the value of $f ( a , b )$ for all integers $a$ and all positive integers $b$, and explain why this formula holds. (iv) Define a function $g ( a , b )$ in a similar way to $f$, using only the functions $p , m$ and $s$, so that the value of $g ( a , b )$ is equal to the sum of $a$ and $b$ for all integers $a$ and all integers $b \leqslant 0$. Explain briefly why your function gives the correct value for all such values of $a$ and $b$. If you require additional space please use the pages at the end of the booklet
(i) [2 marks] Given expression $= s ( s ( 1 , - 1 , - 2 ) , \ldots , \ldots ) = s ( - 2 , s ( 1 , - 1,2 ) , \ldots ) = 2$. [0pt]
\section*{5. For ALL APPLICANTS.}
The following functions are defined for all integers $a , b$ and $c$ :
$$\begin{aligned}
p ( x ) & = x + 1 \\
m ( x ) & = x - 1 \\
s ( x , y , z ) & = \begin{cases} y & \text { if } x \leqslant 0 \\
z & \text { if } x > 0 \end{cases}
\end{aligned}$$
(i) Show that the value of
$$s ( s ( p ( 0 ) , m ( 0 ) , m ( m ( 0 ) ) ) , s ( p ( 0 ) , m ( 0 ) , p ( p ( 0 ) ) ) , s ( m ( 0 ) , p ( 0 ) , m ( p ( 0 ) ) ) )$$
is 2 .
Let $f$ be a function defined, for all integers $a$ and $b$, as follows:
$$f ( a , b ) = s ( b , p ( a ) , p ( f ( a , m ( b ) ) ) ) .$$
(ii) What is the value of $f ( 5,2 )$ ?\\
(iii) Give a simple formula for the value of $f ( a , b )$ for all integers $a$ and all positive integers $b$, and explain why this formula holds.\\
(iv) Define a function $g ( a , b )$ in a similar way to $f$, using only the functions $p , m$ and $s$, so that the value of $g ( a , b )$ is equal to the sum of $a$ and $b$ for all integers $a$ and all integers $b \leqslant 0$.\\
Explain briefly why your function gives the correct value for all such values of $a$ and $b$.
If you require additional space please use the pages at the end of the booklet