# Conditional Probability Involving Sum of Bernoulli Trials

I have $X_i (i=1,...,n)$ which has $\text{Bernoulli}(p)$ or $\text{binomial}(1,p)$ distribution and each $X_i$ is independent with $X_i=1$ with probability $p$ and $X_i=0$ with probability $(1-p)$. I know that $S_n=X_1+\dots+X_n$ follows $\text{binomial}(n,p)$ distribution.

I am having trouble finding the conditional probability of $X_1=1$ given $S_n=k$. I am using the formula: $$P(X =x|Y =y)= P(X =x\text{ and }Y =y)/P(Y = y).$$ But I am having trouble finding the numerator. I am new to probability so any hints and suggestions would be appreciated.

• Use MathJax.... – Aqua Aug 29 '17 at 22:28
• This time I did it for you but you should typeset your question using LaTeX. – Arash Aug 30 '17 at 19:59

The probability that $S_n = k$ is of course $\binom{n}{k}p^k(1-p)^{n-k}$.

For $X_1$ to be $1$ and also $S_n = k$ two things must be true: $X_1 = 1$ (probability $p$) and $k-1$ among the remaining $n-1$ $X$-es must be $1$ (probability $\binom{n-1}{k-1}p^{k-1}(1-p)^{n-1-(k-1)}$).

So the conditional probability you want is $$\frac{p \binom{n-1}{k-1}p^{k-1}(1-p)^{n-k}}{\binom{n}{k}p^k(1-p)^{n-k}}= \frac{\binom{n-1}{k-1}}{\binom{n}{k}}=\frac{(n-1)!}{(k-1)!(n-k)!}\frac{k!(n-k)!}{n!} = \frac{k}{n}$$

Now you can slap your forhead, because it was trivial to see that $k$ out of the $n$ variables were $1$, so the probability of any specific variable being $1$ would have to be $\frac{k}{n}$. All that work for such an easy result!

\begin{align*} k&= E [ S_n | S_n =k]\\ & = \sum_{j=1}^n E[ X_j | S_n =k]\\ & = n P(X_1=1|S_n =k)\\ & \Rightarrow P(X_1=1|S_n=k) = \frac kn\end{align*}

$\mathsf P(X_1{=}1\mid S_n{=}k)$ is the probability that a particular trial (the first) is a success when given that exactly $k$ among the $n$ trials are successes.

Symmetry of the situation should immediately suggests this probability is $k/n$.   It is.

We can also do $\newcommand{\hide}[1]{\bbox[0.5ex,lemonchiffon]{\phantom{#1}}} \mathsf P(X_1{=}1\mid \sum_{j=1}^n X_j{=}k)~{~=~\dfrac{\mathsf P(X_1{=}1)\,\mathsf P(\sum_{j=2}^n X_j{=}k{-}1)}{\mathsf P(\sum_{j=1}^n X_j{=}k)}\\~=~ \dfrac{{p}\cdot\hide{ \binom {n-1}{k-1} p^{k-1}(1-p)^{n-k}}}{\binom n k p^k(1-p)^{n-k}} \\~=~ \dfrac{k}{n} }$