Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools


Tree Diagram Visualization

Visualize conditional probabilities with events A and B. Click on intersection probabilities to highlight paths.

P(A) = 0.600P(Aᶜ) = 0.400P(B|A) = 0.700P(Bᶜ|A) = 0.300P(B|Aᶜ) = 0.300P(Bᶜ|Aᶜ) = 0.700AP = 0.6000AᶜP = 0.4000A ∩ BP = 0.4200A ∩ BᶜP = 0.1800Aᶜ ∩ BP = 0.1200Aᶜ ∩ BᶜP = 0.2800

Calculated Probabilities

Click on any joint probability to highlight its path through the tree

Joint Probabilities

A ∩ B = P(A) × P(B|A) = 0.4200
A ∩ Bᶜ = P(A) × P(Bᶜ|A) = 0.1800
Aᶜ ∩ B = P(Aᶜ) × P(B|Aᶜ) = 0.1200
Aᶜ ∩ Bᶜ = P(Aᶜ) × P(Bᶜ|Aᶜ) = 0.2800

Marginal Probabilities

P(A) = 0.6000
P(Aᶜ) = 0.4000
P(B) = P(A∩B) + P(Aᶜ∩B) = 0.5400
P(Bᶜ) = 0.4600

Conditional: Given A

P(B|A) = 0.7000
P(Bᶜ|A) = 0.3000

Conditional: Given Aᶜ

P(B|Aᶜ) = 0.3000
P(Bᶜ|Aᶜ) = 0.7000

Bayes Theorem

P(A|B) = P(B|A) × P(A) / P(B) = 0.7778
P(Aᶜ|B) = P(B|Aᶜ) × P(Aᶜ) / P(B) = 0.2222
How to use: Adjust the sliders to change probabilities. Click on any joint probability block to highlight its path through the tree.




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

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.6P(A) = 0.6, P(BA)=0.7P(B \mid A) = 0.7 and P(BAc)=0.3P(B \mid A^c) = 0.3. Every other number on the page is derived from those three.

The four leaves come out as 0.420.42, 0.180.18, 0.120.12 and 0.280.28, and they sum to exactly 11.
P(A) = 0.600P(Aᶜ) = 0.400P(B|A) = 0.700P(Bᶜ|A) = 0.300P(B|Aᶜ) = 0.300P(Bᶜ|Aᶜ) = 0.700AP = 0.6000AᶜP = 0.4000A ∩ BP = 0.4200A ∩ BᶜP = 0.1800Aᶜ ∩ BP = 0.1200Aᶜ ∩ BᶜP = 0.2800
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)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 ABA \cap B path colours the two edges that lead to it and fades the rest. The leaf reads 0.420.42, which is 0.6×0.70.6 \times 0.7 — the edge probabilities multiplied.

That is the multiplication rule P(AB)=P(A)P(BA)P(A \cap B) = P(A) \cdot P(B \mid A), drawn as a route rather than written as an equation.
P(A) = 0.600P(Aᶜ) = 0.400P(B|A) = 0.700P(Bᶜ|A) = 0.300P(B|Aᶜ) = 0.300P(Bᶜ|Aᶜ) = 0.700AP = 0.6000AᶜP = 0.4000A ∩ BP = 0.4200A ∩ BᶜP = 0.1800Aᶜ ∩ BP = 0.1200Aᶜ ∩ BᶜP = 0.2800
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(AB)=0.54×0.7778=0.42P(B) \cdot P(A \mid B) = 0.54 \times 0.7778 = 0.42, which is the tree drawn with BB 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.420.42 is the probability of AA and BB together, not the probability of BB given AA. The conditional is the edge label, 0.70.7; the joint is the leaf.

Two Paths: the Law of Total Probability

Highlighting BB lights up two paths at once, because BB can be reached either through AA or through AcA^c.

Adding those two leaves gives P(B)=0.42+0.12=0.54P(B) = 0.42 + 0.12 = 0.54.
P(A) = 0.600P(Aᶜ) = 0.400P(B|A) = 0.700P(Bᶜ|A) = 0.300P(B|Aᶜ) = 0.300P(Bᶜ|Aᶜ) = 0.700AP = 0.6000AᶜP = 0.4000A ∩ BP = 0.4200A ∩ BᶜP = 0.1800Aᶜ ∩ BP = 0.1200Aᶜ ∩ BᶜP = 0.2800
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(BA)+P(Ac)P(BAc)=0.6(0.7)+0.4(0.3)P(B) = P(A)P(B \mid A) + P(A^c)P(B \mid A^c) = 0.6(0.7) + 0.4(0.3) — the law of total probability. The tree makes the reason obvious: AA and AcA^c partition everything, so every route to BB passes through exactly one of them, and no route is counted twice.

The result is worth sitting with. P(B)=0.54P(B) = 0.54 lies between the two conditionals 0.70.7 and 0.30.3, closer to 0.70.7 because AA 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(AB)=0.420.54=0.7778P(A \mid B) = \frac{0.42}{0.54} = 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 AA picks out the two edges P(BA)=0.7P(B \mid A) = 0.7 and P(BcA)=0.3P(B^c \mid A) = 0.3, and the two leaves 0.420.42 and 0.180.18.

Those two edges sum to 11. Those two leaves sum to 0.60.6, which is P(A)P(A).
P(A) = 0.600P(Aᶜ) = 0.400P(B|A) = 0.700P(Bᶜ|A) = 0.300P(B|Aᶜ) = 0.300P(Bᶜ|Aᶜ) = 0.700AP = 0.6000AᶜP = 0.4000A ∩ BP = 0.4200A ∩ BᶜP = 0.1800Aᶜ ∩ BP = 0.1200Aᶜ ∩ BᶜP = 0.2800
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.60.42 + 0.18 = 0.6, not 11 — the branch under AA does not carry all the probability, only AA's share of it. Conditioning on AA is what rescales 0.420.42 back up to 0.70.7.

Clicking to Highlight Paths

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(AB)=P(A)×P(BA)P(A \cap B) = P(A) \times P(B|A)


P(ABc)=P(A)×P(BcA)P(A \cap B^c) = P(A) \times P(B^c|A)


P(AcB)=P(Ac)×P(BAc)P(A^c \cap B) = P(A^c) \times P(B|A^c)


P(AcBc)=P(Ac)×P(BcAc)P(A^c \cap B^c) = P(A^c) \times P(B^c|A^c)


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(AB)+P(AcB)P(B) = P(A \cap B) + P(A^c \cap 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

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(AB)=P(BA)×P(A)P(B)P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}


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.