In probability theory, conditional independence describes situations wherein an observation is irrelevant or redundant when evaluating the certainty of a hypothesis. Conditional independence is usually formulated in terms of conditional probability, as a special case where the probability of the hypothesis given the uninformative observation is equal to the probability without. If ${\displaystyle A}$ is the hypothesis, and ${\displaystyle B}$ and ${\displaystyle C}$ are observations, conditional independence can be stated as an equality:

${\displaystyle P(A\mid B,C)=P(A\mid C)}$

where ${\displaystyle P(A\mid B,C)}$ is the probability of ${\displaystyle A}$ given both ${\displaystyle B}$ and ${\displaystyle C}$. Since the probability of ${\displaystyle A}$ given ${\displaystyle C}$ is the same as the probability of ${\displaystyle A}$ given both ${\displaystyle B}$ and ${\displaystyle C}$, this equality expresses that ${\displaystyle B}$ contributes nothing to the certainty of ${\displaystyle A}$. In this case, ${\displaystyle A}$ and ${\displaystyle B}$ are said to be conditionally independent given ${\displaystyle C}$, written symbolically as: ${\displaystyle (A\perp \!\!\!\perp B\mid C)}$. In the language of causal equality notation, two functions ${\displaystyle f(y)}$ and ${\displaystyle g(y)}$ which both depend on a common variable ${\displaystyle y}$ are described as conditionally independent using the notation ${\displaystyle f\left(y\right)~{\overset {\curvearrowleft \curvearrowright }{=))~g\left(y\right)}$, which is equivalent to the notation ${\displaystyle P(f\mid g,y)=P(f\mid y)}$.

The concept of conditional independence is essential to graph-based theories of statistical inference, as it establishes a mathematical relation between a collection of conditional statements and a graphoid.

## Conditional independence of events

Let ${\displaystyle A}$, ${\displaystyle B}$, and ${\displaystyle C}$ be events. ${\displaystyle A}$ and ${\displaystyle B}$ are said to be conditionally independent given ${\displaystyle C}$ if and only if ${\displaystyle P(C)>0}$ and:

${\displaystyle P(A\mid B,C)=P(A\mid C)}$

This property is often written: ${\displaystyle (A\perp \!\!\!\perp B\mid C)}$, which should be read ${\displaystyle ((A\perp \!\!\!\perp B)\vert C)}$.

Equivalently, conditional independence may be stated as:

${\displaystyle P(A,B|C)=P(A|C)P(B|C)}$

where ${\displaystyle P(A,B|C)}$ is the joint probability of ${\displaystyle A}$ and ${\displaystyle B}$ given ${\displaystyle C}$. This alternate formulation states that ${\displaystyle A}$ and ${\displaystyle B}$ are independent events, given ${\displaystyle C}$.

It demonstrates that ${\displaystyle (A\perp \!\!\!\perp B\mid C)}$ is equivalent to ${\displaystyle (B\perp \!\!\!\perp A\mid C)}$.

### Proof of the equivalent definition

${\displaystyle P(A,B\mid C)=P(A\mid C)P(B\mid C)}$
iff ${\displaystyle {\frac {P(A,B,C)}{P(C)))=\left({\frac {P(A,C)}{P(C)))\right)\left({\frac {P(B,C)}{P(C)))\right)}$      (definition of conditional probability)
iff ${\displaystyle P(A,B,C)={\frac {P(A,C)P(B,C)}{P(C)))}$       (multiply both sides by ${\displaystyle P(C)}$)
iff ${\displaystyle {\frac {P(A,B,C)}{P(B,C)))={\frac {P(A,C)}{P(C)))}$       (divide both sides by ${\displaystyle P(B,C)}$)
iff ${\displaystyle P(A\mid B,C)=P(A\mid C)}$       (definition of conditional probability) ${\displaystyle \therefore }$

### Examples

#### Coloured boxes

Each cell represents a possible outcome. The events ${\displaystyle \color {red}R}$, ${\displaystyle \color {blue}B}$ and ${\displaystyle \color {gold}Y}$ are represented by the areas shaded red, blue and yellow respectively. The overlap between the events ${\displaystyle \color {red}R}$ and ${\displaystyle \color {blue}B}$ is shaded purple.

The probabilities of these events are shaded areas with respect to the total area. In both examples ${\displaystyle \color {red}R}$ and ${\displaystyle \color {blue}B}$ are conditionally independent given ${\displaystyle \color {gold}Y}$ because:

${\displaystyle \Pr({\color {red}R},{\color {blue}B}\mid {\color {gold}Y})=\Pr({\color {red}R}\mid {\color {gold}Y})\Pr({\color {blue}B}\mid {\color {gold}Y})}$[1]

but not conditionally independent given ${\displaystyle \left[{\text{not )){\color {gold}Y}\right]}$ because:

${\displaystyle \Pr({\color {red}R},{\color {blue}B}\mid {\text{not )){\color {gold}Y})\not =\Pr({\color {red}R}\mid {\text{not )){\color {gold}Y})\Pr({\color {blue}B}\mid {\text{not )){\color {gold}Y})}$

#### Proximity and delays

Let events A and B be defined as the probability that person A and person B will be home in time for dinner where both people are randomly sampled from the entire world. Events A and B can be assumed to be independent i.e. knowledge that A is late has minimal to no change on the probability that B will be late. However, if a third event is introduced, person A and person B live in the same neighborhood, the two events are now considered not conditionally independent. Traffic conditions and weather-related events that might delay person A, might delay person B as well. Given the third event and knowledge that person A was late, the probability that person B will be late does meaningfully change.[2]

#### Dice rolling

Conditional independence depends on the nature of the third event. If you roll two dice, one may assume that the two dice behave independently of each other. Looking at the results of one dice will not tell you about the result of the second dice. (That is, the two dice are independent.) If, however, the 1st dice's result is a 3, and someone tells you about a third event - that the sum of the two results is even - then this extra unit of information restricts the options for the 2nd result to an odd number. In other words, two events can be independent, but NOT conditionally independent.[2]

#### Height and vocabulary

Height and vocabulary are dependent since very small people tend to be children, known for their more basic vocabularies. But knowing that two people are 19 years old (i.e., conditional on age) there is no reason to think that one person's vocabulary is larger if we are told that they are taller.

## Conditional independence of random variables

Two discrete random variables ${\displaystyle X}$ and ${\displaystyle Y}$ are conditionally independent given a third discrete random variable ${\displaystyle Z}$ if and only if they are independent in their conditional probability distribution given ${\displaystyle Z}$. That is, ${\displaystyle X}$ and ${\displaystyle Y}$ are conditionally independent given ${\displaystyle Z}$ if and only if, given any value of ${\displaystyle Z}$, the probability distribution of ${\displaystyle X}$ is the same for all values of ${\displaystyle Y}$ and the probability distribution of ${\displaystyle Y}$ is the same for all values of ${\displaystyle X}$. Formally:

 ${\displaystyle (X\perp \!\!\!\perp Y)\mid Z\quad \iff \quad F_{X,Y\,\mid \,Z\,=\,z}(x,y)=F_{X\,\mid \,Z\,=\,z}(x)\cdot F_{Y\,\mid \,Z\,=\,z}(y)\quad {\text{for all ))x,y,z}$ (Eq.2)

where ${\displaystyle F_{X,Y\,\mid \,Z\,=\,z}(x,y)=\Pr(X\leq x,Y\leq y\mid Z=z)}$ is the conditional cumulative distribution function of ${\displaystyle X}$ and ${\displaystyle Y}$ given ${\displaystyle Z}$.

Two events ${\displaystyle R}$ and ${\displaystyle B}$ are conditionally independent given a σ-algebra ${\displaystyle \Sigma }$ if

${\displaystyle \Pr(R,B\mid \Sigma )=\Pr(R\mid \Sigma )\Pr(B\mid \Sigma ){\text{ a.s.))}$

where ${\displaystyle \Pr(A\mid \Sigma )}$ denotes the conditional expectation of the indicator function of the event ${\displaystyle A}$, ${\displaystyle \chi _{A))$, given the sigma algebra ${\displaystyle \Sigma }$. That is,

${\displaystyle \Pr(A\mid \Sigma ):=\operatorname {E} [\chi _{A}\mid \Sigma ].}$

Two random variables ${\displaystyle X}$ and ${\displaystyle Y}$ are conditionally independent given a σ-algebra ${\displaystyle \Sigma }$ if the above equation holds for all ${\displaystyle R}$ in ${\displaystyle \sigma (X)}$ and ${\displaystyle B}$ in ${\displaystyle \sigma (Y)}$.

Two random variables ${\displaystyle X}$ and ${\displaystyle Y}$ are conditionally independent given a random variable ${\displaystyle W}$ if they are independent given σ(W): the σ-algebra generated by ${\displaystyle W}$. This is commonly written:

${\displaystyle X\perp \!\!\!\perp Y\mid W}$ or
${\displaystyle X\perp Y\mid W}$

This it read "${\displaystyle X}$ is independent of ${\displaystyle Y}$, given ${\displaystyle W}$"; the conditioning applies to the whole statement: "(${\displaystyle X}$ is independent of ${\displaystyle Y}$) given ${\displaystyle W}$".

${\displaystyle (X\perp \!\!\!\perp Y)\mid W}$

This notation extends ${\displaystyle X\perp \!\!\!\perp Y}$ for "${\displaystyle X}$ is independent of ${\displaystyle Y}$."

If ${\displaystyle W}$ assumes a countable set of values, this is equivalent to the conditional independence of X and Y for the events of the form ${\displaystyle [W=w]}$. Conditional independence of more than two events, or of more than two random variables, is defined analogously.

The following two examples show that ${\displaystyle X\perp \!\!\!\perp Y}$ neither implies nor is implied by ${\displaystyle (X\perp \!\!\!\perp Y)\mid W}$.

First, suppose ${\displaystyle W}$ is 0 with probability 0.5 and 1 otherwise. When W = 0 take ${\displaystyle X}$ and ${\displaystyle Y}$ to be independent, each having the value 0 with probability 0.99 and the value 1 otherwise. When ${\displaystyle W=1}$, ${\displaystyle X}$ and ${\displaystyle Y}$ are again independent, but this time they take the value 1 with probability 0.99. Then ${\displaystyle (X\perp \!\!\!\perp Y)\mid W}$. But ${\displaystyle X}$ and ${\displaystyle Y}$ are dependent, because Pr(X = 0) < Pr(X = 0|Y = 0). This is because Pr(X = 0) = 0.5, but if Y = 0 then it's very likely that W = 0 and thus that X = 0 as well, so Pr(X = 0|Y = 0) > 0.5.

For the second example, suppose ${\displaystyle X\perp \!\!\!\perp Y}$, each taking the values 0 and 1 with probability 0.5. Let ${\displaystyle W}$ be the product ${\displaystyle X\cdot Y}$. Then when ${\displaystyle W=0}$, Pr(X = 0) = 2/3, but Pr(X = 0|Y = 0) = 1/2, so ${\displaystyle (X\perp \!\!\!\perp Y)\mid W}$ is false. This is also an example of Explaining Away. See Kevin Murphy's tutorial [3] where ${\displaystyle X}$ and ${\displaystyle Y}$ take the values "brainy" and "sporty".

## Conditional independence of random vectors

Two random vectors ${\displaystyle \mathbf {X} =(X_{1},\ldots ,X_{l})^{\mathrm {T} ))$ and ${\displaystyle \mathbf {Y} =(Y_{1},\ldots ,Y_{m})^{\mathrm {T} ))$ are conditionally independent given a third random vector ${\displaystyle \mathbf {Z} =(Z_{1},\ldots ,Z_{n})^{\mathrm {T} ))$ if and only if they are independent in their conditional cumulative distribution given ${\displaystyle \mathbf {Z} }$. Formally:

 ${\displaystyle (\mathbf {X} \perp \!\!\!\perp \mathbf {Y} )\mid \mathbf {Z} \quad \iff \quad F_{\mathbf {X} ,\mathbf {Y} |\mathbf {Z} =\mathbf {z} }(\mathbf {x} ,\mathbf {y} )=F_{\mathbf {X} \,\mid \,\mathbf {Z} \,=\,\mathbf {z} }(\mathbf {x} )\cdot F_{\mathbf {Y} \,\mid \,\mathbf {Z} \,=\,\mathbf {z} }(\mathbf {y} )\quad {\text{for all ))\mathbf {x} ,\mathbf {y} ,\mathbf {z} }$ (Eq.3)

where ${\displaystyle \mathbf {x} =(x_{1},\ldots ,x_{l})^{\mathrm {T} ))$, ${\displaystyle \mathbf {y} =(y_{1},\ldots ,y_{m})^{\mathrm {T} ))$ and ${\displaystyle \mathbf {z} =(z_{1},\ldots ,z_{n})^{\mathrm {T} ))$ and the conditional cumulative distributions are defined as follows.

{\displaystyle {\begin{aligned}F_{\mathbf {X} ,\mathbf {Y} \,\mid \,\mathbf {Z} \,=\,\mathbf {z} }(\mathbf {x} ,\mathbf {y} )&=\Pr(X_{1}\leq x_{1},\ldots ,X_{l}\leq x_{l},Y_{1}\leq y_{1},\ldots ,Y_{m}\leq y_{m}\mid Z_{1}=z_{1},\ldots ,Z_{n}=z_{n})\\[6pt]F_{\mathbf {X} \,\mid \,\mathbf {Z} \,=\,\mathbf {z} }(\mathbf {x} )&=\Pr(X_{1}\leq x_{1},\ldots ,X_{l}\leq x_{l}\mid Z_{1}=z_{1},\ldots ,Z_{n}=z_{n})\\[6pt]F_{\mathbf {Y} \,\mid \,\mathbf {Z} \,=\,\mathbf {z} }(\mathbf {y} )&=\Pr(Y_{1}\leq y_{1},\ldots ,Y_{m}\leq y_{m}\mid Z_{1}=z_{1},\ldots ,Z_{n}=z_{n})\end{aligned))}

## Uses in Bayesian inference

Let p be the proportion of voters who will vote "yes" in an upcoming referendum. In taking an opinion poll, one chooses n voters randomly from the population. For i = 1, ..., n, let Xi = 1 or 0 corresponding, respectively, to whether or not the ith chosen voter will or will not vote "yes".

In a frequentist approach to statistical inference one would not attribute any probability distribution to p (unless the probabilities could be somehow interpreted as relative frequencies of occurrence of some event or as proportions of some population) and one would say that X1, ..., Xn are independent random variables.

By contrast, in a Bayesian approach to statistical inference, one would assign a probability distribution to p regardless of the non-existence of any such "frequency" interpretation, and one would construe the probabilities as degrees of belief that p is in any interval to which a probability is assigned. In that model, the random variables X1, ..., Xn are not independent, but they are conditionally independent given the value of p. In particular, if a large number of the Xs are observed to be equal to 1, that would imply a high conditional probability, given that observation, that p is near 1, and thus a high conditional probability, given that observation, that the next X to be observed will be equal to 1.

## Rules of conditional independence

A set of rules governing statements of conditional independence have been derived from the basic definition.[4][5]

These rules were termed "Graphoid Axioms" by Pearl and Paz,[6] because they hold in graphs, where ${\displaystyle X\perp \!\!\!\perp A\mid B}$ is interpreted to mean: "All paths from X to A are intercepted by the set B".[7]

### Symmetry

${\displaystyle X\perp \!\!\!\perp Y\quad \Rightarrow \quad Y\perp \!\!\!\perp X}$

Proof:

Note that we are required to prove if ${\displaystyle P(X|Y)=P(X)}$ then ${\displaystyle P(Y|X)=P(Y)}$. Note that if ${\displaystyle P(X|Y)=P(X)}$ then it can be shown ${\displaystyle P(X,Y)=P(X)P(Y)}$. Therefore ${\displaystyle P(Y|X)=P(X,Y)/P(X)=P(X)P(Y)/P(X)=P(Y)}$ as required.

### Decomposition

${\displaystyle X\perp \!\!\!\perp A,B\quad \Rightarrow \quad {\text{ and )){\begin{cases}X\perp \!\!\!\perp A\\X\perp \!\!\!\perp B\end{cases))}$

Proof

• ${\displaystyle p_{X,A,B}(x,a,b)=p_{X}(x)p_{A,B}(a,b)}$      (meaning of ${\displaystyle X\perp \!\!\!\perp A,B}$)
• ${\displaystyle \int _{B}p_{X,A,B}(x,a,b)\,db=\int _{B}p_{X}(x)p_{A,B}(a,b)\,db}$      (ignore variable B by integrating it out)
• ${\displaystyle p_{X,A}(x,a)=p_{X}(x)p_{A}(a)}$

A similar proof shows the independence of X and B.

### Weak union

${\displaystyle X\perp \!\!\!\perp A,B\quad \Rightarrow \quad {\text{ and )){\begin{cases}X\perp \!\!\!\perp A\mid B\\X\perp \!\!\!\perp B\mid A\end{cases))}$

Proof

• By assumption, ${\displaystyle \Pr(X)=\Pr(X\mid A,B)}$.
• Due to the property of decomposition ${\displaystyle X\perp \!\!\!\perp B}$, ${\displaystyle \Pr(X)=\Pr(X\mid B)}$.
• Combining the above two equalities gives ${\displaystyle \Pr(X\mid B)=\Pr(X\mid A,B)}$, which establishes ${\displaystyle X\perp \!\!\!\perp A\mid B}$.

The second condition can be proved similarly.

### Contraction

{\displaystyle \left.{\begin{aligned}X\perp \!\!\!\perp A\mid B\\X\perp \!\!\!\perp B\end{aligned))\right\}{\text{ and ))\quad \Rightarrow \quad X\perp \!\!\!\perp A,B}

Proof

This property can be proved by noticing ${\displaystyle \Pr(X\mid A,B)=\Pr(X\mid B)=\Pr(X)}$, each equality of which is asserted by ${\displaystyle X\perp \!\!\!\perp A\mid B}$ and ${\displaystyle X\perp \!\!\!\perp B}$, respectively.

### Intersection

For strictly positive probability distributions,[5] the following also holds:

{\displaystyle \left.{\begin{aligned}X\perp \!\!\!\perp Y\mid Z,W\\X\perp \!\!\!\perp W\mid Z,Y\end{aligned))\right\}{\text{ and ))\quad \Rightarrow \quad X\perp \!\!\!\perp W,Y\mid Z}

Proof

By assumption:

${\displaystyle P(X|Z,W,Y)=P(X|Z,W)\land P(X|Z,W,Y)=P(X|Z,Y)\implies P(X|Z,Y)=P(X|Z,W)}$

Using this equality, together with the Law of total probability applied to ${\displaystyle P(X|Z)}$:

{\displaystyle {\begin{aligned}P(X|Z)&=\sum _{w\in W}P(X|Z,W=w)P(W=w|Z)\\[4pt]&=\sum _{w\in W}P(X|Y,Z)P(W=w|Z)\\[4pt]&=P(X|Z,Y)\sum _{w\in W}P(W=w|Z)\\[4pt]&=P(X|Z,Y)\end{aligned))}

Since ${\displaystyle P(X|Z,W,Y)=P(X|Z,Y)}$ and ${\displaystyle P(X|Z,Y)=P(X|Z)}$, it follows that ${\displaystyle P(X|Z,W,Y)=P(X|Z)\iff X\perp \!\!\!\perp Y,W|Z}$.

Technical note: since these implications hold for any probability space, they will still hold if one considers a sub-universe by conditioning everything on another variable, say K. For example, ${\displaystyle X\perp \!\!\!\perp Y\Rightarrow Y\perp \!\!\!\perp X}$ would also mean that ${\displaystyle X\perp \!\!\!\perp Y\mid K\Rightarrow Y\perp \!\!\!\perp X\mid K}$.