Probability & Statistics

Conditional Probability Tree

Visualize a two-stage process and calculate joint probabilities using a tree structure.

By Riano · Published · Updated · Report a correction

Conditional Probability Tree: multiply paths, add outcomes

A two-stage tree describes whether A occurs, then whether B occurs on each first-stage branch. Write p = P(A), q = P(B|A), and r = P(B|¬A). These are chosen probabilities, not random observations. A complete path represents an intersection, so its probability is the product of the two branch probabilities. Different leaves are disjoint, which lets us add their probabilities.

Predict all four leaves before moving a slider

Choose p = 0.25, q = 0.80, and r = 0.20. The first split allocates one quarter of the probability to A and three quarters to ¬A. Split each part again using its own conditional probability. In particular, 0.80 describes B among the A part, rather than 80 percent of the entire population.

LeafPath productJoint probability
A∩B0.25 × 0.800.200
A∩¬B0.25 × 0.200.050
¬A∩B0.75 × 0.200.150
¬A∩¬B0.75 × 0.800.600

Check that the four leaves add to 1.000. B occurs at two leaves, so P(B) = 0.200 + 0.150 = 0.350. Algebraically, the same reasoning gives P(B) = pq + (1 − p)r. No independence assumption is required: q and r can differ.

Reproduce the prediction and change one assumption

Open the Conditional Probability Tree interactive. The three sliders have step 0.01. The path cards provide numerical witnesses alongside the tree, and on a phone the controls panel scrolls independently. Use these steps to distinguish a first-stage probability from a conditional probability.

  1. Set P(A) to 0.25, P(B|A) to 0.80, and P(B|¬A) to 0.20. Read the four path values 0.200, 0.050, 0.150, and 0.600, and check P(B) = 0.350.
  2. Change only P(A) to 0.50. Predict the leaves 0.400, 0.100, 0.100, and 0.400. P(B) becomes 0.500 because more probability now reaches the branch with the larger conditional B probability.
  3. Keep P(A) = 0.50 and P(B|¬A) = 0.20, then set P(B|A) to 0.40. The A leaves become 0.200 and 0.300; the other two stay 0.100 and 0.400. P(B) is 0.300. Set P(B|A) to 0.00 to obtain 0.000, 0.500, 0.100, and 0.400, with P(B) = 0.100.
  4. Set P(A) to 0.00. Both A leaves are zero regardless of the stored A-side setting; the explanation marks that transition as unused. Drag the tree or use arrow keys, then select Reset view or press Home. Navigation changes the view, not any probability.

For another check, set P(A) = 0.30 and both conditional sliders to 0.60. Then P(B) = 0.60, since each parent sends the same fraction to B. Here B is independent of A, but that special case is not a requirement of the tree model.

Zero parents, rounding, and schematic widths

The model specifies a joint distribution through forward transition parameters. Ordinary conditional probability P(B|A) requires P(A) > 0. At P(A) = 0 its stored slider value is unused, and changing it cannot change any joint probability; it must not be interpreted as a conditional obtained by dividing zero by zero. The same distinction applies to P(B|¬A) when P(A) = 1.

  • Displayed path and marginal values round to three decimals. For P(A) = 0.01 and P(B|A) = 0.01, P(A∩B) = 0.0001 is positive even though its card displays 0.000. Add the unrounded mathematical leaves when checking exact normalization.
  • Branch width encodes its transition parameter, not the complete path probability. A zero branch keeps a one-pixel stroke so the possible event labels remain visible. Dashed branches identify unused transitions on a zero-mass parent; stroke presence does not establish positive mass.
  • The tree is schematic. It changes orientation on narrow screens to separate captions. Panning, resizing, and device pixel ratio change the drawing rather than the distribution.
  • The inputs are assumed probabilities. This module does not estimate them from data, simulate repeated trials, or calculate a reverse conditional automatically.

Where the rules come from

The sources below support the multiplication rule, adding disjoint paths, and the positive-probability condition for conditioning. The numeric example above is an independently calculated example for these controls; it is not an empirical dataset or a result attributed to either source.

Experience it interactively

Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Conditional Probability Tree module.

Try Conditional Probability Tree on Riano →

More in Probability & Statistics