{
  "id": "harmonic-mean",
  "title": "Harmonic Mean",
  "lang": "en",
  "source_lang": "en",
  "summary": "The harmonic mean is the reciprocal of the arithmetic mean of reciprocals, commonly used to average rates when equal quantities occur in their numerators.",
  "category": "mathematics",
  "subcategory": "probability-statistics",
  "type": "concept",
  "aliases": [
    "Subcontrary mean"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/harmonic-mean/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/harmonic-mean/",
      "json": "https://aiwiki.page/zh/harmonic-mean.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The harmonic mean is a measure of central tendency defined, for positive numbers, as the reciprocal of the arithmetic mean of their reciprocals. In statistics and applied mathematics, it is particularly useful for combining rates when the quantities in the numerators of those rates are equal, or when appropriate numerator-based weights are available. Compared with the arithmetic mean, it gives greater influence to small values. Together with the arithmetic and geometric mean, it forms the three classical Pythagorean means, studied in ancient Greece."
    },
    {
      "heading": "Definition",
      "text": "For \\(n\\) positive real numbers \\(x_1,\\ldots,x_n\\), the harmonic mean is\n\n\\[H(x_1,\\ldots,x_n) = \\left(\\frac{1}{n}\\sum_{i=1}^{n}\\frac{1}{x_i}\\right)^{-1} = \\frac{n}{\\displaystyle\\sum_{i=1}^{n}1/x_i}.\\]\n\nFor two positive numbers \\(a\\) and \\(b\\), this becomes\n\n\\[H(a,b)=\\frac{2ab}{a+b}.\\]\n\nFor example, the harmonic mean of \\(2\\) and \\(8\\) is\n\n\\[H(2,8)=\\frac{2\\cdot2\\cdot8}{2+8}=3.2,\\]\n\nwhereas their geometric mean is \\(4\\) and their arithmetic mean is \\(5\\).\n\nThe standard definition assumes strictly positive inputs. This restriction ensures that the denominator is positive and that the result lies between the smallest and largest inputs. Although the same algebraic expression can sometimes be evaluated for nonzero negative or mixed-sign values, it need not then behave as a mean."
    },
    {
      "heading": "Weighted harmonic mean",
      "text": "Given nonnegative weights \\(w_1,\\ldots,w_n\\), not all zero, the weighted harmonic mean is\n\n\\[H_w = \\frac{\\displaystyle\\sum_{i=1}^{n}w_i} {\\displaystyle\\sum_{i=1}^{n}w_i/x_i}.\\]\n\nIf the weights are normalized so that \\(\\sum_i w_i=1\\), the formula simplifies to\n\n\\[H_w=\\left(\\sum_{i=1}^{n}\\frac{w_i}{x_i}\\right)^{-1}.\\]\n\nEqual weights give the ordinary harmonic mean. Multiplying every weight by the same positive constant leaves the result unchanged. An input with zero weight has no effect and may be omitted.\n\nThe interpretation of the weights is crucial. For a rate expressed as “quantity per unit resource,” harmonic weights ordinarily represent amounts of the numerator quantity. Arithmetic weights instead represent amounts of the denominator resource."
    },
    {
      "heading": "Mathematical properties",
      "text": "Bounds and inequalities\n\nFor positive inputs,\n\n\\[\\min_i x_i\\le H\\le\\max_i x_i.\\]\n\nLet \\(G\\) and \\(A\\) denote the geometric and arithmetic means of the same numbers. Then\n\n\\[H\\le G\\le A,\\]\n\nwith equality throughout if and only if all inputs are equal.\n\nThe inequality \\(H\\le A\\) follows directly from the Cauchy–Schwarz inequality:\n\n\\[\\left(\\sum_{i=1}^{n}x_i\\right) \\left(\\sum_{i=1}^{n}\\frac{1}{x_i}\\right) \\ge n^2.\\]\n\nWeighted versions of these inequalities hold when all three means use the same normalized nonnegative weights.\n\nFor two inputs there is also the identity\n\n\\[H(a,b)\\,A(a,b)=G(a,b)^2=ab.\\]\n\nScaling, monotonicity, and sensitivity\n\nThe harmonic mean is symmetric in its inputs and homogeneous of degree one:\n\n\\[H(cx_1,\\ldots,cx_n)=cH(x_1,\\ldots,x_n), \\qquad c>0.\\]\n\nThus, changing measurement units changes the mean by the same scale factor.\n\nIncreasing any input while keeping the others fixed increases the harmonic mean. Its partial derivative is\n\n\\[\\frac{\\partial H}{\\partial x_i} = \\frac{H^2}{n x_i^2}.\\]\n\nWithin a given collection of values, a smaller input therefore has a larger local effect than a larger one. In particular, if one input approaches zero while the others remain fixed and positive, the harmonic mean approaches zero.\n\nUnlike the arithmetic mean, the harmonic mean is not translation-equivariant: adding a constant to every input does not generally add that same constant to the mean. Its interpretation consequently depends on meaningful ratios and a meaningful zero, as with speeds, durations, and many physical rates.\n\nRelation to other families of means\n\nThe harmonic mean is the power mean of order \\(-1\\). The power mean of order \\(p\\ne0\\) is\n\n\\[M_p= \\left(\\frac{1}{n}\\sum_{i=1}^{n}x_i^p\\right)^{1/p},\\]\n\nso that \\(H=M_{-1}\\).\n\nA sequence is called a harmonic progression when its reciprocals form an arithmetic progression. For two positive numbers \\(a\\) and \\(b\\), inserting their harmonic mean between them makes\n\n\\[\\frac{1}{a},\\quad \\frac{1}{H(a,b)},\\quad \\frac{1}{b}\\]\n\nan arithmetic progression."
    },
    {
      "heading": "Averaging rates and ratios",
      "text": "The main practical question is not simply whether the observations are rates, but which underlying quantities are being combined.\n\nSuppose\n\n\\[r_i=\\frac{a_i}{b_i}, \\qquad a_i>0,\\quad b_i>0.\\]\n\nThe aggregate rate is\n\n\\[R=\\frac{\\sum_i a_i}{\\sum_i b_i}.\\]\n\nSince \\(b_i=a_i/r_i\\),\n\n\\[R=\\frac{\\sum_i a_i}{\\sum_i a_i/r_i},\\]\n\nwhich is the weighted harmonic mean of the individual rates, with weights \\(a_i\\). Equivalently,\n\n\\[R=\\frac{\\sum_i b_i r_i}{\\sum_i b_i},\\]\n\nwhich is their weighted arithmetic mean, with weights \\(b_i\\).\n\nThus, the harmonic and arithmetic formulations describe the same aggregate ratio using different weights. Neither is universally the correct way to average rates without information about the underlying totals.\n\nAverage speed\n\nA vehicle travels two equal distances, one at \\(60\\ \\mathrm{km/h}\\) and the other at \\(30\\ \\mathrm{km/h}\\). Its average speed is\n\n\\[\\frac{2}{1/60+1/30}=40\\ \\mathrm{km/h}.\\]\n\nThe slower leg takes more time, so the arithmetic mean \\(45\\ \\mathrm{km/h}\\) is not the average speed over the complete journey.\n\nFor unequal distances \\(d_i\\), the average speed is the distance-weighted harmonic mean:\n\n\\[v_{\\mathrm{avg}} = \\frac{\\sum_i d_i}{\\sum_i d_i/v_i}.\\]\n\nBy contrast, when speeds are maintained for equal durations, their arithmetic mean gives the average speed.\n\nPrices and unit costs\n\nIf equal amounts of money are spent on a commodity at positive unit prices \\(p_1,\\ldots,p_n\\), the overall price paid per unit is the harmonic mean of those prices. At a low price, the same expenditure buys more units, giving that price more influence on the aggregate unit cost.\n\nFor unequal expenditures \\(m_i\\), the aggregate unit price is\n\n\\[p_{\\mathrm{aggregate}} = \\frac{\\sum_i m_i}{\\sum_i m_i/p_i}.\\]\n\nIf equal quantities rather than equal expenditures are purchased, the appropriate average price is instead arithmetic."
    },
    {
      "heading": "Other applications",
      "text": "Classification metrics\n\nIn machine learning and information retrieval, the F1 score is the harmonic mean of precision and recall:\n\n\\[F_1=\\frac{2PR}{P+R}.\\]\n\nThis construction makes the score sensitive to a low value of either component. A high value of one cannot fully compensate for a very low value of the other.\n\nThe more general score\n\n\\[F_\\beta = (1+\\beta^2)\\frac{PR}{\\beta^2P+R}, \\qquad \\beta>0,\\]\n\nis a weighted harmonic mean. In reciprocal form,\n\n\\[\\frac{1}{F_\\beta} = \\frac{1}{1+\\beta^2}\\frac{1}{P} + \\frac{\\beta^2}{1+\\beta^2}\\frac{1}{R}.\\]\n\nZero-valued and undefined precision or recall require conventions beyond the strictly positive definition.\n\nElectrical resistance and layered media\n\nFor \\(n\\) positive resistances connected in parallel, their equivalent resistance satisfies\n\n\\[\\frac{1}{R_{\\mathrm{eq}}} = \\sum_{i=1}^{n}\\frac{1}{R_i}.\\]\n\nConsequently,\n\n\\[R_{\\mathrm{eq}}=\\frac{H(R_1,\\ldots,R_n)}{n}.\\]\n\nThe equivalent resistance is therefore not itself the harmonic mean: it is the harmonic mean divided by the number of branches.\n\nA weighted harmonic mean also describes effective conductivity across ideal layers arranged in series with the direction of steady flow. If layer \\(i\\) has thickness \\(d_i\\) and conductivity \\(k_i\\), with equal cross-sectional area and no additional interface resistance, then\n\n\\[k_{\\mathrm{eff}} = \\frac{\\sum_i d_i}{\\sum_i d_i/k_i}.\\]"
    },
    {
      "heading": "Population harmonic mean",
      "text": "For a positive random variable \\(X\\), the population harmonic mean can be defined as\n\n\\[H_X=\\frac{1}{\\operatorname{E}[1/X]},\\]\n\nprovided \\(0<\\operatorname{E}[1/X]<\\infty\\), where \\(\\operatorname{E}\\) denotes expected value.\n\nWhen \\(\\operatorname{E}[X]\\) is also finite, Jensen’s inequality gives\n\n\\[H_X\\le \\operatorname{E}[X].\\]\n\nIf \\(\\operatorname{E}[1/X]=\\infty\\), a generalized harmonic mean is sometimes assigned the value zero. This can occur even when \\(X\\) is strictly positive, because sufficiently much probability near zero makes its reciprocal have infinite expectation.\n\nUnder independent, identically distributed sampling with finite reciprocal expectation, the sample harmonic mean converges to \\(H_X\\) by the law of large numbers. It is not generally an unbiased estimator of that population quantity."
    },
    {
      "heading": "Limitations and computation",
      "text": "A zero input makes the reciprocal formula undefined. On the nonnegative domain, a continuous extension assigns the harmonic mean the value zero whenever at least one input is zero. Whether that convention is meaningful depends on the application.\n\nNegative values create more serious difficulties. Reciprocals of opposite signs can cancel, making the expression undefined or placing its value outside the range of the inputs.\n\nThe harmonic mean is not a general-purpose substitute for other measures of central tendency. Its strong sensitivity to small observations is useful for some aggregation problems but can make it highly sensitive to near-zero measurement errors.\n\nDirect computation can also encounter problems in floating-point arithmetic if reciprocals overflow. One scaled formula for positive inputs uses \\(m=\\min_i x_i\\):\n\n\\[H = m\\frac{n}{\\sum_i m/x_i}.\\]\n\nHere every ratio \\(m/x_i\\) lies in \\((0,1]\\), avoiding explicit reciprocals of very small inputs. Summation error and extreme input ranges may still require attention to numerical stability."
    }
  ],
  "links": [
    "statistics",
    "ancient-greece",
    "real-number",
    "cauchy-schwarz-inequality",
    "partial-derivative",
    "machine-learning",
    "f-score",
    "precision-and-recall",
    "random-variable",
    "expected-value",
    "jensens-inequality",
    "law-of-large-numbers",
    "estimator",
    "floating-point-arithmetic",
    "numerical-stability"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}