= Weighted harmonic mean
{title2=$H_w=(\sum_iw_i/x_i)^{-1}$}
For positive <real numbers> $x_i$ and nonnegative weights with $\sum_iw_i=1$, the weighted harmonic mean is
$$
H_w=\left(\sum_i\frac{w_i}{x_i}\right)^{-1}.
$$
Equal weights give the <harmonic mean>, while a zero weight excludes that input. For travel at positive constant <speeds> $v_i$ over positive leg <lengths> $d_i$, the weights are fractions of total distance:
$$
w_i=\frac{d_i}{\sum_jd_j},\qquad v_{\mathrm{avg}}=\frac{\sum_id_i}{\sum_id_i/v_i}=\left(\sum_i\frac{w_i}{v_i}\right)^{-1}.
$$
For $30\,\mathrm{km}$ at $30\,\mathrm{km/h}$ and $90\,\mathrm{km}$ at $60\,\mathrm{km/h}$, the weights are $1/4,3/4$, elapsed <time> is $5/2$ hours, and \b[the average <speed> is $48\,\mathrm{km/h}$]. Weighting the <speeds> by their time fractions instead gives the same result as a <weighted arithmetic mean>: $(2/5)30+(3/5)60=48$. The two weight systems describe the same journey in different coordinates and must not be interchanged. https://undergroundmathematics.org/introducing-calculus/average-speed/averages[University of Cambridge, Underground Mathematics: time weights and distance weights]{ref}.
Back to article page