Expectated value Four letters are typed at random so that each of the $26$ latin alphabet letters is equally likely and the letters are typed independently of one another. What is the expected number of times the word OF appears in this four letters long random text?
My attempt is
Let
$X$: random variable where O appears
$Y$: random variable where F appears
$$E(X) = 0 + P(X=1)x_1 = 1/26$$
$$E(Y) = 0 + P(X=1)x_1 = 1/26$$
$$\Rightarrow E(X+Y) = E(X) + E(Y) = 2/26 $$
(because i think $X$ and $Y$ are joint rather than independent since it should happen at the same time but i am very uncertain) 
Thank you very much
 A: There are three ways "OF" can appear in the string: at the beginning, in the middle, or at the end. Each one happens with probability $\frac1{26^2}$.
These events are related in varying ways; the event that "OF" appears in the beginning is disjoint from "OF" appearing in the middle (they can't happen at the same time) and independent from "OF" appearing at the end. But that's irrelevant.
If we define


*

*$X_1 = 1$ if the first two letters are "OF" and $0$ otherwise,

*$X_2 = 1$ if the middle two letters are "OF" and $0$ otherwise, and

*$X_3 = 1$ if the last two letters are "OF" and $0$ otherwise,


then $X_1 + X_2 + X_3$ is the total number of occurrences of "OF". By linearity of expectation (which always applies, whether or not the random variables are independent), 
$$
   \mathbb E[X_1 + X_2 + X_3] = \mathbb E[X_1] + \mathbb E[X_2] + \mathbb E[X_3] = \frac1{26^2} + \frac1{26^2} + \frac1{26^2} = \frac3{26^2}.
$$
A: Let's define the random variable $X$= number of times the sequence 'OF' appears.
Notice that $X$ can take on the values: $0,1$ or $2$. So, in this case, $$E[X] = 0 \cdot P(X=0)+1\cdot P(X=1)+2 \cdot P(X=2)$$
Now these are all the possibilities where the sequence 'OF' appears:


*

*$OFxx: 26 \cdot26-1=675$ is the number of ways you can obtain this (because each $x$ can take on $26$ values, except the case when they are 'OF' once again)

*$xOFx: 26 \cdot26 =676$ number of ways to obtain this.

*$xxOF : 26 \cdot26-1= 675 $ number of ways, following the first reasoning.

*$OFOF$: $1$ way to obtain this.


So then
$P(X=0)= \frac{26^4-2(675)-676-1}{26^4}= \frac{454949}{26^4}$
$P(X=1)= \frac{2(675)+676}{26^4}=\frac{2026}{26^4}$
$P(X=2)= \frac{1}{26^4}$
So finally:
$$E[X]=0\cdot\frac{454949}{26^4}+1\cdot \frac{2026}{26^4} + 2 \cdot\frac{1}{26^4} = \frac{1013}{228488}+\frac{1}{228488}= \frac{3}{676} = \frac{3}{26^2}.$$
A: You need $O$ to appear in one of the first three places, with probability $\frac 3{26}$ then $F$ to appear next with probability $\frac 1{26}$ so it would appear it is $\frac 3{26^2}$ but you have counted $OFOF$ twice so it is $\frac 3{26^2}-\frac 1{26^4}$
