Conditional probability: change the sample space first
Use a two-way table to distinguish conditional probability, reverse conditioning and independence.
The examples and questions in this lesson were created for practice. They are not past exam questions or real examination results.
A condition changes which outcomes remain possible
Conditional probability asks how likely event A is when event B is already known to have occurred. Restrict the sample space to B, then count the part of B that also belongs to A. The condition belongs in the denominator.
P(A | B) = P(A ∩ B) / P(B), provided P(B) > 0.
For equally likely individual items, this becomes the number of items satisfying both A and B divided by the number satisfying B. Reversing A and B usually changes the denominator, so P(A | B) and P(B | A) need not be equal. A zero-probability condition is outside this elementary formula.
Inspecting a batch using a two-way table
A batch contains 100 components. A component is selected uniformly at random, so each component has the same chance of selection. “Line A” and “Line B” identify the production line, while “failed” identifies the inspection result.
| Production line | Failed | Passed | Total |
|---|---|---|---|
| Line A | 8 | 32 | 40 |
| Line B | 6 | 54 | 60 |
| Total | 14 | 86 | 100 |
Given that the component came from Line A, the failure probability is 8/40 = 1/5 = 20%. Given that it failed, the probability it came from Line A is 8/14 = 4/7. The numerator is the same intersection, but the conditions select different groups.
The overall failure probability is 14/100 = 14%. Failure and production line are not independent in this table: knowing that a component came from Line A changes the failure probability from 14% to 20%. Independence would require P(failed | Line A) = P(failed), since the conditioning event has positive probability.
A useful arithmetic check
Combine the two line-specific failure rates using their selection probabilities: (40/100) × (8/40) + (60/100) × (6/60) = 8/100 + 6/100 = 14/100. Averaging 20% and 10% without weighting would incorrectly give 15%.
Choose the group before calculating
1. Given that the selected component passed, what is the probability it came from Line B?
Read the solution
The condition restricts the group to the 86 passed components. Of those, 54 came from Line B. The probability is 54/86 = 27/43, approximately 62.79%. Dividing by 60 would instead answer the probability of passing given Line B.
2. One component is selected from this batch, found to have failed, and removed. A second component is selected uniformly from the remaining batch. What is the probability that it fails?
Read the solution
There are 99 components left and 13 failures left. The answer is 13/99, approximately 13.13%. The original 14/100 is no longer the correct fraction because the draw is without replacement. The production line of the first component does not affect this total count.
3. In a different batch, P(A) = 0.4, P(B) = 0.5 and P(A ∩ B) = 0.2. Are A and B independent?
Read the solution
Yes. P(A)P(B) = 0.4 × 0.5 = 0.2, equal to the intersection probability. Equivalently, P(A | B) = 0.2/0.5 = 0.4 = P(A). This does not mean the events cannot occur together; their intersection has probability 0.2.
A flagged item is not necessarily defective: account for the base rate
Consider a new, invented batch of 1,000 items. Exactly 20 are defective. A screening machine flags 18 of those defective items and also flags 49 of the 980 good items. Select one item uniformly from the flagged items. What is the probability that it is actually defective?
| Actual state | Flagged | Not flagged | Total |
|---|---|---|---|
| Defective | 18 | 2 | 20 |
| Good | 49 | 931 | 980 |
| Total | 67 | 933 | 1,000 |
The condition is “flagged”, so the denominator is 67. Only 18 of these items are defective: P(defective | flagged) = 18/67, approximately 26.87%. The 90% detection rate, 18/20, answers P(flagged | defective). It cannot be used as the answer to the reversed question.
The same result follows without a count table. Let D mean defective and F mean flagged. The two disjoint routes to a flag are a defective item that is detected and a good item that triggers a false flag. Thus P(F) = 0.02 × 0.90 + 0.98 × 0.05 = 0.067. The defective-and-flagged route has probability 0.018, so P(D | F) = 0.018/0.067 = 18/67. These route probabilities are multiplied as a marginal probability times a conditional probability; we did not assume D and F are independent.
Change the prevalence, keep the screening rates
In another 1,000-item batch, 200 items are defective. The machine flags 90% of defective items and 5% of good items. Among flagged items, what fraction are defective?
Build the new denominator
There are 180 flagged defective items and 40 flagged good items. The answer is 180/(180 + 40) = 9/11, approximately 81.82%. The machine's conditional screening rates are unchanged, but the mix of incoming items is different. Reusing 18/67 would silently assume the old base rate. In a question, identify which probabilities stay fixed before carrying over an earlier answer.
Explain the denominator in words
Before writing a fraction, finish the sentence “Among the outcomes that …”. That phrase should describe the condition. Then check whether selection is uniform, whether replacement occurs, and whether the resulting fraction lies between 0 and 1. These assumptions determine whether counting items is a valid probability calculation.
Scope and provenance
This is an original probability foundation lesson for GATE preparation, not an official GATE question or a claim that every paper has the same syllabus. The table and exercises were created by TeamCat. All probabilities follow from the stated sampling assumptions and can be checked directly from the counts.