Harmonic Mean Calculator

Calculate the harmonic mean with detailed step-by-step solutions and comparison to other means.

Numbers

Harmonic Mean Formula:
H = n / (1/x₁ + 1/x₂ + ... + 1/xₙ)
where n is the count of numbers

Import Numbers

All numbers must be positive. Supports comma, space, or newline separated values.

Quick Reference

The harmonic mean is the reciprocal of the arithmetic mean of reciprocals. It's used for rates and ratios.

Formula:
H = n / Σ(1/xᵢ)

Features

  • Step-by-step calculations
  • Add/remove numbers easily
  • Edit numbers inline
  • Arithmetic mean comparison
  • Geometric mean comparison
  • Mean inequality verification
  • Bulk import numbers
  • Copy results
  • Quick examples

About Harmonic Mean Calculator

The harmonic mean is a type of average that is particularly useful for rates, ratios, and situations involving reciprocals. Unlike the arithmetic mean, which simply adds values and divides by the count, the harmonic mean is calculated as the reciprocal of the arithmetic mean of reciprocals. This makes it ideal for averaging rates like speed, work rates, and financial ratios.

Understanding Harmonic Mean

The harmonic mean gives more weight to smaller values in a dataset, making it the appropriate choice when averaging rates or ratios. It's always less than or equal to the geometric mean, which is less than or equal to the arithmetic mean (H ≤ G ≤ A). This relationship is known as the inequality of means.

Key Formulas

Harmonic Mean Formula

H = n / Σ(1/xᵢ) = n / (1/x₁ + 1/x₂ + ... + 1/xₙ)

Where n is the count of numbers and xᵢ represents each value. All values must be positive.

Arithmetic Mean Formula

A = Σxᵢ / n = (x₁ + x₂ + ... + xₙ) / n

The arithmetic mean is the simple average, sum of all values divided by count.

Geometric Mean Formula

G = ⁿ√(x₁ × x₂ × ... × xₙ) = (x₁ × x₂ × ... × xₙ)^(1/n)

The geometric mean is the nth root of the product of all values.

Mean Inequality

H ≤ G ≤ A

For positive numbers, the harmonic mean is always less than or equal to the geometric mean, which is less than or equal to the arithmetic mean. Equality holds when all values are identical.

When to Use Each Mean

Use Harmonic Mean when:

  • Averaging rates (speed, work rate, production rate)
  • Calculating average speed for equal distances
  • Averaging ratios (P/E ratios, price-to-book ratios)
  • Working with reciprocals or inverse relationships
  • Calculating parallel resistance in electronics
  • Analyzing rates in time-based calculations

Use Geometric Mean when:

  • Calculating compound growth rates
  • Averaging percentages or ratios that multiply
  • Working with exponential data
  • Calculating average returns on investments

Use Arithmetic Mean when:

  • Calculating simple averages
  • Working with additive data
  • Finding the center of a dataset
  • Analyzing normally distributed data

Practical Applications

  • Average Speed: When you travel the same distance at different speeds, the harmonic mean gives the correct average speed. For example, driving 60 mph one way and 40 mph back gives an average speed of 48 mph (harmonic mean), not 50 mph (arithmetic mean).
  • Financial Ratios: When averaging P/E ratios, price-to-book ratios, or other financial metrics, the harmonic mean prevents high outliers from skewing results.
  • Parallel Resistance: In electronics, the total resistance of parallel resistors is calculated using the harmonic mean formula.
  • Work Rates: When multiple workers or machines work together, their combined work rate is related to the harmonic mean of individual rates.
  • Computer Science: Used in F1 score calculation (harmonic mean of precision and recall) and other performance metrics.
  • Economics: Averaging price indices, exchange rates, and other economic ratios.
  • Physics: Calculating average velocities, frequencies, and other rate-based measurements.

Step-by-Step Calculation Example

Let's calculate the harmonic mean for [2, 4, 8]:

  1. Calculate reciprocals:
    • 1/2 = 0.5
    • 1/4 = 0.25
    • 1/8 = 0.125
  2. Sum the reciprocals:
    Σ(1/xᵢ) = 0.5 + 0.25 + 0.125 = 0.875
  3. Divide count by sum of reciprocals:
    H = 3 / 0.875 = 3.428571
  4. Compare with other means:
    • Harmonic Mean: 3.43
    • Geometric Mean: 4.00
    • Arithmetic Mean: 4.67
    • Inequality verified: 3.43 ≤ 4.00 ≤ 4.67 ✓

Real-World Examples

Example 1: Average Speed

You drive 60 miles at 60 mph, then 60 miles back at 40 mph. What's your average speed?

Solution: H = 2 / (1/60 + 1/40) = 2 / 0.0417 = 48 mph

Note: The arithmetic mean (50 mph) would be incorrect because you spend more time at the slower speed.

Example 2: P/E Ratios

Three stocks have P/E ratios of 10, 15, and 30. What's the average P/E ratio?

Solution: H = 3 / (1/10 + 1/15 + 1/30) = 3 / 0.2 = 15

The harmonic mean (15) is more appropriate than the arithmetic mean (18.33) for averaging ratios.

Example 3: Parallel Resistors

Three resistors (2Ω, 4Ω, 8Ω) are connected in parallel. What's the equivalent resistance?

Solution: R = 1 / (1/2 + 1/4 + 1/8) = 1 / 0.875 = 1.14Ω

Common Use Cases

  • Transportation: Calculate average speed for round trips or multiple segments with equal distances.
  • Finance: Average P/E ratios, price-to-book ratios, dividend yields, and other financial metrics.
  • Electronics: Calculate total resistance of parallel resistors or capacitors.
  • Statistics: Analyze rates and ratios in datasets, especially when smaller values should have more weight.
  • Machine Learning: Calculate F1 score (harmonic mean of precision and recall).
  • Economics: Average exchange rates, price indices, and productivity ratios.
  • Physics: Calculate average velocities, frequencies, and wavelengths.

Tips for Using This Calculator

  • All numbers must be positive (greater than zero)
  • Enter numbers one at a time or import multiple numbers at once
  • Edit any number directly by clicking on it
  • The calculator automatically compares harmonic, geometric, and arithmetic means
  • Use Quick Examples to see real-world scenarios
  • Step-by-step solution shows the complete calculation process
  • Results are displayed with 6 decimal places for precision
  • Copy results to clipboard for use in other applications

Frequently Asked Questions

Why is harmonic mean always smaller than arithmetic mean?

The harmonic mean gives more weight to smaller values because it works with reciprocals. When you take reciprocals, smaller numbers become larger, and vice versa. This weighting pulls the harmonic mean toward the smaller values in your dataset.

When should I use harmonic mean instead of arithmetic mean?

Use harmonic mean when averaging rates (like speed), ratios (like P/E ratios), or any situation where the values represent "per unit" measurements. Use arithmetic mean for simple averages of additive quantities.

Can harmonic mean be used with negative numbers?

No, harmonic mean requires all positive numbers. With negative or zero values, the reciprocals become undefined or negative, making the calculation meaningless.

What's the relationship between the three means?

For positive numbers, the inequality H ≤ G ≤ A always holds, where H is harmonic mean, G is geometric mean, and A is arithmetic mean. They're equal only when all values are identical.

Why is harmonic mean used for average speed?

When traveling equal distances at different speeds, you spend more time at slower speeds. The harmonic mean accounts for this time weighting, giving the correct average speed. The arithmetic mean would overestimate the average speed.

Advanced Concepts

  • Weighted Harmonic Mean: Hᵂ = (Σwᵢ) / Σ(wᵢ/xᵢ). Used when different values have different weights or importance.
  • F1 Score: F1 = 2 / (1/Precision + 1/Recall). The harmonic mean of precision and recall in machine learning evaluation.
  • Pythagorean Means: The three classical means (arithmetic, geometric, harmonic) form a family related by the AM-GM-HM inequality.
  • Contraharmonic Mean: C = Σxᵢ² / Σxᵢ. Always greater than or equal to the arithmetic mean, opposite behavior to harmonic mean.

Related Statistical Measures

  • Quadratic Mean (RMS): √(Σxᵢ²/n). Used for averaging magnitudes, always ≥ arithmetic mean.
  • Median: Middle value when sorted. Not affected by extreme values like means are.
  • Mode: Most frequently occurring value. Useful for categorical or discrete data.
  • Trimmed Mean: Arithmetic mean after removing extreme values. Robust to outliers.