Compare a joint distribution with independence
For discrete variables, joint and marginal probabilities must come from the same valid distribution. The calculator uses four nonnegative integer cell counts with a positive total. It returns bits using logarithm base 2. The quantity is neither a correlation direction nor proof of causality.[1]
Understand the calculation
- Normalize one joint count table to p(x,y). Cells are nonnegative and sum to one.
- Sum rows and columns of the same table to obtain p(x) and p(y). Independence would require every cell to equal p(x)p(y).
- Weight each logarithmic ratio p(x,y)/(p(x)p(y)) by p(x,y). Zero cells contribute zero.
- Add the contributions. This is KL between the joint distribution and product marginals; hence I≥0, symmetric and zero exactly under independence.
Mutual information in bits[1]
Entropy reduction and upper bound[1]
Visualize the learning idea
Dependence with the same marginals
Free with a Quanta account. Your download stays ready after registration.
Two fully checked examples
An imperfect association
- Given
- Joint count table for X,Y∈{0,1}: [[3,1],[1,3]], eight observations.
- Find
- Find the joint distribution, marginals and I.
Normalize cells. All row and column totals are 4.
Matching and different values have different logarithmic contributions.
Result: I≈0.188722 bits. The variables are dependent but not deterministically linked.
Check: H(X)=H(Y)=1; H(X,Y)=1+h2(1/4)≈1.8112781245. The entropy identity gives 2−1.8112781245≈0.1887218755.
Perfect association, unequal frequencies
- Given
- Table [[2,0],[0,6]] with N=8.
- Find
- Check whether perfect association automatically means one bit.
Both marginals are (1/4,3/4). Y determines X completely.
Calculate the marginal entropy.
Result: I≈0.811278 bits despite perfect association. Information cannot exceed the unequal marginal entropy.
Check: Directly: (1/4)log24+(3/4)log2(4/3)≈0.8112781245. Zero cells are not evaluated as log(0).
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Interpret the quantities
Shannon entropy measures uncertainty of a distribution. Kullback–Leibler divergence compares two distributions, here the joint table and product marginals. Decision-tree information gain uses this entropy reduction for a particular split question.
Five solved exercises
Calculate · Foundation
Check whether table [[1,2],[2,4]] is independent.
Show hint
N=9; marginals (1/3,2/3).
Learning goal: Recognize independence from the joint model.
Show solution and calculation
Every normalized cell equals its marginal product: 1/9,2/9,2/9,4/9.
Therefore I=0 bits.
Rearrange · Application
H(X)=1,H(Y)=1,H(X,Y)=1.5 bits: find I.
Show hint
Use the entropy identity.
Learning goal: Connect entropy with mutual information.
Show solution and calculation
I=1+1−1.5=0.5 bits.
It is below both marginal entropies.
Interpret · Foundation
X is always 0 while Y varies. What is I(X;Y)?
Show hint
Check uncertainty in X.
Learning goal: Handle constant variables correctly.
Show solution and calculation
H(X)=0, so 0≤I≤H(X)=0 and I=0.
Y cannot reveal additional information about an already constant variable.
Error analysis · Application
A calculation in bits gives I=−0.4. Does this mean negative dependence?
Show hint
Information is a nonnegative KL quantity.
Learning goal: Do not confuse sign with correlation direction.
Show solution and calculation
No.
This indicates inconsistent probabilities, mixed logarithm bases or a calculation error.
Opposite-direction relationships can still have positive mutual information.
Transfer · Challenge
Swap the columns of [[3,1],[1,3]]. Does I change?
Show hint
Only the labels of Y change.
Learning goal: Separate dependence from labels and direction.
Show solution and calculation
No.
A bijective relabelling preserves information.
Table [[1,3],[3,1]] also has I≈0.1887218755 bits.
Check your understanding with the formula’s reference test.
8 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Limits and connections
A sample table describes observed association. Small or selected datasets can differ from the underlying process. I≥0 holds for a consistently calculated discrete distribution, but a positive empirical value alone establishes neither statistical significance nor causation.
Sources for this explanation
Quanta · Updated November 9, 2026
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Expanded the joint two-by-two model, information calculator and entropy checks.
Cite this reference page
Quanta. Mutual information of discrete variables. Updated November 9, 2026. https://quanta-study.de/en/formula-sheet/mutuelle-information-diskret
When citing a specific scientific statement, also cite the specialist source linked to that statement.