## Harmonic mean for ungrouped data

Let $x_i, i=1,2, \cdots , n$ be $n$ positive observations then the harmonic mean of $X$ is denoted by $HM$.

## Formula

The harmonic mean is given by

$HM = \dfrac{n}{\sum_{i=1}^{n} \dfrac{1}{x_i}}$

## Example

A bus driver travels total 30 miles. He travel first 10 miles with speed of 30 miles per hour, second 10 miles with the speed of 35 miles per hour and last 10 miles with the speed of 45 miles per hour. What is the average speed?

### Solution

Number of observations $n = 3$. The observations are $30, 35, 45$.

The harmonic mean of $X$ is

\begin{aligned} HM &= \dfrac{n}{\sum_{i=1}^{n} \dfrac{1}{x_i}}\\ &= \frac{3}{\frac{1}{30}+\frac{1}{35}+\frac{1}{45}}\\ &= \frac{3}{0.0841}\\ &= 35.6604 \text{ miles per hour} \end{aligned}

Another Method

Distance Speed = Distance/Time Time taken
10 miles $30$ miles per hour $\dfrac{10}{30} = 0.3333$
10 miles $35$ miles per hour $\dfrac{10}{35} = 0.2857$
10 miles $45$ miles per hour $\dfrac{10}{45} = 0.2222$

Total Distance Travelled = $30$ miles.

Total Time Taken = $0.3333+0.2857 + 0.2222=0.8413$

\begin{aligned} \text{Average Speed} &= \frac{\text{Total Distance Travelled}}{\text{Total Time Taken}}\\ &= \frac{30}{0.8413}\\ &=35.6604\text{ miles per hour} \end{aligned}