What you'll learn
- What it means for a probability to be conditional on an event.
- How to restrict a sample space when new information is given.
- How to calculate conditional probabilities directly from outcomes, frequencies and set information.
- How to distinguish conditional probability from intersection and independence.
Prerequisites: events and intersections
A sample space is the set of all possible outcomes of an experiment. An event is a set of outcomes with a particular property.
For example, when rolling a fair six-sided die, the sample space is
S={1,2,3,4,5,6}.S=\{1,2,3,4,5,6\}.S={1,2,3,4,5,6}.If event AAA is “the result is even”, then
A={2,4,6}.A=\{2,4,6\}.A={2,4,6}.If AAA and BBB are two events, the intersection A∩BA\cap BA∩B contains the outcomes that belong to both events.
For instance, if BBB is “the result is greater than 3”, then
B={4,5,6}B=\{4,5,6\}B={4,5,6}and
A∩B={4,6}.A\cap B=\{4,6\}.A∩B={4,6}.Intersection of events
The event A∩BA\cap BA∩B occurs when both AAA and BBB occur.
What is conditional probability?
Sometimes you are given extra information about the outcome of an experiment. This information changes which outcomes are still possible.
The conditional probability of AAA given BBB is the probability that AAA occurs when you already know that BBB has occurred. It is written as P(A∣B)P(A\mid B)P(A∣B).
The vertical line means “given that”, so you read P(A∣B)P(A\mid B)P(A∣B) as:
the probability of AAA, given that BBB has occurred.
Conditional probability
Provided P(B)>0P(B)>0P(B)>0, the conditional probability of AAA given BBB is
P(A∣B)=P(A∩B)P(B).P(A\mid B)=\frac{P(A\cap B)}{P(B)}.P(A∣B)=P(B)P(A∩B).The event after the vertical line is the condition. It becomes your new, restricted sample space.

Restrict, then compare
To find P(A∣B)P(A\mid B)P(A∣B), restrict attention to outcomes in BBB, then find the proportion of those outcomes that also belong to AAA.
Restricting a die sample space
Conditioning on an even die score
A fair die is rolled. Let AAA be the event “the score is greater than 3” and let BBB be the event “the score is even”. Find P(A∣B)P(A\mid B)P(A∣B).
-
Knowing that BBB occurred restricts the possible outcomes to
B={2,4,6}.B=\{2,4,6\}.B={2,4,6}. -
Within this restricted sample space, the outcomes greater than 3 are 4 and 6. Therefore,
A∩B={4,6}.A\cap B=\{4,6\}.A∩B={4,6}. -
Two of the three equally likely outcomes in BBB also belong to AAA, so
P(A∣B)=23.P(A\mid B)=\frac{2}{3}.P(A∣B)=32.
Notice that the original sample space had six outcomes, but the denominator is now 3 because the condition tells you the result is even.
Using the original denominator
Once you are told that BBB has occurred, outcomes outside BBB are no longer possible. The denominator must represent the outcomes in BBB, not the whole original sample space.
Deriving the formula from first principles
Suppose a sample space contains n(S)n(S)n(S) equally likely outcomes, where n(X)n(X)n(X) means the number of outcomes in set XXX.
After conditioning on BBB, there are n(B)n(B)n(B) outcomes under consideration. Of these, n(A∩B)n(A\cap B)n(A∩B) also satisfy AAA. Therefore,
P(A∣B)=n(A∩B)n(B).P(A\mid B)=\frac{n(A\cap B)}{n(B)}.P(A∣B)=n(B)n(A∩B).For equally likely outcomes,
P(A∩B)=n(A∩B)n(S)P(A\cap B)=\frac{n(A\cap B)}{n(S)}P(A∩B)=n(S)n(A∩B)and
P(B)=n(B)n(S).P(B)=\frac{n(B)}{n(S)}.P(B)=n(S)n(B).Dividing these probabilities gives
P(A∩B)P(B)=n(A∩B)n(S)n(B)n(S)=n(A∩B)n(B).\begin{aligned} \frac{P(A\cap B)}{P(B)} &=\frac{\frac{n(A\cap B)}{n(S)}}{\frac{n(B)}{n(S)}}\\ &=\frac{n(A\cap B)}{n(B)}. \end{aligned}P(B)P(A∩B)=n(S)n(B)n(S)n(A∩B)=n(B)n(A∩B).This produces the conditional probability formula directly.
The condition must be possible
The expression P(A∣B)P(A\mid B)P(A∣B) is not defined when P(B)=0P(B)=0P(B)=0, because the formula would require division by zero.
Calculating from a frequency table
In real contexts, you may be given observed frequencies rather than theoretical probabilities. The same principle applies:
- Select the row, column or group named after “given that”.
- Use the total frequency of that group as the denominator.
- Count how many members of that group also satisfy the required event.
Consider this information about 120 students:
| Studies mathematics | Does not study mathematics | Total | |
|---|---|---|---|
| Studies physics | 36 | 14 | 50 |
| Does not study physics | 24 | 46 | 70 |
| Total | 60 | 60 | 120 |
Using a given group as the denominator
One student is selected at random. Find the probability that the student studies mathematics, given that they study physics.
-
The condition “given that they study physics” restricts attention to the 50 students in the physics row.
-
Of those 50 students, 36 also study mathematics. These students belong to the intersection of the two events.
-
Therefore,
P(mathematics∣physics)=3650=1825.P(\text{mathematics}\mid\text{physics}) =\frac{36}{50} =\frac{18}{25}.P(mathematics∣physics)=5036=2518.
If the question instead asked for the probability that a student studies physics, given that they study mathematics, the denominator would be 60:
P(physics∣mathematics)=3660=35.P(\text{physics}\mid\text{mathematics}) =\frac{36}{60} =\frac{3}{5}.P(physics∣mathematics)=6036=53.These probabilities are different because they use different restricted groups.
Reversing the condition
In general, P(A∣B)≠P(B∣A)P(A\mid B)\neq P(B\mid A)P(A∣B)=P(B∣A). The event after the vertical line determines the denominator.
Conditional probability with combined experiments
For experiments involving several stages, it can help to list all equally likely outcomes before applying the condition.
Using ordered outcomes from two dice
Two fair six-sided dice are rolled. Find the probability that both dice show even numbers, given that their total is 8.
-
Restrict the ordered outcomes to those whose total is 8:
(2,6), (3,5), (4,4), (5,3), (6,2).(2,6),\ (3,5),\ (4,4),\ (5,3),\ (6,2).(2,6), (3,5), (4,4), (5,3), (6,2). -
Among these five equally likely outcomes, both scores are even for
(2,6), (4,4), (6,2).(2,6),\ (4,4),\ (6,2).(2,6), (4,4), (6,2). -
Three of the five outcomes in the restricted sample space satisfy the required event, so the conditional probability is
35.\frac{3}{5}.53.
The outcomes must be treated as ordered pairs: for example, (2,6)(2,6)(2,6) and (6,2)(6,2)(6,2) are different outcomes because the first and second dice have exchanged scores.
Rearranging the conditional probability formula
Starting from
P(A∣B)=P(A∩B)P(B),P(A\mid B)=\frac{P(A\cap B)}{P(B)},P(A∣B)=P(B)P(A∩B),multiplying by P(B)P(B)P(B) gives the multiplication rule
P(A∩B)=P(B)P(A∣B).P(A\cap B)=P(B)P(A\mid B).P(A∩B)=P(B)P(A∣B).Similarly,
P(A∩B)=P(A)P(B∣A).P(A\cap B)=P(A)P(B\mid A).P(A∩B)=P(A)P(B∣A).Therefore,
P(B)P(A∣B)=P(A)P(B∣A).P(B)P(A\mid B)=P(A)P(B\mid A).P(B)P(A∣B)=P(A)P(B∣A).This is useful when the conditional probability and the probability of the condition are known.
Finding an intersection probability
Suppose P(B)=0.4P(B)=0.4P(B)=0.4 and P(A∣B)=0.7P(A\mid B)=0.7P(A∣B)=0.7. Find P(A∩B)P(A\cap B)P(A∩B).
-
Use the multiplication rule because the intersection probability is required:
P(A∩B)=P(B)P(A∣B).P(A\cap B)=P(B)P(A\mid B).P(A∩B)=P(B)P(A∣B). -
Substitute the given probabilities:
P(A∩B)=0.4×0.7.P(A\cap B)=0.4\times 0.7.P(A∩B)=0.4×0.7. -
Hence,
P(A∩B)=0.28.P(A\cap B)=0.28.P(A∩B)=0.28.
Conditional probability and independence
Two events are independent if knowing that one has occurred does not change the probability of the other.
Therefore, if AAA and BBB are independent and their probabilities are non-zero,
P(A∣B)=P(A)P(A\mid B)=P(A)P(A∣B)=P(A)and
P(B∣A)=P(B).P(B\mid A)=P(B).P(B∣A)=P(B).This is equivalent to the familiar independence condition
P(A∩B)=P(A)P(B).P(A\cap B)=P(A)P(B).P(A∩B)=P(A)P(B).Testing for independence
If conditioning on BBB changes the probability of AAA, then AAA and BBB are not independent.
Checking whether two events are independent
Suppose P(A)=0.3P(A)=0.3P(A)=0.3, P(B)=0.5P(B)=0.5P(B)=0.5 and P(A∩B)=0.2P(A\cap B)=0.2P(A∩B)=0.2. Determine whether AAA and BBB are independent.
-
Calculate the conditional probability:
P(A∣B)=P(A∩B)P(B)=0.20.5=0.4.P(A\mid B)=\frac{P(A\cap B)}{P(B)} =\frac{0.2}{0.5} =0.4.P(A∣B)=P(B)P(A∩B)=0.50.2=0.4. -
Compare this with the unconditional probability P(A)=0.3P(A)=0.3P(A)=0.3.
-
Since P(A∣B)≠P(A)P(A\mid B)\neq P(A)P(A∣B)=P(A), knowing that BBB occurred changes the probability of AAA. The events are therefore not independent.
Read the notation aloud
Read P(A∣B)P(A\mid B)P(A∣B) as “probability of AAA, given BBB”. This helps you identify BBB as the restricted sample space and prevents you from reversing the condition.
In the exam
- Translate “given that” into conditional notation and identify the event after the vertical line.
- Restrict the sample space to that condition before counting outcomes or choosing a denominator.
- Use P(A∣B)=P(A∩B)P(B)P(A\mid B)=\frac{P(A\cap B)}{P(B)}P(A∣B)=P(B)P(A∩B), and check that your answer lies between 0 and 1.
- Keep P(A∣B)P(A\mid B)P(A∣B) and P(B∣A)P(B\mid A)P(B∣A) separate: changing their order usually changes the answer.
Check yourself
- If P(A∩B)=0.15P(A\cap B)=0.15P(A∩B)=0.15 and P(B)=0.6P(B)=0.6P(B)=0.6, what is P(A∣B)P(A\mid B)P(A∣B)?
- When a card is known to be a face card, what becomes the new sample space?
- How could you use conditional probability to decide whether two events are independent?