The harmonic mean is the reciprocal of the arithmetic mean. It is calculated as the total number of observations divided by the sum of the reciprocals. It is used in situations in which it is necessary to average paths of equal length with different times, as well as to average multiples or quotients.
My cousin is a very athletic guy. He loves to run. Moreover, he runs regularly and always does the same circuit. I have never understood how he does not get bored.
Today I am going to use this healthy vice of my cousin to pose a tricky riddle for you, to see how many of you can give me the correct answer.
A tricky riddle
As I already told you, the circuit that my cousin does every morning is always the same. There is a park next to his house that has a perimeter of 2 kilometers and he goes around it 5 times. To top it all, every day he runs the 10 kilometers more or less at the same pace.
The first lap he is warming up, so he runs at 12 kilometers per hour (km/h). In the second lap, already warm and full of endorphins, he accelerates to a whopping 17 km/h. In the third lapse, his age begins to show, the pace drops a bit, to 14 km/h. In the fourth lap he is already huffing and puffing: 8 km/h. Finally, on the last lap he relaxes a bit and goes almost for a walk, at 5 km/h.
As you can see, the speed varies according to the laps. My tricky question is: how fast does my cousin run his morning marathon on average?
Some of you will think that the answer is quite easy. If you run 5 laps at 12, 17, 14, 8, and 5 km/h, the average speed will be (12 + 17 + 14 + 8 + 5) / 5 = 11.2 km/h.
Well, my cousin would like this answer to be correct.
Let’s think a bit. We already know that speed is the ratio between the distance a body travels, for example, my cousin, and the time it takes to travel it. In our riddle, the distance is easy to calculate: 5 laps, at 2 kilometers per lap, makes a total of 10 km. But how long does it take to complete the 5 laps?
Remember that each lap has 2 km. If during the first one his speed is 12 km/h, a simple rule of three will allow us to calculate that the lap ends in 0.16 hours, about 10 minutes. The second lap, at 17 km/h, will take 6.6 minutes. And so, the third, fourth and fifth will take 8.5, 15 and 24 minutes respectively. In other words, it takes him a total of 10 + 6.6 + 8.5 + 15 + 24 = 64.1 minutes or, what is the same, 1.07 hours to complete the 5 laps.
Well, we already have the answer: if he has done 10 km in 1.07 hours, his average speed has been 10 / 1.07 = 9.4 km/h.
Something has gone wrong. Our first estimate is higher than the true average speed.
Now I ask you, how could we have been wrong in such a simple calculation?
The reason is that we have posed the problem as the calculation of an arithmetic mean of the speeds of each lap, but this would only be correct if all the laps were made in the same time. When the different laps have the same distance, but are covered at different times, to obtain the total average speed, we could not use the arithmetic mean, but one of its relatives, the harmonic mean.
In summary, to solve this riddle we will have to calculate the harmonic mean of the partials average velocities.
But what is the harmonic mean? The harmonic mean is nothing other than the reciprocal of the arithmetic mean. It is calculated as the total number of observations divided by the sum of the reciprocals.
In our riddle, we would proceed as follows to calculate it:
harmonic mean = 5 / (1/12 + 1/17 + 1/14 + 1/8 + 1/5) = 9.3 km/h
As you can see, the result matches the one we did manually, with a small difference due to rounding.
Utility of the harmonic mean
The harmonic mean is used for situations such as the example we have seen, in which it is necessary to average paths of equal length with different times, which is why it is widely used in the field of electronics, and also to average multiples or quotients, as in stock market operations.
It should not be confused with another relative of the arithmetic mean, the geometric mean. The geometric mean, which is calculated as the n root of the product of n terms, is most useful for calculating growth rates and averages in time series, especially when there are logarithmic scales.
There is a relationship between the three means, such that the harmonic mean is always lower than the geometric mean, which, in turn, is lower than the arithmetic mean.
Two peculiarities of the harmonic mean
There are two aspects that we can comment on in relation to the peculiarities of the harmonic mean.
The first, all the elements that we want to average must necessarily be non-null. This is so because we cannot divide by zero, so it makes no sense to calculate it if one of the elements’ value is zero. The value of the harmonic mean would remain indeterminate.
The second, it is a fairly robust measure in the presence of high extreme values. When calculating the inverse, the value of the extremes has less influence on the total of the sum of the reciprocals. Consider, for example, that the inverse of 500 is 0.002, while that of 5 is 0.2. Thus, the larger an observation, the less it will influence the result.
However, the reverse is true for very low values. If we think about it, the closer a number approaches zero, the greater the value of its inverse, so they will have much more weight in the value of the harmonic mean (and also in the geometric one).
Before I finish, I have to confess that the story I have told you about my cousin is totally false. My cousin doesn’t even run to catch the bus.
The fable that I have told you is, however, inspired by an anecdote that is told about a problem that Max Wertheimer, one of the creators of the Gestalt, put to a friend of his, a certain Albert Einstein. This riddle consisted of figuring out how fast a car had to go down a mountain, knowing the distance of going up and down and the speed of going up, to get a given total average speed.
And now, here we leave it for today.
We have talked in this post about the harmonic mean and how robustness in the presence of high values is one of its characteristics.
But the harmonic mean is not the only robust variant of the arithmetic mean. There are others such as the trimmed mean, the winsorized mean, the weighted mean, etc. But that is another story…