Read the tree left to right: edge labels carry the branch probabilities, and the four endpoints show the joint probabilities as P = values. Learn more about reading the tree
Click any card in Calculated Probabilities to light up its path in the card's colour; click it again or press Clear Selection to reset. Learn more about clicking to highlight
Joint Probabilities cards show each endpoint as a product along its path, e.g. P(A∩B)=P(A)×P(B∣A); the four sum to 1. Learn more about joint probabilities
Marginal Probabilities cards: P(A) and P(Aᶜ) come from the first split, while P(B) adds the two paths that end in B. Learn more about marginal probabilities
Visualizing Conditional Probability with Tree Diagrams
Tree diagrams display probability relationships as branching paths. Each branch represents a possible outcome with its probability labeled along the path. This tool lets you adjust P(A), P(B|A), and P(B|Aᶜ) to see how joint probabilities, marginal probabilities, and Bayes' theorem calculations change in real time.
Getting Started with the Tree Diagram
This interactive tree diagram visualizes conditional probability as branching paths from left to right. The diagram starts at a single point and splits into branches representing possible outcomes, with probabilities labeled along each path.
The left side displays the tree structure with nodes and connecting branches. The right side shows calculated probabilities organized into panels: joint probabilities, marginal probabilities, and conditional probabilities. All values update instantly as you adjust the input parameters.
Three sliders below the tree control the fundamental probabilities that determine the entire structure. Every other probability in the diagram derives mathematically from these three inputs, demonstrating how a few conditional probability values generate a complete probability model.
Using the Probability Sliders
DemoMoving the three sliders
Step 0 of 4
Three sliders control the tree diagram's probability structure:
• P(A) sets the probability of event A occurring at the first branch. Moving this slider changes how probability mass splits between the upper branch (A) and lower branch (Aᶜ). Values range from 0.01 to 0.99.
• P(B|A) sets the conditional probability of B given that A has occurred. This determines how the A branch splits into outcomes B and Bᶜ on the second level.
• P(B|Aᶜ) sets the conditional probability of B given that A has not occurred. This determines how the Aᶜ branch splits into outcomes B and Bᶜ.
As you adjust any slider, watch how the branch labels update, the node probabilities change, and all calculated values in the right panel recalculate. The complement probabilities P(Aᶜ), P(Bᶜ|A), and P(Bᶜ|Aᶜ) calculate automatically as 1 minus their counterparts.
Reading the Tree Structure
The tree displays events in chronological order. The first level splits into A (event occurs) and Aᶜ (event does not occur). The second level shows what happens next: each first-level outcome leads to either B or Bᶜ.
Four endpoints represent the four possible joint outcomes:
• A ∩ B (upper path): Event A occurred, then event B occurred • A ∩ Bᶜ (second path): Event A occurred, then event B did not occur • Aᶜ ∩ B (third path): Event A did not occur, then event B occurred • Aᶜ ∩ Bᶜ (lower path): Neither event occurred
Each endpoint displays its joint probability, calculated by multiplying along the path. The probability labels on branches show exactly which values multiply together to produce each joint probability.
The Tree at Its Opening Settings
The sliders start at P(A)=0.6, P(B∣A)=0.7 and P(B∣Ac)=0.3. Every other number on the page is derived from those three.
The four leaves come out as 0.42, 0.18, 0.12 and 0.28, and they sum to exactly 1.
The tree at P(A) = 0.6, P(B|A) = 0.7, P(B|not A) = 0.3
The four leaves are 0.42, 0.18, 0.12 and 0.28, summing to exactly 1. Three slider values determine every number on the diagram.
Three numbers determine everything because of how the tree is built. The first split uses P(A) and its complement; each second split uses a conditional and its complement. Three free parameters, four leaves, one constraint that they sum to 1.
Read the edge labels as you go and the leaf values are just products along a path. Nothing on this diagram requires a formula you have not already used by the time you reach the right-hand side.
One Path: the Multiplication Rule
Highlighting the A∩B path colours the two edges that lead to it and fades the rest. The leaf reads 0.42, which is 0.6×0.7 — the edge probabilities multiplied.
That is the multiplication rule P(A∩B)=P(A)⋅P(B∣A), drawn as a route rather than written as an equation.
The A then B path highlighted
Two edges light up and the rest fade. The leaf is 0.6 x 0.7 = 0.42 - the multiplication rule drawn as a route. The conditional 0.7 is the edge; the joint 0.42 is the leaf.
The order matters for reading, not for the answer. The same leaf is P(B)⋅P(A∣B)=0.54×0.7778=0.42, which is the tree drawn with B first. A tree commits you to one order of conditioning; the joint probability it produces does not depend on that choice.
Notice also what a single path is not. 0.42 is the probability of A and B together, not the probability of B given A. The conditional is the edge label, 0.7; the joint is the leaf.
Two Paths: the Law of Total Probability
Highlighting B lights up two paths at once, because B can be reached either through A or through Ac.
Adding those two leaves gives P(B)=0.42+0.12=0.54.
Both paths that reach B highlighted
B is reachable through A or through not-A, so two leaves light up: 0.42 + 0.12 = 0.54. That is the law of total probability, and 0.54 sits between the conditionals 0.7 and 0.3.
Written out, that is P(B)=P(A)P(B∣A)+P(Ac)P(B∣Ac)=0.6(0.7)+0.4(0.3) — the law of total probability. The tree makes the reason obvious: A and Ac partition everything, so every route to B passes through exactly one of them, and no route is counted twice.
The result is worth sitting with. P(B)=0.54 lies between the two conditionals 0.7 and 0.3, closer to 0.7 because A is the more likely branch. A marginal is always a weighted average of the conditionals, with the branch probabilities as the weights.
From here Bayes' theorem is one division: P(A∣B)=0.540.42=0.7778. The numerator is one highlighted leaf and the denominator is both of them.
A Whole Subtree: Where the Ones Live
Highlighting everything below A picks out the two edges P(B∣A)=0.7 and P(Bc∣A)=0.3, and the two leaves 0.42 and 0.18.
Those two edges sum to 1. Those two leaves sum to 0.6, which is P(A).
The whole subtree under A highlighted
Its two edges sum to 1 (they are conditional on A) but its two leaves sum to 0.6, which is P(A). Edges out of a node sum to 1; leaves under it sum to the node.
That contrast is the single most useful reading habit for trees. Edges out of a node sum to 1, because they are conditional on that node having been reached. Leaves under a node sum to the node's own probability, because they partition it.
Confusing the two is the standard error. 0.42+0.18=0.6, not 1 — the branch under A does not carry all the probability, only A's share of it. Conditioning on A is what rescales 0.42 back up to 0.7.
Clicking to Highlight Paths
DemoHighlighting paths
Step 0 of 5
Click any probability in the right panel to highlight its corresponding path through the tree. The highlighting system uses distinct colors for each probability type, making it easy to trace calculations visually.
When you click a joint probability like P(A ∩ B), the entire path from start to that endpoint highlights in the matching color. The branch labels and nodes along that path also change color, showing exactly which probabilities multiply together.
Clicking marginal probabilities highlights all paths that contribute. For example, clicking P(B) highlights both paths ending in B (through A and through Aᶜ), demonstrating that P(B) = P(A ∩ B) + P(Aᶜ ∩ B).
Click the same probability again or use the Clear Selection button to remove highlighting and return to the default view.
Understanding Joint Probabilities
The Joint Probabilities panel shows P(A ∩ B) for all four outcome combinations. Each joint probability equals the product of probabilities along its path—this is the multiplication rule for sequential events.
The formulas display explicitly:
P(A∩B)=P(A)×P(B∣A)
P(A∩Bc)=P(A)×P(Bc∣A)
P(Ac∩B)=P(Ac)×P(B∣Ac)
P(Ac∩Bc)=P(Ac)×P(Bc∣Ac)
The four joint probabilities always sum to exactly 1, representing the complete sample space. Click any joint probability to see its path highlighted in the tree, visually confirming the multiplication.
Marginal Probabilities from the Tree
The Marginal Probabilities panel shows P(A), P(Aᶜ), P(B), and P(Bᶜ). While P(A) and P(Aᶜ) come directly from the first branch, P(B) and P(Bᶜ) require summing across paths.
P(B) combines two paths reaching outcome B:
P(B)=P(A∩B)+P(Ac∩B)
This is the law of total probability in action. The tree makes this sum visible—click P(B) to see both contributing paths highlight simultaneously.
Similarly, P(Bᶜ) sums the two paths reaching outcome Bᶜ. The marginal probabilities P(A) + P(Aᶜ) = 1 and P(B) + P(Bᶜ) = 1, as complements must.
Bayes' Theorem in the Tree
DemoReversing the conditional
Step 0 of 4
The Bayes Theorem panel shows P(A|B) and P(Aᶜ|B)—the reverse conditional probabilities. While the sliders set P(B|A) and P(B|Aᶜ), Bayes' theorem calculates the opposite direction.
The formula:
P(A∣B)=P(B)P(B∣A)×P(A)
The tree demonstrates why this works. P(A|B) asks: given we reached outcome B, what fraction came through the A branch? The numerator P(A ∩ B) is one path to B; the denominator P(B) is total probability of B from both paths.
Try this experiment: set P(B|A) = 0.9 and P(B|Aᶜ) = 0.1 with P(A) = 0.5. Then observe P(A|B). The high P(B|A) means most B outcomes came through A, so P(A|B) is high. Adjust the sliders to see how the reverse conditional changes.
Related Tools and Concepts
Tree diagrams connect to several probability concepts and tools on this site: