Pearson correlation only measures linear association between two variables — it can be exactly zero even when the variables are completely, deterministically dependent on each other (think of points on a circle, or y = x²). Mutual information, borrowed from information theory, measures how much knowing one variable reduces your uncertainty about the other, regardless of the shape of the relationship. This scene renders the joint distribution of two variables as a live 3D density surface and point cloud so you can watch both metrics respond as the relationship changes shape.
p(x,y) and marginals p(x), p(y).I(X;Y) = Σ p(x,y) · log₂( p(x,y) / (p(x)·p(y)) ) — the bar heights on the grid are literally proportional to p(x,y).For the circular relationship, Pearson correlation stays near zero at every noise level because a circle has no consistent linear trend — yet mutual information stays high, because knowing x still narrows y down to (usually) two possible values. This is exactly the kind of dependency correlation is blind to.
A live 3D joint-distribution plot: reshape how two variables relate — linear, curved, circular or independent — and watch Pearson correlation and mutual information respond very differently to the same data.
Correlation only detects straight-line trends and can sit at zero for strongly dependent variables (a quadratic curve, a ring). Mutual information, computed from the binned joint distribution, stays high in exactly those cases because it captures any reduction in uncertainty, not just a linear one.
Pick a relationship shape, dial in noise and sample size, and compare the live r and mutual-information readouts. Hit "Shuffle Y" to destroy the dependency while keeping both marginal distributions identical — mutual information collapses even though nothing about either variable alone has changed.
Mutual information is zero if and only if two variables are truly statistically independent — unlike correlation, which can be zero for variables that are perfectly (but nonlinearly) related.