Calculate expected value and variance. A coin is tossed 25 times. The probability of head is a $P(head)= ¾ $.
If you get two times in a row the same result you get +1, if not -2.
I have to calculate the expected value of the benefit and the variance.
My try was defining $ Z= 3* \sum_{i=1}^{24} x_i -48 $ where $x_i = 1$ if i and i+1 have the same value, if not it's 0.
So now I have to calculate $E[Z]$ and $Var[Z]$. Any hint of how to proceed? Any help is greatly appreciated
 A: Let $X_i$ be the indicator random variable of the event that $i$ and $(i+1)^{\text{th}}$ toss have the same value. (This is exactly like you defined). Note that,
\begin{align*}
\mathbb{E}[X_i] = \Pr(X_i = 1) = \Pr(\{HH\} \cup \{TT\}) = \frac{3}{4} \cdot \frac{3}{4} + \frac{1}{4} \cdot \frac{1}{4} = \frac{5}{8}.
\end{align*}
Similarly, note that $X_i$ and $X_j$ are independent if $|i - j| \geq 2$ and consequently, $\mathbb{E}[X_iX_j] = \mathbb{E}[X_i]\mathbb{E}[X_j] = (\mathbb{E}[X_i])^2$. Also,
\begin{align*}
\mathbb{E}[X_iX_{i+1}] = \Pr(\{X_i = 1\} \cap \{X_{i+1} = 1\}) = \Pr(\{HHH\} \cup \{TTT\}) = \frac{3}{4} \cdot \frac{3}{4} \cdot \frac{3}{4} + \frac{1}{4} \cdot \frac{1}{4} \cdot \frac{1}{4} = \frac{7}{16}.
\end{align*}
The gain is given by $Z = 3 \sum_{i = 1}^{24} X_i - 48$. Using linearity of expectation,
\begin{align*}
\mathbb{E}[Z] = 3 \sum_{i = 1}^{24} \mathbb{E}[X_i] - 48 = 45 - 48 = -3.
\end{align*}
Similarly,
\begin{align*}
\text{Var}[Z] &= \text{Var}\left(3 \sum_{i = 1}^{24} X_i - 48\right) \\
& = 9\text{Var}\left(\sum_{i = 1}^{24} X_i\right) \\
& = 9 \left[\sum_{i = 1}^{24}\sum_{j = 1}^{24} \mathbb{E}[X_iX_j] - \left(\sum_{i = 1}^{24} \mathbb{E}\left[X_i\right]\right)^2 \right] \\
& = 9 \left[\sum_{i = 1}^{24}\mathbb{E}[X_i^2]+ \sum_{i = 1}^{23}\mathbb{E}[X_iX_{i+1}] + \sum_{i, j = 1, |i - j|\geq 2}^{24} \mathbb{E}[X_iX_j]   - 225 \right] \\
& = 9 \left[15 + \frac{161}{16} + 529\cdot\frac{25}{64}   - 225 \right] \\
& = \frac{3861}{64}.
\end{align*}
