数学史

香农与信息的比特

1948 年,香农以《通信的数学理论》开创了信息论。本演示绘制二元熵 H(p),标记当前概率,并把 log2(N) 与识别 N 个等概率结果所需的“是/否”问题数量联系起来。

6 分钟难度 2/3交互演示区域不展示广告。
p0.50H(p)1.000 bitsOutcomes8Entropy log2(N)3 bitsYes/no questions3
0.000.250.500.751.000.000.250.500.751.001.000 bitsH(p) in bitsprobability p of heads

H(p) = −p·log2(p) − (1−p)·log2(1−p) = 1.0000 bits · outcomes H = log2(8) = 3 bits

Equally likely outcomes

8 equally likely outcomes need 3 bits, i.e. 3 yes/no questions at most. Entropy is the minimum average number of questions.

20 questions, one answer

Each yes/no question has at most 2 answers, so 20 questions distinguish at most 2^20 ≈ 1,048,576 items. One million equally likely items carry log2(1,000,000) ≈ 19.93 bits, so 20 questions are enough.

2^20 = 1,048,576log2(1M) ≈ 19.93 bits20 questions suffice
Claude Shannon, “A Mathematical Theory of Communication”, 1948Shannon defined information as the reduction of uncertainty and named the unit the bit. His binary entropy H(p) is maximized at p = 0.5, where a fair coin carries exactly one bit and a biased coin carries less. Today bit is the basic unit of storage and transmission.

A fair coin (p = 0.5) carries one full bit of uncertainty. Push p toward 0 or 1 and the outcome becomes predictable, so H(p) drops toward zero. The outcome buttons show the same idea for many equally likely results: N outcomes carry log2(N) bits, the number of yes/no questions needed to identify one.

你看到的是什么

1

二元熵 H(p) = −p·log2(p) − (1−p)·log2(1−p) 度量正面概率为 p 的硬币的平均不确定性。

2

若有 N 个等概率结果,熵为 log2(N) 比特,等于平均而言找出答案所需的最少“是/否”问题数。

3

比特就是单位:一次公平抛硬币的熵恰好为 1。可预测的结果熵接近于 0。

为什么重要

香农的框架支撑着压缩、纠错、密码学和机器学习。它既解释了数据压缩的极限,也说明了为什么 20 个“是/否”问题就能从一百万个选项中找出一个。

复杂度与细节

计算 H(p) 为 O(1)。对 N 个结果计算 log2(N) 也是 O(1);构建完整决策树则需要 O(N)。

常见问题

为什么 p 为 0 或 1 时熵为零?+

如果结果已确定,观察它不会带来新信息。没有不确定性需要消除,因此获得的信息为零比特。

为什么一百万个选项只需 20 个问题?+

每个“是/否”问题最多把可区分的情况翻倍。k 个问题最多区分 2^k 个选项,而 2^20 略大于一百万。