4.3 Computing probabilities by conditioning

Let \(E\) be an arbitrary event, and define the indicator random variable \[ X = \begin {cases} 1 , & \text {if } E \text { occurs} , \\ 0 , & \text {if } E \text { does not occur.} \end {cases} \] Then \(E(X) = 1 \cdot P(E) + 0 \cdot P(E^c) = P(E)\), and for any random variable \(Y\), \(E(X \mid Y = y) = P(E \mid Y = y)\). So Result 4.2.1 gives \[ P(E) = E\bigl (E(X \mid Y)\bigr ) = \begin {cases} \displaystyle \sum _yP(E \mid Y = y)P(Y = y) , & \text {if } Y \text { is discrete} , \\[2ex] \displaystyle \int P(E \mid Y = y)f_Y(y)\,dy , & \text {if } Y \text { is continuous.} \end {cases} \]

Remark. If \(Y\) is discrete, taking the values \(y_1, y_2, \dots , y_k\), define the events \(A_i = \{Y = y_i\}\), \(i = 1, 2, \dots , k\). Then \[ P(E) = \sum _{i=1}^kP(E \mid Y = y_i)P(Y = y_i) = \sum _{i=1}^kP(E \mid A_i)P(A_i) , \] which is the law of total probability.

Example 4.3.1. Let \(X\) be uniformly distributed on \((0, 1)\), and suppose that, given \(X = p\), \(Y\) is binomial with parameters \(n\) and \(p\). Find the distribution of \(Y\).

Solution. Here \(f_X(p) = 1\) for \(0 < p < 1\) and \[ P(Y = y \mid X = p) = \binom nyp^y(1 - p)^{n-y} , \qquad y = 0, 1, \dots , n . \] Conditioning on \(X\), \begin {align*} P(Y = y) &= \int _0^1P(Y = y \mid X = p)f_X(p)\,dp \\ &= \int _0^1\binom nyp^y(1 - p)^{n-y}\,dp = \binom ny\,B(y + 1, n - y + 1) \\ &= \frac {n!}{y!\,(n - y)!}\cdot \frac {\Gamma (y + 1)\Gamma (n - y + 1)}{\Gamma (n + 2)} \\ &= \frac {n!}{y!\,(n - y)!}\cdot \frac {y!\,(n - y)!}{(n + 1)!} = \frac {1}{n + 1} . \end {align*}

So \(P(Y = y) = 1/(n + 1)\) for \(y = 0, 1, \dots , n\): \(Y\) has the discrete uniform distribution. If the success probability is itself completely unknown, every number of successes is equally likely.

Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.