On this page
Suppose you know whether a classmate revised the probability chapter last night. How much does that tell you about whether they will solve tomorrow's probability question? Mutual information puts a number on that "how much", and the number is measured in bits.
What is mutual information?
Mutual information is how much knowing one variable reduces your uncertainty about another: I(X; Y) = H(X) − H(X | Y) (Wikipedia: Mutual information).
Claude Shannon defined this quantity in 1948 as the rate of actual transmission R = H(x) − H_y(x): the entropy of the source minus the uncertainty that is still left after the signal arrives (Shannon, A Mathematical Theory of Communication, DOI). The name "mutual information" came later, from Robert Fano (Wikipedia).
H(X) is the entropy of X, its average uncertainty in bits (see why a fair coin carries 1 bit of Shannon entropy). H(X | Y) is the uncertainty about X left once you know Y.
In Shannon's own example, a channel sends 1000 equally likely binary symbols per second and 1 in 100 arrives flipped. The leftover uncertainty is 0.081 bits per symbol, so the channel carries 919 bits per second, not the 990 you get by just subtracting errors (Shannon 1948).
How do you calculate mutual information from a 2×2 table?
Let X be whether a student revised (R) or did not (N), and Y be whether they solved the question (S) or failed it (F). Take this joint distribution for one class (the numbers are made up for practice).
P(R, S) = 0.4
P(R, F) = 0.1
P(N, S) = 0.1
P(N, F) = 0.4
Use base-2 logarithms throughout, so every answer comes out in bits.
Marginals: P(R) = 0.4 + 0.1 = 0.5 and P(S) = 0.4 + 0.1 = 0.5, so H(X) = H(Y) = 1 bit, just like a fair coin.
Conditionals: P(S | R) = 0.4 / 0.5 = 0.8 and P(F | R) = 0.2. Given N, they swap: P(S | N) = 0.2 and P(F | N) = 0.8.
Conditional entropy: H(Y | X = R) = −(0.8 log₂ 0.8 + 0.2 log₂ 0.2) = 0.722 bits. H(Y | X = N) is the same, so their weighted average is H(Y | X) = 0.722 bits.
Mutual information: I(X; Y) = H(Y) − H(Y | X) = 1 − 0.722 = 0.278 bits.
Check: the joint entropy is H(X, Y) = −(2 × 0.4 log₂ 0.4 + 2 × 0.1 log₂ 0.1) = 1.722 bits. Using the identity I(X; Y) = H(X) + H(Y) − H(X, Y) (listed on Wikipedia), you get 1 + 1 − 1.722 = 0.278 bits. Same answer.
So finding out whether a student revised removes about 28% of your 1 bit of uncertainty about their result.
What does the entropy Venn diagram show?
Draw H(X) and H(Y) as two overlapping circles, as Wikipedia's article does (Mutual information). The overlap is I(X; Y). The rest of the X circle is H(X | Y), the rest of the Y circle is H(Y | X), and both circles together are the joint entropy H(X, Y). The diagram at the top draws this to scale for our table: each circle is 1 bit, and the overlap is 0.278 bits. Because the overlap belongs to both circles, I(X; Y) = I(Y; X).
Why is mutual information zero for independent variables?
If X and Y are independent, P(Y | X) = P(Y) for every value of X. Then H(Y | X) = H(Y), and the difference is exactly zero. The converse holds too: mutual information is never negative, and it is zero only if the two variables are independent (scikit-learn documentation).
Try it on the table. Set all four entries to 0.25. Now P(S | R) = P(S | N) = 0.5, both conditional entropies are 1 bit, and I(X; Y) = 1 − 1 = 0. The two circles no longer overlap.
How is mutual information used in feature selection?
In machine learning, a feature is an input column (hours slept, mock-test score) and the target is what you want to predict. Ranking features by their mutual information with the target keeps the ones that tell you the most about it. An early paper on this is R. Battiti's 1994 Using mutual information for selecting features in supervised neural net learning, in IEEE Transactions on Neural Networks. Peng, Long and Ding (2005) chose features by mutual information criteria of max-relevance and min-redundancy (IEEE TPAMI paper).
In Python, scikit-learn's mutual_info_classif estimates mutual information for a discrete target with entropy estimates from k-nearest-neighbour distances, and can be used for univariate feature selection (scikit-learn). A simple plan for a project:
Score each feature's mutual information with the target.
Drop features scoring near zero.
Of two strong features that carry the same information, keep one.
Test the smaller set on unseen data.
Where to practise next
Revise the Class 12 probability formulas, including conditional probability, then try a related measure: KL divergence explained with a two-coin example.
If entropy or logarithms still feel shaky, the Fermi Concept Library covers every concept in mathematics and computing, each with its own lesson and its place in the map. To check your working on tables like this one, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



