Let $f(x)$ be the function on $\mathbb{R}$ defined by $f(x)\!:=\sin(\pi x/2)$. For $y$ in $\mathbb{R}$, consider the sequence $\{x_{n}(y)\}_{n\geqslant0}$ defined by $$ x_{0}(y) := y\;\;\text{ and }\;\;x_{n+1}(y)=f(x_{n}(y))\;\text{ for all }\;n\geqslant1\\\text{and let }\,g(y):=\lim\limits_{n\to\infty}x_{n}(y)\,.$$Find $\displaystyle\int_{0}^{3}g(y)\mathrm dy\,.$
My Attempt: Between $0$ and $3$, $f$ has only two fixed points $0,1$, so $g$ takes only value $0,1$ in $[0,3]$. But how compute exactly $g$ in $[0,3]\,?$
When $y\in (0,2)$, $x_1(y) \in (0,1]$ and one can check that $g(y) = 1$: Indeed we have $\sin (\pi t/2)\ge t$ for all $t\in (0,1)$, thus $\{ x_n(y)\}$ is an increasing sequence for all $y\in (0,2)$ and converges to the fixed point $1$.
When $y\in (2, 3)$, $x_1(y) \in (-1, 0)$ and similarly $g(y) = -1$.
Hence $\int_0^3 g(y) dy = 1$.