= Solution
Let $N$ denote the mattress count and $U$ the event of undisturbed sleep. Use the intended model in which the presence of the pea is independent of $N$, with probability $1/2$, and without a pea sleep is undisturbed. Conditioning on $N$ gives
$$
\mathbb P(U\mid N=6)=\frac12,\qquad
\mathbb P(U\mid N=7)=\frac12+\frac12\frac15=\frac35,\qquad
\mathbb P(U\mid N=8)=\frac12+\frac12\frac25=\frac7{10}.
$$
The <law of total probability> and the equal prior probabilities give
$$
\boxed{\mathbb P(U)=\frac13\left(\frac12+\frac35+\frac7{10}\right)=\frac35.}
$$
By <Bayes' theorem>, the posterior probabilities of $N=6,7,8$ given $U$ are respectively $5/18,6/18,7/18$. Therefore the <conditional expectation> is
$$
\boxed{\mathbb E[N\mid U]=6\frac5{18}+7\frac6{18}+8\frac7{18}=\frac{64}{9}.}
$$
Undisturbed sleep shifts the posterior toward larger mattress counts because those counts make the observation more likely.
Back to article page