One idea, 4 fields

Entropy

The unifying principle

Start with a probability distribution pip_i over possible states ii. Define the Shannon entropy:

H(p)=ipilogpiH(p) = -\sum_i p_i \log p_i

This single formula is the bridge. It is maximized when pip_i is uniform (all states equally likely → maximal ignorance) and zero when one state has pi=1p_i = 1 (certainty).

If all WW microstates are equally likely, pi=1/Wp_i = 1/W, and it collapses to:

H=i=1W1Wlog1W=logWH = -\sum_{i=1}^{W} \frac{1}{W}\log\frac{1}{W} = \log W

This is Boltzmann's formula (with a unit constant). So thermodynamic entropy is just the uniform-distribution special case of information entropy. The choice of logarithm base sets the units:

  • base 2 → bits (information)
  • base eenats (statistics/ML)
  • multiply by Boltzmann's kBk_BJ/K (thermodynamics)

Everything below is this one expression wearing different clothes.

How it shows up in each field

Physics (Thermodynamics & Statistical Mechanics)

Form: S=kBlnWS = k_B \ln W (Boltzmann), or S=kBipilnpiS = -k_B \sum_i p_i \ln p_i (Gibbs). Why it's the same idea: WW is the number of microstates consistent with the macrostate — literally "the number of arrangements you can't distinguish." The Second Law (ΔS0\Delta S \geq 0) says isolated systems drift toward the macrostate with the most microstates, i.e. maximal ignorance. Example: Free expansion of an ideal gas into double the volume. Each molecule now has twice the accessible positions, so WW2NW \to W \cdot 2^N and ΔS=kBln(2N)=NkBln2\Delta S = k_B \ln(2^N) = N k_B \ln 2. For one mole, ΔS=Rln25.76 J/K\Delta S = R\ln 2 \approx 5.76\ \text{J/K}.

Chemistry (Reaction spontaneity)

Form: Gibbs free energy ΔG=ΔHTΔS\Delta G = \Delta H - T\Delta S. A reaction is spontaneous when ΔG<0\Delta G < 0. Why it's the same idea: ΔS\Delta S counts how the number of accessible molecular arrangements (translational, rotational, vibrational modes) changes across the reaction. Dissolving, melting, or producing more gas moles raises WW and thus SS. Example: NH4NO3(s)NH4+(aq)+NO3(aq)\text{NH}_4\text{NO}_3(s) \to \text{NH}_4^+(aq) + \text{NO}_3^-(aq). This dissolution is endothermic (ΔH>0\Delta H > 0, the pack gets cold) yet spontaneous — because the ordered crystal disperses into many mobile solvated arrangements, so ΔS>0\Delta S > 0 and TΔST\Delta S wins.

AI / Machine Learning (Cross-entropy loss)

Form: For true distribution pp (one-hot labels) and model prediction qq: H(p,q)=ipilogqiH(p, q) = -\sum_i p_i \log q_i Related: KL divergence DKL(pq)=H(p,q)H(p)D_{KL}(p\|q) = H(p,q) - H(p) measures how far qq is from pp. Why it's the same idea: Cross-entropy is the average surprise of the true labels under the model's beliefs. Minimizing it makes the model less surprised by reality. Since H(p,q)H(p)H(p,q) \geq H(p) with equality iff q=pq = p, the loss floor is the data's intrinsic entropy. Example: A classifier predicts q=[0.7,0.2,0.1]q = [0.7, 0.2, 0.1] but the truth is class 1 (p=[1,0,0]p = [1,0,0]). Loss =log0.70.357= -\log 0.7 \approx 0.357 nats. If it had predicted 0.990.99, loss 0.01\approx 0.01 — near-zero surprise.

Coding / CS (Data compression)

Form: Shannon's source coding theorem: the minimum average bits per symbol is H(p)H(p) (in base 2). Why it's the same idea: You can't compress below the entropy — it's the irreducible information content. Frequent symbols get short codes; rare (surprising) symbols get long ones, matching logpi-\log p_i bits per symbol. Example: Text where 'e' appears with p=0.5p=0.5, others rare. Huffman/arithmetic coding assigns 'e' ~1 bit and rare letters many bits. A source with H=2.1H = 2.1 bits/char cannot be losslessly stored below 2.1 bits/char on average — that's the entropy wall.

Why this bridge matters

What transfers:

  • Physics → ML: The maximum entropy principle — "assume the least, be maximally uncertain given constraints" — derives the Boltzmann/softmax distribution pieEi/Tp_i \propto e^{-E_i/T}. This is literally the softmax in neural nets, with logits as negative energies and a temperature TT that flattens or sharpens predictions.
  • Information theory → Chemistry: Seeing SS as "missing information" demystifies why endothermic reactions can be spontaneous: nature maximizes accessible arrangements, not minimizes energy.
  • ML → CS: Cross-entropy loss and compression are dual — a good language model is a good compressor (this is the basis of the "compression = intelligence" viewpoint; e.g. arithmetic coding driven by an LLM).

The unlocking intuition: Once you see that "disorder" (physics), "product dispersal" (chemistry), "model surprise" (ML), and "irreducible bits" (CS) are all pilogpi-\sum p_i \log p_i, temperature, softmax, spontaneity, and compression limits stop being separate facts. They're one theorem in four costumes.

Connections

#bridge

uniform microstates

molecular arrangements

average surprise

min bits/symbol

maxent → softmax

model = compressor

disorder → dispersal

Entropy
H = −Σ pᵢ log pᵢ

Physics
S = k_B ln W

Chemistry
ΔG = ΔH − TΔS

AI/ML
H(p,q) cross-entropy

Coding/CS
compression limit = H

Connected notes