Expected number of light bulbs on There are 50 light bulbs in a room each with its own switch.
Initially all light bulbs are off.
Dick follows the following procedure 50 times:
He randomly selects a light bulb and flips the switch, turning it on if it is off and off if it is on.
What is the expected number of light bulbs on in the room after 50 flips, rounded to the nearest natural number?

$\newcommand{E}{\mathbf{E}}$
Let $E_i$ be the event that bulb $i$ is on after $50$ flips. This is the case if switch $i$ is chosen an odd number of times. Compute $\Pr(E_i)$ and let $X_i$ be the indicator random variable for $E_i$. Then $\E[X_i] = \Pr(E_i)$. Now, let $X$ be the total number of bulbs on after $50$ flips. $X=\sum_{i=1}^{50}X_i$, so $\E[X] = \sum_{i=1}^{50} \E[X_i] = 50 \cdot \Pr(E_i)$. So you just need to compute the probability that a given switch is flipped an odd number of times in 50 flips.
One way to compute $\Pr(E_i)$ is as follows. Let $P_k$ be the probability that switch $i$ is flipped an odd number of times in the first $k$ flips. Let $p = 1/50$. Then $P_0 = 0$, and $P_k = p(1-P_{k-1}) + (1-p)P_{k-1}$ for any $k>0$. You can compute $P_{50}$ by repeatedly applying this recurrence, which gives you the value of $\Pr(E_i)$.
