Chain rule (probability)
In probability theory, the chain rule (also called the general product rule) permits the calculation of any member of the joint distribution of a set of random variables using only conditional probabilities. The rule is useful in the study of Bayesian networks, which describe a probability distribution in terms of conditional probabilities. Chain rule for events. Two events. The chain rule for two random events formula_1 and formula_2 says Example. This rule is illustrated in the following example. Urn 1 has 1 black ball and 2 white balls and Urn 2 has 1 black ball and 3  white balls. Suppose we pick an urn at random and then select a ball from that urn. Let event formula_1 be choosing the first urn: formula_5. Let event formula_2 be the chance we choose a white ball. The chance of choosing a white ball, given that we have chosen the first urn, is formula_7. Event formula_8 would be their intersection: choosing the first urn and a white ball from it. The probability can be found by the chain rule for probability: More than two events. For more than two events formula_10 the chain rule extends to the formula which by  induction may be turned into Example. With four events (formula_13), the chain rule is Chain rule for random variables. Two random variables. For two random variables formula_15, to find the joint distribution, we can apply the definition of conditional probability to obtain: More than two random variables. Consider an indexed collection of random variables formula_17. To find the value of this member of the joint distribution, we can apply the definition of conditional probability to obtain: Repeating this process with each final term creates the product: Example. With four variables (formula_13), the chain rule produces this product of conditional probabilities