Conditional Independence

When two linked things stop being linked once you know a third.

🟡 intermediate4 min readprobability
Two things are conditionally independent if, once you know a third thing, learning one tells you nothing more about the other. Ice cream sales and drownings both rise in summer, so they look linked. But once you know the temperature, ice cream sales tell you nothing extra about drownings. This matters because it lets models break a huge, tangled probability problem into small separate pieces. Naive Bayes relies on it heavily, and so do Bayesian networks and causal reasoning.

Core Definition & Factorization

Two variables XX and YY are conditionally independent given ZZ (written X⊥Y∣ZX \perp Y \mid Z) if and only if:

P(X,Y∣Z)=P(X∣Z)P(Y∣Z)P(X, Y \mid Z) = P(X \mid Z) P(Y \mid Z)

Equivalently:

P(X∣Y,Z)=P(X∣Z)andP(Y∣X,Z)=P(Y∣Z)P(X \mid Y, Z) = P(X \mid Z) \quad \text{and} \quad P(Y \mid X, Z) = P(Y \mid Z)

Knowing YY gives zero extra information about XX when ZZ is already observed.

   Spurious Association (X <---> Y)        Conditioning on Z Breaks the Link!
              [ Z ]                                      [ Z ] (Observed)
             /     \                                    /     \
            ▼       ▼                                  ▼       ▼
          [ X ]   [ Y ]                              [ X ] ┴ [ Y ] (X ⊥ Y | Z)

Independence vs Conditional Independence

Classic Example: Common Cause (Fork)

XX and YY are correlated marginally (P(X,Y)≠P(X)P(Y)P(X, Y) \neq P(X)P(Y)). But conditioned on location setting ZZ, X⊥Y∣ZX \perp Y \mid Z.

Applications in Machine Learning

  1. Naive Bayes Classifier: Assumes all features X1,…,XdX_1, \dots, X_d are conditionally independent given class label YY:
P(X1,…,Xd∣Y)=∏i=1dP(Xi∣Y)P(X_1, \dots, X_d \mid Y) = \prod_{i=1}^d P(X_i \mid Y)

Converts exponential O(Kd)O(K^d) parameter space into linear O(d⋅K)O(d \cdot K) space!

  1. Bayesian Networks & Markov Blankets: A node XX in a Directed Acyclic Graph (DAG) is conditionally independent of all non-descendants given its parents.
  2. Causal Inference (d-separation): Blocking confounders ZZ isolates true causal effects X→YX \to Y.

Say this out loud

"Conditional independence X ⊥ Y | Z means P(X,Y|Z) = P(X|Z)P(Y|Z). Once Z is known, Y provides zero additional information about X. Spurious correlations between features often disappear when conditioning on a common cause Z. Naive Bayes relies on conditional independence of features given class Y to factorize high-dimensional joint likelihoods into simple 1D probability multiplications."

Follow-ups to expect

Check yourself

Question 1 of 3

What is the formal probability condition for X and Y to be conditionally independent given Z?

More in Math & Statistics

See all →
Bayes’ Theorem4 minCentral Limit Theorem4 minLaw of Large Numbers4 min