Skip to main content

Harmonic Mean Calculator

Calculate harmonic mean instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods.

Skip to calculator
Mathematics

Harmonic Mean Calculator

Calculate the harmonic mean of any set of positive numbers. Compare with arithmetic and geometric means. Essential for averaging rates, speeds, and ratios.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate

Enter two or more positive numbers separated by commas

Harmonic Mean
48.0000
of 2 values
Harmonic
48.0000
Geometric
48.9898
Arithmetic
50.0000
Mean Inequality (HM โ‰ค GM โ‰ค AM)
HM
GM
AM
Sum of Reciprocals
0.041667
Mean of Reciprocals
0.020833
Two-Number Formula: 2ab/(a+b)
48.000000
Reciprocals of Input Values
1/40 = 0.0250001/60 = 0.016667
Min
40
Median
50
Max
60
AM x HM = GM squared (for two values)
AM x HM = 2400.0000 | GM squared = 2400.0000
Your Result
Harmonic Mean = 48.0000 | Arithmetic Mean = 50.0000 | Geometric Mean = 48.9898
Share Your Result
Understand the Math

Formula

HM = n / (1/x1 + 1/x2 + ... + 1/xn)

The harmonic mean of n values is n divided by the sum of reciprocals. For two numbers a and b, this simplifies to 2ab/(a+b). The harmonic mean is always less than or equal to the geometric mean, which is always less than or equal to the arithmetic mean (HM <= GM <= AM).

Last reviewed: December 2025

Worked Examples

Example 1: Average Speed for Round Trip

You drive to work at 40 mph and return at 60 mph over the same distance. What is your average speed?
Solution:
Harmonic Mean = 2 x 40 x 60 / (40 + 60) = 4800 / 100 = 48 mph Verification: If distance = 100 miles each way: Time going = 100/40 = 2.5 hours Time returning = 100/60 = 1.667 hours Average = 200 miles / 4.167 hours = 48 mph
Result: Average Speed = 48 mph (not 50 mph as arithmetic mean would suggest)

Example 2: F1 Score Calculation

A classifier has precision = 0.9 and recall = 0.6. Find the F1 score.
Solution:
F1 = Harmonic Mean of Precision and Recall F1 = 2 x 0.9 x 0.6 / (0.9 + 0.6) = 1.08 / 1.5 = 0.72 Arithmetic mean would be (0.9 + 0.6)/2 = 0.75 The harmonic mean is lower, penalizing the imbalance
Result: F1 Score = 0.72 (harmonic mean penalizes the lower recall)
Expert Insights

Background & Theory

The Harmonic Mean Calculator applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the Harmonic Mean Calculator traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

The harmonic mean is a type of average calculated as the number of values divided by the sum of their reciprocals. For n numbers x1, x2, ..., xn, the harmonic mean equals n divided by (1/x1 + 1/x2 + ... + 1/xn). For two numbers a and b, this simplifies to 2ab/(a+b). The harmonic mean gives less weight to large outliers and more weight to smaller values compared to the arithmetic mean. It is always the smallest of the three Pythagorean means (harmonic, geometric, arithmetic) unless all values are equal, in which case all three means are identical.
Use the harmonic mean when averaging rates, ratios, or speeds for equal distances or equal work. The classic example is average speed: if you drive 60 mph for a certain distance and 40 mph for the same distance back, the average speed is the harmonic mean (48 mph), not the arithmetic mean (50 mph). Other applications include averaging price-to-earnings ratios in finance, combining parallel resistances in electronics, averaging fuel efficiency for equal distances, and computing the F1 score in machine learning as the harmonic mean of precision and recall.
The harmonic mean is correct for average speed when equal distances are traveled at different speeds because speed is a rate (distance per time). If you drive 100 miles at 40 mph (2.5 hours) and 100 miles at 60 mph (1.667 hours), total distance is 200 miles in 4.167 hours, giving true average speed of 48 mph. The arithmetic mean of 50 mph is wrong because you spend more time at the slower speed. The harmonic mean of 40 and 60 is 2 times 40 times 60 divided by (40 + 60) which equals 48, matching the correct answer. This property extends to any situation involving equal amounts of a denominator quantity.
For any set of positive numbers, the three Pythagorean means satisfy the inequality: harmonic mean is less than or equal to geometric mean, which is less than or equal to arithmetic mean (HM is less than or equal to GM is less than or equal to AM). This is known as the AM-GM-HM inequality. Equality holds if and only if all values are identical. For two numbers, there is an elegant relationship: the geometric mean squared equals the arithmetic mean times the harmonic mean (GM squared equals AM times HM). These relationships are foundational in mathematical analysis and appear in proofs across many fields.
In finance, the harmonic mean is used to average multiples like price-to-earnings (P/E) ratios, price-to-book ratios, and price-to-sales ratios across a portfolio. This is because these ratios have price in the numerator and a per-share quantity in the denominator, making them rates. The harmonic mean properly weights the average by the denominator. For example, if fund managers use equal dollar amounts across stocks with different P/E ratios, the portfolio P/E is the harmonic mean of individual P/E ratios. Market-cap weighted indices like the S&P 500 use this approach implicitly.
In machine learning and information retrieval, the F1 score is defined as the harmonic mean of precision and recall. Precision measures how many selected items are relevant, while recall measures how many relevant items are selected. The harmonic mean is chosen because it penalizes extreme imbalances between the two. A classifier with 100% precision but 1% recall would have an arithmetic mean of 50.5% but a harmonic mean (F1 score) of only 1.98%, correctly reflecting poor overall performance. The weighted F-beta score generalizes this to different weightings between precision and recall.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

HM = n / (1/x1 + 1/x2 + ... + 1/xn)

The harmonic mean of n values is n divided by the sum of reciprocals. For two numbers a and b, this simplifies to 2ab/(a+b). The harmonic mean is always less than or equal to the geometric mean, which is always less than or equal to the arithmetic mean (HM <= GM <= AM).

Worked Examples

Example 1: Average Speed for Round Trip

Problem: You drive to work at 40 mph and return at 60 mph over the same distance. What is your average speed?

Solution: Harmonic Mean = 2 x 40 x 60 / (40 + 60)\n= 4800 / 100\n= 48 mph\nVerification: If distance = 100 miles each way:\nTime going = 100/40 = 2.5 hours\nTime returning = 100/60 = 1.667 hours\nAverage = 200 miles / 4.167 hours = 48 mph

Result: Average Speed = 48 mph (not 50 mph as arithmetic mean would suggest)

Example 2: F1 Score Calculation

Problem: A classifier has precision = 0.9 and recall = 0.6. Find the F1 score.

Solution: F1 = Harmonic Mean of Precision and Recall\nF1 = 2 x 0.9 x 0.6 / (0.9 + 0.6)\n= 1.08 / 1.5\n= 0.72\nArithmetic mean would be (0.9 + 0.6)/2 = 0.75\nThe harmonic mean is lower, penalizing the imbalance

Result: F1 Score = 0.72 (harmonic mean penalizes the lower recall)

Frequently Asked Questions

What is the harmonic mean and how is it calculated?

The harmonic mean is a type of average calculated as the number of values divided by the sum of their reciprocals. For n numbers x1, x2, ..., xn, the harmonic mean equals n divided by (1/x1 + 1/x2 + ... + 1/xn). For two numbers a and b, this simplifies to 2ab/(a+b). The harmonic mean gives less weight to large outliers and more weight to smaller values compared to the arithmetic mean. It is always the smallest of the three Pythagorean means (harmonic, geometric, arithmetic) unless all values are equal, in which case all three means are identical.

When should you use the harmonic mean instead of the arithmetic mean?

Use the harmonic mean when averaging rates, ratios, or speeds for equal distances or equal work. The classic example is average speed: if you drive 60 mph for a certain distance and 40 mph for the same distance back, the average speed is the harmonic mean (48 mph), not the arithmetic mean (50 mph). Other applications include averaging price-to-earnings ratios in finance, combining parallel resistances in electronics, averaging fuel efficiency for equal distances, and computing the F1 score in machine learning as the harmonic mean of precision and recall.

Why is the harmonic mean used for average speed calculations?

The harmonic mean is correct for average speed when equal distances are traveled at different speeds because speed is a rate (distance per time). If you drive 100 miles at 40 mph (2.5 hours) and 100 miles at 60 mph (1.667 hours), total distance is 200 miles in 4.167 hours, giving true average speed of 48 mph. The arithmetic mean of 50 mph is wrong because you spend more time at the slower speed. The harmonic mean of 40 and 60 is 2 times 40 times 60 divided by (40 + 60) which equals 48, matching the correct answer. This property extends to any situation involving equal amounts of a denominator quantity.

What is the relationship between harmonic, geometric, and arithmetic means?

For any set of positive numbers, the three Pythagorean means satisfy the inequality: harmonic mean is less than or equal to geometric mean, which is less than or equal to arithmetic mean (HM is less than or equal to GM is less than or equal to AM). This is known as the AM-GM-HM inequality. Equality holds if and only if all values are identical. For two numbers, there is an elegant relationship: the geometric mean squared equals the arithmetic mean times the harmonic mean (GM squared equals AM times HM). These relationships are foundational in mathematical analysis and appear in proofs across many fields.

How is the harmonic mean used in finance?

In finance, the harmonic mean is used to average multiples like price-to-earnings (P/E) ratios, price-to-book ratios, and price-to-sales ratios across a portfolio. This is because these ratios have price in the numerator and a per-share quantity in the denominator, making them rates. The harmonic mean properly weights the average by the denominator. For example, if fund managers use equal dollar amounts across stocks with different P/E ratios, the portfolio P/E is the harmonic mean of individual P/E ratios. Market-cap weighted indices like the S&P 500 use this approach implicitly.

How is the harmonic mean applied in machine learning?

In machine learning and information retrieval, the F1 score is defined as the harmonic mean of precision and recall. Precision measures how many selected items are relevant, while recall measures how many relevant items are selected. The harmonic mean is chosen because it penalizes extreme imbalances between the two. A classifier with 100% precision but 1% recall would have an arithmetic mean of 50.5% but a harmonic mean (F1 score) of only 1.98%, correctly reflecting poor overall performance. The weighted F-beta score generalizes this to different weightings between precision and recall.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy