A library of 20,000 distinct words is generated. Two words out of the 20,000 are "mathematics" and "rocks". What is the number of times that "mathematics" "rocks" will end up next to each other in that specific order in a sequence of 2,000,000 words chosen at random uniformly (replacements occur with each pick)?
How do we go about solving for the expected value for the occurrence of the sequence of the two words for "mathematics rocks" (E[X])?
Where I am right now: I know that this is a linearity of expectation problem, where I first need to calculate the probability of the two words occurring in that particular order, but how do I apply that probability over the scope of 2,000,000?
For $i\in \{1,2000000-1\}$ let $X_i$ be the indicator variable for that slot. Thus $X_i=1$ if "mathematics" appears in slot $i$ and "rocks" appears in slot $i+1$, and $X_i=0$ otherwise. Of course $$E[X_i]=\left( \frac 1{20000}\right)^2$$
By Linearity the answer you want is given by $$E=E\left[\sum X_i\right]=\sum E[X_i]=1999999\times \left( \frac 1{20000}\right)^2\approx .005$$