For every integer $n \geqslant 2$, equip the set $\Omega_n$ of permutations of $\llbracket 1, n \rrbracket$ with the uniform probability. Let $p_i$ denote the probability that a permutation is alternating up (with $p_0 = p_1 = 1$). Define the random variable $M_n$ on $\Omega_n$ by: $M_n(\sigma) = k+1$ where $k$ is the largest integer such that $(\sigma(1), \ldots, \sigma(k))$ is alternating up. Express $\mathbb{E}(M_n)$ as a function of $p_0, p_1, \ldots, p_n$. Deduce $\lim_{n \rightarrow \infty} \mathbb{E}(M_n) = \frac{\sin(1) + 1}{\cos(1)}$.
For every integer $n \geqslant 2$, equip the set $\Omega_n$ of permutations of $\llbracket 1, n \rrbracket$ with the uniform probability. Let $p_i$ denote the probability that a permutation is alternating up (with $p_0 = p_1 = 1$). Define the random variable $M_n$ on $\Omega_n$ by: $M_n(\sigma) = k+1$ where $k$ is the largest integer such that $(\sigma(1), \ldots, \sigma(k))$ is alternating up. Express $\mathbb{E}(M_n)$ as a function of $p_0, p_1, \ldots, p_n$. Deduce $\lim_{n \rightarrow \infty} \mathbb{E}(M_n) = \frac{\sin(1) + 1}{\cos(1)}$.