8

Problem: Let $X_1,X_2,\dots$ be independent random variables with $X_i\sim\text{Ber}(\frac{1}{2})$. Let $Y_i=\max(X_i,X_{i+1})$ and $Z_n=\sum_{i=1}^{n}Y_i$. Find $\text{E}(Z_n)$ and $\text{Var}(Z_n)$.

My solution: We have $$P(Y_i=1)=P(\max(X_i,X_{i+1})=1)=1-P(\max(X_i,X_{i+1})=0)=1-P(X_i=0,X_{i+1}=0)=$$ $$1-P(X_i=0)P(X_{i+1}=0)=1-\frac{1}{2}\cdot\frac{1}{2}=\frac{3}{4},$$ hence $Y_i\sim\text{Ber}(\frac{3}{4})$, which gives $\text{E}(Y_i)=\frac{3}{4}$. We thus get $$\text{E}(Z_n)=\text{E}\left(\sum_{i=1}^{n}Y_i\right)=\sum_{i=1}^{n}\text{E}(Y_i)=\sum_{i=1}^{n}\frac{3}{4}=\frac{3n}{4}.$$ We have $\text{Var}(Y_i)=\frac{3}{4}(1-\frac{3}{4})=\frac{3}{4}\cdot\frac{1}{4}=\frac{3}{16}$. Let $1\leq i<j\leq n$. If $|i-j|>1$ then $Y_i=\max(X_i,X_{i+1}),Y_j=\max(X_j,X_{j+1})$ and $i,i+1,j,j+1$ are all distinct, and therefore $Y_i,Y_j$ are independent, and in particular $\text{Cov}(Y_i,Y_j)=0$. If $|i-j|=1$ then $$P(Y_iY_j=1)=1-P(Y_iY_j=0)=1-(P(Y_i=0)+P(Y_j=0)-P(Y_i=0,Y_j=0))=$$ $$1-\left(\left(1-\frac{3}{4}\right)+\left(1-\frac{3}{4}\right)-P(\max(X_i,X_j)=0,\max(X_j,X_{j+1})=0)\right)=$$ $$1-\left(\frac{1}{2}-P(X_i=0,X_j=0,X_{j+1}=0)\right)=1-\left(\frac{1}{2}-\left(\frac{1}{2}\right)^3\right)=\frac{5}{8}.$$ Hence $Y_iY_j\sim\text{Ber}(\frac{5}{8})$ which gives $\text{E}(Y_iY_j)=\frac{5}{8}$ so that $$\text{Cov}(Y_i,Y_j)=\text{E}(Y_iY_j)-\text{E}(Y_i)\text{E}(Y_j)=\frac{5}{8}-\frac{3}{4}\cdot\frac{3}{4}=\frac{1}{16}.$$ We finally get $$\text{Var}(Z_n)=\text{Var}\left(\sum_{i=1}^{n}Y_i\right)=\sum_{i=1}^{n}\text{Var}(Y_i)+2\sum_{1\leq i<j\leq n}\text{Cov}(Y_i,Y_j)=$$ $$\sum_{i=1}^{n}\frac{3}{16}+2\sum_{i=1}^{n-1}\text{Cov}(Y_i,Y_{i+1})=\frac{3n}{16}+2(n-1)\frac{1}{16}=\frac{5n-2}{16}.$$

Is my solution correct?

Edit: I don't know if my solution is correct because the answer provided (just a final answer no explanation) said that $\text{E}(Z_n)=\frac{3n}{4}$ (which I also got), but $\text{Var}(Z_n)=\frac{13n-10}{16}$. I can't find anything wrong with my solution, but I'm not sure.

Another edit: I understand my error. I used the inclusion-exclusion principle by treating the random variables like numbers (in which case what I wrote would be true), but random variables are functions so it doesn't work (we may have $fg=0$ but $f\neq 0$ and $g\neq 0$). @NN2 said that $P(Y_iY_{i+1}=0)=\frac{1}{8}$. How can we prove this?

Davide Giraudo
  • 181,608
User
  • 1,564

2 Answers2

4

The determination of the distribution of $Y_iY_j$ for $\lvert i-j\rvert=1$ is correct. The key part mentioned on the last edit can be solved via $$ \{\omega\in \Omega, (Y_iY_j)(\omega)=0\}=\{\omega\in\Omega, Y_i(\omega)=0\}\cup \{\omega\in\Omega, Y_j(\omega)=0\},$$ that is, the events $\{Y_iY_j=0\}$ and $\{Y_i=0\}\cup\{Y_j=0\}$ are equal.

It seems that your answer is correct. For $n=2$, $Z_2$ takes the values $0$, $1$ and $2$. It takes the value $0$ exactly when $X_1=X_2=X_3=0$ hence with probability $1/2$; the value $1$ when $Y_1=0$ and $Y_2=1$, or when $Y_1=1$ and $Y_2=0$. Thus $$ \mathbb P(Z_2=1)=\mathbb P(Y_1=0,Y_2=1)+\mathbb P(Y_1=1,Y_2=0)=\mathbb P(X_1=0,X_2=0,X_3=1)+\mathbb P(X_1=1,X_2=0,X_3=0)=2/8 $$ and $\mathbb P(Z_2=2)=5/8$. Therefore, $$ \mathbb E[Z_2^2]=\frac 28+2^2\frac 58=\frac{22}8, $$ $\mathbb{Z_2}=12/8=3/2$ hence $$ \operatorname{Var}(Z_2)=\frac{22}8-\frac{9}4=\frac12, $$ which matches with your formula and not with $\text{Var}(Z_n)=\frac{13n-10}{16}$.

Davide Giraudo
  • 181,608
  • It is true that ${Y_iY_j=0}={Y_i=0}\cup{Y_j=0}$, or if you prefer, $${\omega\in \Omega, (Y_iY_j)(\omega)=0}={\omega\in\Omega, Y_i(\omega)=0}\cup {\omega\in\Omega, Y_j(\omega)=0}.$$ – Davide Giraudo Jan 15 '25 at 17:52
1

Indeed, your argument is based on the fact that the minimum of two independent Bernoulli Random Variables equals the product of those variables.

It's quite not so convenient for a maximum of such, so let's convert $Y_i$ into a more convenient expression:

Let $W_i:=1-X_i$, so that $W_i\overset{\mathrm{iid}}\sim\mathcal{Bern}(1/2)$ and thus:

$\qquad\begin{align} Y_i&=X_i\vee X_{i+1}\\&= 1-W_i\wedge W_{i+1}\\&=1-W_iW_{i+1} \\[2ex] \mathsf E(Y_i) &= 1-\mathsf E(W_i)\mathsf E(W_{i+1}) \\[1ex] &= 1-(1/2)^2 \\[1ex] &= 3/4 \\[2ex]\mathsf{Var}(Y_i) &=\mathsf{Var}(W_iW_{i+1}) \\[1ex] &= \mathsf E(\mathsf{Var}(W_iW_{i+1}\mid W_{i}))+\mathsf {Var}(\mathsf E(W_iW_{i+1}\mid W_i)) \\[1ex] &= \mathsf E(W_i^2\,\mathsf {Var}(W_{i+1}))+\mathsf{Var}(W_i\,\mathsf E(W_{i+1})) \\[1ex] &=(1/4)(\mathsf E(W_i^2)+\mathsf {Var}(W_i)) \\[1ex]&= 3/16 \\[2ex] \mathsf{Cov}(Y_i,Y_{i+1}) &=\mathsf{Cov}(W_iW_{i+1}, W_{i+1}W_{i+2}) \\[1ex] &= \mathsf E(\mathsf{Cov}(W_iW_{i+1},W_{i+1}W_{i+2}\mid W_{i+1}))+\mathsf{Cov}(\mathsf E(W_iW_{i+1}\mid W_{i+1}),\mathsf E(W_{i+1}W_{i+2}\mid W_{i+1})) \\[1ex] &=\mathsf E(W_{i+1}^2\mathsf{Cov}(W_i, W_{i+2}))+\mathsf{Cov}(W_{i+1}\mathsf E(W_i),W_{i+1}\mathsf E(W_{i+2})) \\[1ex] &= 0+(1/2)^2(1/4) \\[1ex] &= 1/16 \\[2ex]\mathsf {Cov}(Y_i,Y_{i+k}: k>1) &= 0 \\[4ex] \mathsf E(Z_n) &=\sum_{i=1}^{n}\mathsf E(Y_i) \\[1ex] &= n\mathsf E(Y_1) \\[1ex] &= 3n/4 \\[2ex] \mathsf{Var}(Z_n) &= \mathsf{Cov}(\sum_{i=1}^{n} Y_i,\sum_{j=1}^{n} Y_j) \\[1ex] &= \sum_{i=1}^{n}\mathsf{Var}(Y_i) + 2\sum_{i=1}^{n-1}\mathsf{Cov}(Y_i, Y_{i+1})+ 2\sum_{i=1}^{n-2}\sum_{j=i+2}^{n}\mathsf {Cov}(Y_i, Y_j) \\[1ex] &= 3 n/16 + 2(n-1)/16 + 0 \\[1ex] & = (5n-2)/16 \end{align}$

As you had.

Graham Kemp
  • 133,231