From an Event to a Random Variable
An event has a probability, but it can also be represented by a random variable: its indicator records whether it occurred. This representation makes conditional event probabilities part of the general theory of conditional expectation. It also gives a precise way to discuss how the probability of an event changes with an observed variable.
The notation \(P(A\mid X=x)\) is often used for a function of \(x\) that represents \(P(A\mid X)\). For discrete \(X\), its value at each point with positive probability is an ordinary conditional probability. For continuous \(X\), it is typically calculated from a conditional density. Its value at a particular \(x\) can depend on the chosen version at points that have probability zero under the distribution of \(X\).
Why the Indicator Gives Conditional Probability
The key fact is a direct consequence of the averaging characterization of conditional expectation. Conditional expectation preserves the event's probability when averaged over any information in the conditioning sigma-field.
Proof. Since \(0\leq \mathbf{1}_A\leq 1\), its conditional expectation exists and is \(\mathcal{G}\)-measurable. By the defining averaging property of conditional expectation, for every \(B\in\mathcal{G}\),
Thus it has precisely the required averaging property. Uniqueness of conditional expectation up to equality almost surely establishes the claim. \(\square\)
Taking \(B\) to be the whole sample space also gives \(E[P(A\mid\mathcal{G})]=P(A)\). More generally, if \(B\) describes a condition that can be determined from the available information, then
This formula averages the conditional probability over the event \(B\) before dividing by \(P(B)\). The event \(B\) must belong to \(\mathcal{G}\) for this use of the defining property.
Conditioning on a Discrete Variable
Suppose \(X\) is discrete. At a value \(x\) with \(P(X=x)>0\), the conditional probability of \(A\) given \(X=x\) is
These values specify a version of the random variable \(P(A\mid X)\): on the event \(\{X=x\}\), it takes the value \(P(A\mid X=x)\). Values at \(x\) with \(P(X=x)=0\) do not affect the conditional expectation.
To verify the averaging formula, partition \(A\cap\{X\in C\}\) by the possible values of \(X\). Each term satisfies \(P(A\cap\{X=x\})=P(A\mid X=x)P(X=x)\), so summing and dividing by \(P(X\in C)\) gives the result.
Worked Example: A Discrete Risk Table
Let \(X\) be a three-level score with \(P(X=-1)=0.2\), \(P(X=0)=0.5\), and \(P(X=1)=0.3\). An event \(A\), such as a positive test result, has conditional probabilities \(P(A\mid X=-1)=0.1\), \(P(A\mid X=0)=0.4\), and \(P(A\mid X=1)=0.8\). Find \(P(A)\) and \(P(A\mid X\geq 0)\).
The conditional expectation of the indicator takes the corresponding event probability at each score:
Average over all three score values to obtain the event's unconditional probability:
For the condition \(X\geq 0\), the probability of the condition is \(0.5+0.3=0.8\). The probability of both \(A\) and \(X\geq0\) is \(0.4(0.5)+0.8(0.3)=0.44\). Therefore,
Equivalently, this is the weighted average \([0.4(0.5)+0.8(0.3)]/(0.5+0.3)\). The conditional probabilities are weighted by how often each score occurs within the selected group.
Conditioning on a Continuous Variable
For a continuous variable, \(P(X=x)\) is typically zero, so the discrete ratio cannot be used. Instead, a joint density gives a conditional probability through a ratio of densities. Let \((X,Y)\) have joint density \(f_{X,Y}\) and marginal density \(f_X\). For a Borel set \(D\), at values \(x\) where \(0<f_X(x)<\infty\), define
Proof. Write \(A_D=\{Y\in D\}\), and let \(C\) be any Borel set of possible values of \(X\). Using the definition of \(q_D\), the marginal density, and integration of the joint density,
The integrands are nonnegative, so the exchange of integration is justified by Tonelli's theorem. The last expression is \(E[\mathbf{1}_{\{X\in C\}}\mathbf{1}_{A_D}]\). Since events of the form \(\{X\in C\}\) generate \(\sigma(X)\), this averaging identity identifies \(q_D(X)\) as a version of \(E[\mathbf{1}_{A_D}\mid\sigma(X)]\). The same argument with \(\mathbf{1}_A(x,y)\) in the integrand proves the general event formula. \(\square\)
Worked Example: A Conditional Probability from a Triangular Density
Suppose \((X,Y)\) has joint density \(f_{X,Y}(x,y)=2\) for \(0<y<x<1\), and zero elsewhere. Find \(P(Y<1/2\mid X=x)\), then check that averaging this conditional probability gives \(P(Y<1/2)\).
First find the marginal density of \(X\):
For \(0<x\leq 1/2\), every possible value \(0<y<x\) is less than \(1/2\), so the numerator in the conditional-density ratio is \(2x\). For \(1/2<x<1\), only \(0<y<1/2\) qualifies, giving numerator \(2(1/2)=1\). Thus a version of the conditional probability is
Now average against \(f_X(x)=2x\):
The result also follows directly by integrating the joint density over \(0<y<\min(x,1/2)\): \(\int_0^{1/2}2x\,dx+\int_{1/2}^1 1\,dx=3/4\). Both calculations agree.
Using Conditional Probabilities to Answer a Group Question
A conditional probability given \(X\) varies with \(X\); a conditional probability given a group such as \(X>c\) is a single average over that group. The indicator identity makes the connection explicit: if \(P(X\in C)>0\), then
This follows because \(\{X\in C\}\in\sigma(X)\), so the averaging characterization gives \(E[\mathbf{1}_{\{X\in C\}}P(A\mid X)]=P(A\cap\{X\in C\})\). Dividing by the group probability produces the ordinary conditional probability.
Worked Example: Averaging a Probability Over a Continuous Group
Let \(X\sim\operatorname{Uniform}(0,2)\). Given \(X=x\), suppose an event \(A\) occurs when an independent \(U\sim\operatorname{Uniform}(0,1)\) satisfies \(U\leq x/2\). Find \(P(A\mid X>1)\).
For fixed \(x\in(0,2)\), the interval of \(U\)-values satisfying \(U\leq x/2\) has length \(x/2\). Therefore \(P(A\mid X=x)=x/2\). Since \(X\) has density \(1/2\) on \((0,2)\),
The numerator is \(P(A\cap\{X>1\})\), and \(P(X>1)=(2-1)/2=1/2\). As a check, conditional on \(X>1\), \(X\) is uniform on \((1,2)\), so the average of \(X/2\) is \(((1+2)/2)/2=3/4\), the same answer.
Common Pitfall and Why the Identity Matters
A common mistake is to treat \(P(A\mid X=x)\) for a continuous \(X\) as the ratio \(P(A\cap\{X=x\})/P(X=x)\). Both numerator and denominator are generally zero, so this ratio is undefined. The conditional probability is instead a version obtained from a conditional density or another conditional law; its values are meaningful almost everywhere with respect to the distribution of \(X\), not as a ratio of probabilities of point events.
The indicator formulation is useful because it unifies event probabilities with conditional expectations. It lets a statistician represent a changing event probability as a random variable, recover an overall probability by averaging, and compute a group-specific probability by averaging only over the relevant values of the conditioning variable. These operations rely on the same identity, whether the conditioning variable is discrete or continuous.
Check Your Understanding
Use the indicator identity and the conditioning formulas to answer these questions.
- Why is \(E[\mathbf{1}_A\mid\mathcal{G}]\) between zero and one almost surely, and what averaging property identifies it?
- If \(P(X=0)=0.4\), \(P(X=1)=0.6\), \(P(A\mid X=0)=0.2\), and \(P(A\mid X=1)=0.7\), calculate \(P(A)\).
- For a continuous \(X\), why is \(P(A\mid X=x)\) generally not computed by dividing \(P(A\cap\{X=x\})\) by \(P(X=x)\)?
- State the joint-density ratio for \(P(Y\in D\mid X=x)\), and identify the marginal-density condition needed to use it.
- Explain how \(P(A\mid X\in C)\) can be obtained by averaging \(P(A\mid X)\) over the group \(X\in C\).