# Distribution given n independent Bernoulli random variables

Could someone let me know if this makes sense?

Let $X_1,...,X_n$ be independent Bernoulli random variables B(1,p) and let $S_n=X_1+...+X_n$.

Determine the conditional distribution of $X_1$ given that $S_n=r.$
Determine the conditional distribution of $S_k$, given that $S_n=r$ if $k<n.$

My attempt:
$X_1$ is a Bernoulli random variable so it can take the value $0$ with probability $1-p$ or $1$ with probability $p$. $S_n$ is a binomial random variable with parameters $n$ and $p$.

$P_{x_1=0|S_n=r}=\frac{P(S_n=r|x_1=0)P(x_1=0)}{P(S_n=r)}=\frac{{n-1 \choose r}p^r(1-p)^{n-r}(1-p)}{{n \choose r}p^r(1-p)^{n-r}}=\frac{(1-p)(n-r)}{n}$.

$P_{x_1=1|S_n=r}=\frac{P(S_n=r|x_1=1)P(x_1=1)}{P(S_n=r)}=\frac{{n-1 \choose r-1}p^r(1-p)^{n-r}p}{{n \choose r}p^r(1-p)^{n-r}}=\frac{pr}{n}$.
If this is correct, then I think I am able to determine the other conditional distribution ( I think it would simplify to a hypergeometric distribution).

• Are the Bernoulli r.v.'s identically distributed? You never said so, but your proof assumes it. Apr 26 '18 at 2:15
• @ClementC. Hmmmm well I guess I just assumed that. The prompt is exactly what I wrote above so ... If they're not identically distributed I cannot make the claim that $S_n$ is a binomial random variable with parameters n and p... Apr 26 '18 at 2:20
• Indeed, in that case it is a Poisson Binomial Distribution. Apr 26 '18 at 2:21
• Although I would assume they meant to imply the $X_i$'s are i.i.d. (?). You are sure it was written "independent" and not "i.i.d."? Apr 26 '18 at 2:22
• @ClementC. Just checked! It says "....be independent Bernoulli random variables B(1,p)". So yes they have the same parameter p. Apr 26 '18 at 2:28

Almost. When given a value of $x_1$ you know what one from the $n$ results will be, and just need to consider how the remaining $n-1$ results will give $S_n-x_1$ successes.

If the random variables are independent and identically Bernoulli distributed with parameter $p$.

$$\begin{split}\mathsf P({x_1=0\mid S_n=r})&=\frac{\mathsf P(S_n-x_1=r-0\mid x_1=0)\cdot \mathsf P(x_1=0)}{\mathsf P(S_n=r)}\\&=\frac{{n-1 \choose r}p^r(1-p)^{\color{red}{n-1}-r}\cdot(1-p)}{{n \choose r}p^r(1-p)^{n-r}}\\&=\frac{(n-r)}{n}\end{split}$$

$$\begin{split}\mathsf P({x_1=1\mid S_n=r})&=\frac{\mathsf P(S_n-x_1=r-1\mid x_1=1)\cdot\mathsf P(x_1=1)}{\mathsf P(S_n=r)}\\&=\frac{{n-1 \choose \color{red}{r-1}}p^{\color{red}{r-1}}(1-p)^{n-r}\cdot p}{{n \choose r}p^r(1-p)^{n-r}}\\&=\frac{r}{n}\end{split}$$

Reality check: $\frac{n-r}n+\frac r n=1$

Intuition check: If the $r$ successes had been spread among the $n$ samples without bias, then the probability that the first sample was among the successes will be $r/n$.

Now similarly: $$\mathsf P(S_k=t\mid S_n=r) = \dfrac{\mathsf P(S_n-S_k=r-t\mid S_k=t)\cdot \mathsf P(S_k=t)}{\mathsf P(S_n=r)}$$

Use similar intuition to anticipate your result.

• Thank you! I got it! Apr 26 '18 at 3:48