Conditional Expectation of Bernoulli R.V.
Let $X_1, X_2,\ldots, X_n$ be iid bernoulli r.v. with parameter $p$. Let $S=X_1+\cdots+X_n$ and $Y=X_1X_2$. Compute $\mathbb{E}(Y\mid S)$.
I know that $\mathbb{E}(X_1\mid S) = S/n$. So If I could split $\mathbb{E}(Y\mid S)$ into two then I would be done. But I don't think that is allowed. How to proceed?
Solution 1:
The expected value of a Bernoulli-distributed random variable is the same as its probability of being equal to $1.$ So you have $\operatorname E(X_1) = \cdots = \operatorname E(X_n) = p.$ Note that $X_1 X_2$ is a Bernoulli-distributed random variable, i.e. it must be either $0$ or $1.$
\begin{align} & \operatorname E(X_1 X_1 \mid X_1+\cdots+X_n = s) = \Pr(X_1 X_2=1 \mid X_1+\cdots+X_n = s) \\[10pt] = {} & \frac{\Pr(X_1 X_2=1\ \&\ X_1+\cdots+X_n=s)}{\Pr(X_1+\cdots+X_n=s)} \\[10pt] = {} & \frac{\Pr(X_1=1\ \&\ X_2=1\ \&\ X_1+\cdots+X_n=s)}{\Pr(X_1+\cdots+X_n=s)} \\[10pt] = {} & \frac{\Pr(X_1=1\ \&\ X_2=1\ \&\ X_3+\cdots+X_n=s-2)}{\Pr(X_1+\cdots+X_n=s)} \\[10pt] = {} & \frac{\Pr(X_1=1\ \&\ X_2=1) \cdot \Pr(X_3+\cdots+X_n=s-2)}{\Pr(X_1+\cdots+X_n=s)} \\[10pt] = {} &\frac{p^2 \cdot \binom {n-2}{s-2} p^{s-2}(1-p)^{n-s}}{\binom n s p^s (1-p)^{n-s}} \\[10pt] = {} & \frac{\binom{n-2}{s-2}}{\binom n s} = \frac{s(s-1)}{n(n-1)}. \end{align}
Solution 2:
Here's another way. Let $a = E[X_1 X_2 \mid S]$. By symmetry, $a=[X_i X_j \mid S]$ for any $i\ne j$.
Now write $$S^2= \left(\sum_i X_i \right)^2= \sum_i X_i^2 + \sum_{i\ne j} X_i X_j=\sum_i X_i + \sum_{i\ne j} X_i X_j=S+\sum_{i\ne j} X_i X_j$$
Conditioning on $S$ and taking expectation
$$E[ S^2 \mid S] = S^2 = S+ n(n-1) a$$
Hence
$$a = \frac{S(S-1)}{n(n-1)}$$