# 调和平均数

调和平均数是一种平均数，其计算方法为：数值的个数除以各数值倒数之和。因此，对于数值 \( x_1, x_2, \ldots, x_n \)，它等于 \( n / (1/x_1 + 1/x_2 + \cdots + 1/x_n) \)。<sup>[1](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)</sup> 它是三种毕达哥拉斯平均数之一，与算术平均数和几何平均数并列。对于速率和比率而言，当被平均的量在其分子等量的情况下发挥作用时——例如等距离上的速度——调和平均数是恰当的平均数。<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup><sup> • </sup><sup>[3](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)</sup><sup> • </sup><sup>[15](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Descriptive_Statistics.pdf)</sup>

| 关键事实 | 详情 |
|---|---|
| 公式 | \( H = n / \sum_{i=1}^{n} (1/x_i) \)；对于两个数，\( H = 2ab/(a+b) \)，等价于 \( 2/H = 1/a + 1/b \)<sup>[1](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)</sup><sup> • </sup><sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup>  |
| 在平均数中的位置 | 幂平均数的特例 \( M_{-1} \)；对于正数，\( H \le G \le A \)，仅当所有数值相同时取等号<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup><sup> • </sup><sup>[3](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)</sup>  |
| 两值恒等式 | 当 \( n = 2 \) 时，\( H = G^2/A \)，其中 \( G = \sqrt{ab} \)，\( A = (a+b)/2 \)<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup><sup> • </sup><sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup>  |
| 定义域 | 仅对正值有定义；出现零则平均数无定义（某些软件按惯例返回零），负值没有标准解释<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup><sup> • </sup><sup>[6](https://docs.python.org/3.11/library/statistics.html)</sup>  |
| 典型用途 | 平均速率和比率：等距离上的速度、投资组合的市盈率、机器学习中的F1分数<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup><sup> • </sup><sup>[7](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)</sup>  |
| 加权形式 | \( \sum w_i / \sum (w_i/x_i) \)，用于数据点具有不同重要性的情形，如投资组合分析<sup>[1](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)</sup><sup> • </sup><sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup>  |
| 历史名称 | 早期文献中称为“反相平均数”；英文术语“harmonic mean”于1821年首次出现在印刷品中<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup><sup> • </sup><sup>[8](https://mathshistory.st-andrews.ac.uk/Miller/mathword/h/)</sup>  |

## 定义与基本性质

\( n \) 个正数的调和平均数是其倒数的算术平均数的倒数：<sup>[6](https://docs.python.org/3.11/library/statistics.html)</sup>

\[ H = \frac{n}{\dfrac{1}{x_1} + \dfrac{1}{x_2} + \cdots + \dfrac{1}{x_n}} \]

对于两个数，此式简化为 \( H = \dfrac{2ab}{a+b} \)。<sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup> 对于三个数 \( a, b, c \)，它等于 \( 3/(1/a + 1/b + 1/c) \)，MathWorld给出的展开形式为 \( 3abc/(ab + ac + bc) \)。<sup>[6](https://docs.python.org/3.11/library/statistics.html)</sup><sup> • </sup><sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup>

对于任意一组正值，调和平均数不超过几何平均数，几何平均数又不超过算术平均数；三者仅当所有数值相同时才相等，而数值越分散，三者之间的差距越大。<sup>[3](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)</sup><sup> • </sup><sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup> 对于两个数，三种平均数由 \( H = G^2/A \) 精确地联系在一起。<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup> 调和平均数也是 \( -1 \) 阶的幂平均数，与算术平均数（1阶）和均方根（2阶）同属一个家族。<sup>[2](https://mathworld.wolfram.com/HarmonicMean.html)</sup>

一个相关的代数事实将平均数与数列联系起来：若 \( x \)、\( x+y \)、\( x+2y \) 构成等差数列，则它们的倒数被称为构成调和数列，而 \( 1/n \) 是 \( 1/(n-1) \) 和 \( 1/(n+1) \) 的调和平均数。<sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup>

## 为何等距离上的速率需要它

平均速度定义为总距离除以总时间，是这一定义——而非平均数的选择——决定了哪种平均数才是正确的。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup> 如果两段等距离的路程分别以速度 \( v_1 \) 和 \( v_2 \) 行驶，则行驶时间分别为 \( d/v_1 \) 和 \( d/v_2 \)，因此

\[ \bar{v} = \frac{2d}{d/v_1 + d/v_2} = \frac{2}{1/v_1 + 1/v_2} = \frac{2 v_1 v_2}{v_1 + v_2} \]

这正是两个速度的调和平均数。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup> 距离 \( d \) 被消去，因此只有距离相等这一点重要，距离的长短无关紧要。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup>

一个计算实例展示了效应的大小。一辆汽车以60公里/小时行驶120公里（2小时），再以40公里/小时行驶120公里（3小时）：5小时共行驶240公里，平均速度为48公里/小时，恰好是调和平均数 \( 2 \cdot 60 \cdot 40 / (60 + 40) \)。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup> 算术平均数50公里/小时回答的是另一个问题：仅当两个速度保持相同时间时才正确，因为此时较慢的速度与较快的速度作用时间相同。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup> 在等距离情况下，较慢的速度占据更多时间，将真实平均数拉低到简单平均数以下；代数上差值为 \( (u-v)^2 / (2(u+v)) \ge 0 \)。<sup>[3](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)</sup> 当距离不等时，一般规则是总距离除以总时间，等于速度的距离加权调和平均数。<sup>[9](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)</sup><sup> • </sup><sup>[3](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)</sup>

## 应用

**机器学习。** F1分数是一种标准的分类指标，是精确率和召回率的调和平均数，最佳值为1，最差值为0。<sup>[7](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)</sup> 使用调和平均数而非算术平均数意味着精确率和召回率都必须相当高才能获得好分数，因为调和平均数会惩罚两者之间的极端不平衡。<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup>

**金融。** 市盈率（P/E）等金融倍数不应使用算术平均数来平均，因为算术平均数偏向较大的值。<sup>[1](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)</sup> 在一个指数计算实例中，某公司市盈率为50、权重40%，另一公司市盈率为4、权重60%，加权调和平均数给出的市盈率为6.33，而加权算术平均数给出22.4，存在严重高估。<sup>[1](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)</sup> DataCamp的一个例子用等额投资说明了同样的道理：三只市盈率分别为50、10和4的股票，算术平均数约为21.33，但调和平均数约为8.11，后者与总投入除以总收益的真实投资组合市盈率相符。<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup> 然而，这一选择并非在所有地方都有定论：一项2022年对八个普通股指数中各公司市盈率和盈利收益率进行的自助法研究发现，几何平均数而非调和平均数更适合对这些比率求平均，与普遍接受的观点相反。<sup>[10](https://www.sciencedirect.com/science/article/pii/S1544612322002458)</sup>

**计算。** 在计算机性能测量中，算术平均数适用于对运行时间求平均，而调和平均数适用于对速率（如每秒执行次数）求平均；密歇根大学高级计算机体系结构实验室的布鲁斯·雅各布和特雷弗·马奇在一份技术报告中指出，归一化值不得求平均，并建议用这两种平均数替代SPEC所使用的几何平均数。<sup>[11](https://terpconnect.umd.edu/~blj/papers/performance.pdf)</sup> 一篇2024年的IEEE论文同样主张，在明确的等工作量或等时间假设下，调和平均加速比应取代体系结构研究中的几何平均加速比。<sup>[12](https://ieeexplore.ieee.org/abstract/document/10419888)</sup>

**统计学。** 牛津大学大数据研究所的丹尼尔·J·威尔逊于2019年在PNAS上提出了调和平均p值（HMP），作为一种合并相依检验统计量的方法，可在控制族系误差率的同时提高统计功效，并应用于全基因组关联研究。<sup>[13](https://pubmed.ncbi.nlm.nih.gov/30610179/)</sup>

## 局限性

该公式要求对每个值取倒数，因此零会导致除以零，使调和平均数无定义；负值可以取倒数，但所得平均数在标准统计语境中没有有意义的解释。<sup>[14](https://slm.mba/mmpc-005/harmonic-mean-right-average-rates-ratios/)</sup><sup> • </sup><sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup> 这使得调和平均数不适用于包含亏损、负百分比收益或零停机时间值的数据集。<sup>[14](https://slm.mba/mmpc-005/harmonic-mean-right-average-rates-ratios/)</sup> 它也比其他平均数对小值更敏感，而正是这一特性使它在小值应获得更多权重时适用。<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup>

软件以具体惯例反映这些边界。Python的`statistics.harmonic_mean`于3.6版本加入，3.10版本增加了权重参数；若其中一个值为零则返回零，若数据为空或任一元素小于零则抛出`StatisticsError`。<sup>[6](https://docs.python.org/3.11/library/statistics.html)</sup> Excel提供`HARMEAN`函数，R和Python也包含内置实现。<sup>[5](https://www.datacamp.com/tutorial/harmonic-mean)</sup>

## 历史

三种毕达哥拉斯平均数由来已久。据注释家普罗克洛斯（Proclus，410–485）记载，毕达哥拉斯（Pythagoras）本人于公元前6世纪在美索不达米亚游历期间学到了三种平均数：算术平均数、几何平均数，以及后来被称为调和平均数的“反相平均数”。<sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup> 塔伦图姆的阿尔库塔斯（Archytas of Tarentum，约公元前350年）的一则残篇写道：“音乐中有三种平均数：第一种是算术的，第二种是几何的，第三种是反相的，他们称之为调和的。”亚里士多德（Aristotle）也使用过这一术语。<sup>[8](https://mathshistory.st-andrews.ac.uk/Miller/mathword/h/)</sup> 这一名称可能反映了该平均数在划分八度中的作用——使中间音与主音和八度形成和谐关系。<sup>[8](https://mathshistory.st-andrews.ac.uk/Miller/mathword/h/)</sup> 在英语中，“harmonic mean”一词于1821年出现在迈尔斯·布兰德所著的《可从欧几里得前六卷推导的几何问题》（*Geometrical Problems deducible from the first six books of Euclid*）中。<sup>[8](https://mathshistory.st-andrews.ac.uk/Miller/mathword/h/)</sup> 尽管有如此渊源，调和平均数一直被称为“被忽视的平均数”，因为它在核心数学课程中出现得如此之少。<sup>[4](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)</sup>

## References

1. [Harmonic Mean – Formula, Example, How to Calculate, Corporate Finance Institute](https://corporatefinanceinstitute.com/resources/data-science/harmonic-mean/)
2. [Harmonic Mean, Wolfram MathWorld](https://mathworld.wolfram.com/HarmonicMean.html)
3. [Averages | Average speed, Underground Mathematics, University of Cambridge](https://undergroundmathematics.org/introducing-calculus/average-speed/averages)
4. [What's Harmonic about the Harmonic Series?, The College Mathematics Journal (Kullman), Drexel University](https://www.math.drexel.edu/~tolya/Kullman_harmonic_series)
5. [Harmonic Mean Explained: A Guide to Rates and Ratios, DataCamp](https://www.datacamp.com/tutorial/harmonic-mean)
6. [statistics – Mathematical statistics functions, Python 3.11 documentation](https://docs.python.org/3.11/library/statistics.html)
7. [f1_score, scikit-learn documentation](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.f1_score.html)
8. [Earliest Known Uses of Some of the Words of Mathematics (H), MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Miller/mathword/h/)
9. [Why does equal-distance average speed use the harmonic mean?, Euler Learn](https://euler.realb.it/en/learn/why-equal-distance-average-speed-uses-the-harmonic-mean)
10. [Averaging financial ratios, ScienceDirect (Finance Research Letters, 2022)](https://www.sciencedirect.com/science/article/pii/S1544612322002458)
11. [Notes on Calculating Computer Performance, Jacob & Mudge, University of Michigan](https://terpconnect.umd.edu/~blj/papers/performance.pdf)
12. [R.I.P. Geomean Speedup: Use Equal-Work (Or Equal-Time) Harmonic Mean Speedup Instead, IEEE Xplore](https://ieeexplore.ieee.org/abstract/document/10419888)
13. [The harmonic mean p-value for combining dependent tests, Wilson, PNAS 2019](https://pubmed.ncbi.nlm.nih.gov/30610179/)
14. [Harmonic Mean: The Right Average for Rates and Ratios, SLM MBA self-learning material](https://slm.mba/mmpc-005/harmonic-mean-right-average-rates-ratios/)
15. [ncss.com](https://www.ncss.com/wp-content/themes/ncss/pdf/Procedures/NCSS/Descriptive_Statistics.pdf)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 19, 2026; Oct 15, 2026 · Edited: Sep 19, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 数学与统计学 › 统计学与概率论 › Statistics and probability — overview and reference

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/harmonic-mean

English original: https://www.edgepedia.org/harmonic-mean
