🔢 数理与计算科学 · 数学科普 · 系列之二

钟形曲线从哪里来?——正态分布与中心极限定理

猜数的「阶梯」长不成钟;那身高、成绩的「钟」是怎么长出来的?
Where Does the Bell Curve Come From? — The Normal Distribution & the Central Limit Theorem

1 · 热身小游戏:掷两颗骰子,把点数加起来

EN: Warm-up game — roll TWO dice and add the numbers

上一篇我们看到,猜数次数是一串往右堆的阶梯,不是钟形。在讨论钟形之前,先来一局热身——规则很简单:同时掷两颗骰子,把两个点数加起来,看看总和是多少。

EN: Warm-up: roll TWO dice and ADD the two numbers. What do you get? (The “adding” will matter a lot!)

?
+
?
=
总和
Sum
–
已掷 0 次 · Rolls: 0
23456789101112
👆 每次掷完,总和会记到上面的柱子上——多掷几次,看看哪根柱子长得最高!EN: Every roll is recorded on the bars above — roll a few times and watch which bar grows tallest!
🤔 为什么中间会变多?总和的每种值来自不同的组合:7 可以有 1+6、2+5、3+4、4+3、5+2、6+1 共 6 种掷法;而 2 和 12 只有 1+1、6+6 这 1 种。两颗骰子一相加,「中间多、两边少」就开始了——如果继续加更多骰子呢?第 4 节揭晓 🎩

EN: Why is the middle most likely? Sum 7 has 6 ways (1+6 … 6+1), but 2 and 12 have only 1 way each. Adding dice already creates “more middle, fewer edges”.

📖 上一篇回顾:《七次找到你——0~100 猜数游戏与离散分布》EN: Part 1 — the guessing game and its discrete, right-skewed staircase distribution.

2 · 正态分布长什么样?

EN: What does the normal distribution look like?

先亮出本文的主角:正态分布(Normal / Gaussian Distribution),也叫「高斯分布」——生活中那些「中间多、两边少、左右对称」的钟,都是它。先看它的样子:

EN: Meet the star of this article: the normal (Gaussian) distribution — the bell shape behind “many in the middle, few at the edges, symmetric left-right”. Here is what it looks like:

68.3% 95.4% 95.4% 99.7% 99.7% 均值 μ(正中间) +1σ +2σ +3σ −3σ −2σ −1σ

正态分布有三个一眼能认出的特征:

特征说明
🔔 钟形中间最高,向左右平滑下降,像一口钟
🪞 左右对称以均值 μ 为轴,两边互为镜像;均值 = 中位数 = 众数
📏 68-95-99.7约 68% 的数据落在 μ±1σ,95% 在 μ±2σ,99.7% 在 μ±3σ

EN: Bell-shaped, symmetric around the mean μ; about 68% / 95% / 99.7% of data falls within 1 / 2 / 3 standard deviations σ.

3 · 钟形从哪里来?——加法(中心极限定理)

EN: Where do bells come from? — Addition and the Central Limit Theorem
🎯 中心极限定理 Central Limit Theorem (CLT)
大量相互独立、大小差不多的随机小因素相加,总和就趋近正态分布。
EN: When many independent, roughly equal small random effects are ADDED together, their sum tends toward a Gaussian (normal) distribution.

这句定理为什么成立?用身高来感觉一下:

EN: Why does this theorem hold? Feel it with height:

  1. 一个人的身高,由几十上百个基因、营养、睡眠、运动、疾病共同决定——每一项都是独立的小因素;
  2. 有的人运气好,多个有利因素叠加 → 长得很高;有的人运气差,多个不利因素叠加 → 比较矮;
  3. 大多数人好坏互相抵消,落在中间附近。

EN: ① many lucky “good” factors stack up → very tall; ② many unlucky ones → short; ③ for most people the good and bad cancel out → right in the middle.

⚠️ 重点:正态分布大多不是「某个算法算出来的」,而是很多独立微小随机因素叠加在一起,自然涌现出来的——这就是中心极限定理。记住三个关键词:独立、微小、相加。少一个都不行。

EN: Normality is rarely “produced by one algorithm” — it EMERGES from summing many small independent random effects. Keywords: independent, small, additive.

4 · 亲手看钟形「长出来」:骰子实验

EN: Watch the bell grow — the dice experiment

中心极限定理最好的玩具就是掷骰子:每颗骰子都是独立的随机变量(1~6 均匀分布),把它们加起来。下面 4 张图是程序各模拟 30000 次的结果(静态图,不占算力):

EN: The best toy for the CLT is dice: each die is an independent uniform random variable — now ADD them. The 4 charts below each show 30,000 simulated rolls (static pictures, no live computing).

🎲 1 颗骰子

均匀 · Uniform
每个点数机会一样 → 平的一条

🎲🎲 2 颗骰子

三角形 · Triangular
中间开始变高,还是尖的三角

🎲🎲🎲🎲🎲 5 颗骰子

钟形萌芽 · Bell-ish
肉眼已经接近钟形了

🎲🎲🎲🎲🎲🎲🎲🎲🎲🎲 10 颗骰子

漂亮钟形 · Beautiful bell
平滑对称的钟!总和集中在 35 附近(均值 3.5×10)
🔍 看出了什么?骰子越多,直方图越像钟:1 颗是均匀的平线,2 颗变三角,5 颗开始圆润,10 颗已经是平滑对称的钟形。加法的次数越多,越接近正态——这就是中心极限定理在你眼前显形。🎩

EN: Roll 1 die: flat uniform. Add more dice: 2 → triangle, 5 → rounding, 10 → a smooth bell around 35. More terms added → closer to normal. That's the CLT in action.

5 · 生活中的钟:三个经典例子

EN: Three classic bells in real life

🧍 例 1 · 成年人身高

同年龄、同性别人群的身高。影响因素:几十上百个基因、营养、睡眠、运动、疾病——每一项都是独立小因素,叠加成总身高。少数人叠满好牌 → 很高;少数人叠满差牌 → 很矮;大多数人好坏抵消 → 中等。直方图就是钟形。

EN: Height = hundreds of small independent factors (genes, nutrition, sleep, exercise…). Most people land near the average — a bell curve.

📝 例 2 · 大规模标准化考试分数

几千人考同一份卷子。成绩受审题、记忆、熟练度、临场状态、运气……一堆独立小因素影响。大部分人中等,极少数高分、极少数低分。

⚠️ 注意:如果题目太简单、人人高分,分布就变成偏态,不再是钟形。只有难度适中,才近似正态。

EN: Exam scores for thousands of students — many small factors; most score mid-range. Too easy a test → skewed, not bell-shaped.

🔩 例 3 · 工厂零件尺寸误差

机器加工标称 10mm 的螺丝。误差来源:电压波动、刀具微小磨损、振动、温度变化、原料细微差异——每个都是小扰动,加起来的总误差服从正态。工业界的 6σ 质量管理就建立在它上面。

EN: Screws nominally 10mm — tiny independent disturbances (voltage, wear, vibration, temperature) sum into a normal error. Six-Sigma quality control is built on this.

6 · 反过来:什么不会长成钟?

EN: What does NOT grow into a bell?
情况分布形状为什么不是钟
🎲 单颗骰子均匀分布只有 1 个随机量,没有「叠加」
🔍 二分猜数次数
(上一篇 ↗)
离散阶梯、右偏、截断来自「反复减半」的树,不是加法
🎟️ 买彩票中奖极端偏态绝大多数 0、极少数大奖——不独立也不均匀叠加
🧭 判断小口诀:先问它是「加法叠出来的」还是「单次/减半/极端事件」——前者容易长钟,后者长不成。

EN: Not everything is bell-shaped: a single die is uniform; binary-search guess counts are a right-skewed staircase (part 1); lottery wins are extremely skewed. Ask first: is it built by ADDITION?

7 · 想要正态随机数?有算法

EN: Need normal random numbers? There are algorithms

现实里很多工具需要「正态分布的随机数」。怎么从均匀随机数变出正态?两个经典办法:

方法 A · Box-Muller 变换(精确)

把两组 [0,1] 均匀随机数,经过数学变换,直接输出标准正态数。NumPy 的 np.random.normal 底层就是这类思路。

import numpy as np
# Box-Muller 变换:u1,u2 ~ 均匀[0,1] → z ~ 标准正态
u1 = np.random.rand(100000)
u2 = np.random.rand(100000)
z  = np.sqrt(-2*np.log(u1)) * np.cos(2*np.pi*u2)
# 画直方图就是钟形

方法 B · 12 个均匀数相加(CLT 速成近似)

干脆用中心极限定理本身:取 12 个 0~1 均匀数相加再减 6,均值 0、方差≈1,已经是很好的近似正态(这就是「召唤正态」的简易咒语)。

import random
def rand_gauss_approx():
    s = sum(random.random() for _ in range(12))
    return s - 6   # 均值 0,方差≈1

EN: Two generators: (A) Box-Muller transform — exact, used by NumPy; (B) CLT shortcut — sum 12 uniform [0,1] values and subtract 6.

8 · 总结

EN: Summary
形状来源典型例子
🎲 均匀分布平的横线单个等概率随机单颗骰子、randint
🔍 猜数次数分布右偏阶梯,7 次截断二分树的深度上一篇的猜数游戏
🔔 正态分布对称钟形大量独立小量相加(CLT)身高、成绩、误差、多骰子和
  1. 正态的起源是加法:大量独立、微小的随机因素叠加 → 钟形自然涌现(中心极限定理)。
  2. 判断一个现象会不会正态,先问它是不是「加法叠出来的」;单次随机、减半过程、极端事件都长不成钟。
  3. 想要正态随机数:Box-Muller 精确生成,或 12 个均匀数相加近似——算法只是「造钟」,真正的钟来自叠加。

两篇连起来看:离散分布回答「数出来的次数」(阶梯、右偏),连续的正态回答「叠出来的度量」(钟形、对称)——一个来自树的减半,一个来自世界的相加。🌳 ➕ 🔔

EN: Discrete distributions count things (tree-halving → staircase). The normal distribution measures sums (world's addition → bell). One comes from halving a tree; the other from adding up the world.

✍️ 作者:LEO爸爸 与 Phys 🐷Authors: Leo's Dad & Phys