# Showing that all possible outcomes are equally likely.

Question:

Consider a sequence of independent trials, with each trial being a success with probability $p$. Given that the $k$th success occurs on trial $n$,show that all possible outcomes of the first $n-1$ trials that consist of $k-1$ successes and $n-k$ failures are equally likely.

My Attempt:

My first instinct is to says that I need to define two random variables and find a joint probability. I have tried to think through this and come up with the proper random variables but I am stumped. I don't even know where to start.

We are given an sequence of independent, identically distributed random variables $X_1,X_2,\ldots$ where $P(X_j = 1) = p$ with $p\in [0,1]$ fixed, and $P(X_j = 0) = 1-p.$ We interpret the event $\{X_j = 1\}$ as success and the event $\{X_j =0\}$ as failure. We use set notation to denote events. Let's put $$S_m = X_1 + \cdots + X_m.$$
Moreover, we are given two integers $k$ and $n$ with $1\leq k \leq n.$ We are interested in the event \begin{align} A & = \{ the\ k-th\ success\ occurs\ on\ the\ n-th\ try \} \\ & = \{ S_n = k\ and\ S_{n-1} = k-1 \} \\ & = \{X_n = 1\ and\ S_{n-1} = k-1 \} \\ & = \{X_n = 1\} \cap \{ S_{n-1} = k-1 \} \\ & = B \cap C \end{align} if we define $$B = \{X_n = 1\}\qquad and \qquad C = \{ S_{n-1} = k-1 \}.$$ Observe that $C$ is determined by the variables $X_1,\ldots,X_{n-1}$ and completely independent (pun intended) of the variable $X_n.$
Next, pick a bit vector $$v = (\nu_1,\ldots,\nu_{n-1})\in \{0,1\}^{n-1}.$$ Put $$\tau = \nu_1 + \cdots + \nu_{n-1}.$$ Let's consider the event $$D_v = \{X_1 = \nu_1,\ldots,X_{n-1} = \nu_{n-1}\}.$$ In words, $D_v$ is the event, that the variables $X_1,\ldots, X_{n-1}$ have the success-and-failure pattern $v.$
If $\tau \neq k-1,$ then $D_v\cap C = \emptyset.$ If $\tau = k-1,$ then $D_v \subseteq C.$ Since the various $D_u$ (for all possible $u\in \{0,1\}^{n-1}$) are pairwise disjoint and cover the whole probability space, we conclude $$C = \bigcup_{\tau = k-1} D_u,$$ where the union is disjoint.
Regarding our fixed bit vector $v,$ we are interested in the probability that the variables $X_1,\ldots,X_{n-1}$ have success-and-failure pattern $v,$ given that the $k-th$ success occurs on the $n-th$ try - in symbols: $$P(D_v|A) = \frac{P(D_v\cap A)}{P(A)}.$$ If $\tau\neq k-1,$ we get from our observations above $$D_v\cap A = D_v\cap B\cap C = \emptyset,$$ since $D_v\cap C = \emptyset,$ and thus $$P(D_v|A) = 0.$$ If $\tau = k-1,$ we get from our observations above $$D_v\cap A = D_v \cap B \cap C = D_v \cap B,$$ since $D_v\subseteq C.$ Using independence of the $X_j,$ we find $$P(D_v\cap A) = P(D_v \cap B) = p^k(1-p)^{n-k},$$ and thus $$P(D_v|A) = \frac{p^k(1-p)^{n-k}}{P(A)}.$$ This expression is the same for any $v$ which has $\tau= k-1.$ That's exactly the result we wanted.