# Why is the inverse of an average of numbers not the same as the average of the inverse of those same numbers?

I have a set of numbers (in my case: mean retention time (MRT) in the stomach (h)) of which I want to calculate the average gastric passage rate (/h). Gastric passage rate = 1/MRT.

My question is why 'the average of the calculated gastric passage rates of those numbers' is not the same as 'the calculated gastric passage rate of the averaged MRTs'. The next question is: what is the right way?

So for example:

$$x = 5; 10; 4; 2.$$ Average $$= 5.25 h \Rightarrow 1/5.25 = 0.19$$/h

$$1/x = 0.2; 0.1; 0.25; 0.5.$$ Average $$= 0.26$$/h

So should I first take the average of the MRTs and then take the inverse for calculating the gastric passage rate (first way) or should I first take the inverse of all numbers for calculating the gastric passage rates and then take the average of that number (second way).

New contributor
Nena is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• Welcome the Mathematics Stack Exchange community. A quick tour of the site will help you get the most of your time here. For typesetting your equations, please use MathJax. Here is a great reference. – dantopa Feb 10 at 17:08
• – J. W. Tanner Feb 10 at 17:16
• Putting on your socks and then putting on your shoes isn't the same as putting on your shoes and then putting on your socks. Buying auto insurance and then crashing your car isn't the same as crashing your car and then buying insurance. Why should averaging numbers and then inverting the averages be the same as inverting numbers and then averaging the inverses? The order in which you do things matters, in life and in arithmetic. – Gerry Myerson Feb 10 at 23:13
• Nena: I don't think your question is stupid at all. It's pretty subtle. Your second method is clearly wrong, but your first method might be wrong too. That's what I said in my last comment on my answer. I've just discussed it with my son, who's a statistician, and he was intrigued. He says he may think about an answer. In any case thank you for asking. – Ethan Bolker Feb 11 at 0:43
• If one study found a mean retention rate of 10 hours, and another study found a mean retention rate of 2 hours, doesn't that tell you that at least one of these studies was seriously flawed? If the reason that one study found 10 hours and the other found 2 hours is that the first study was studying retention of marijuana while the second was studying retention of LSD, or one study was measuring retention in 2-year-olds while the other was measuring retention in adults, that is, if the studies were studying very different things, then does it make any sense even to try to average the results? – Gerry Myerson Feb 11 at 12:09

Here's an everyday puzzle that may help.

If you travel from here to there at $$30$$ miles per hour and back at $$60$$ miles per hour, what is your average speed? Instinct says it should be the average, which would be $$45$$ miles per hour.

But speed is (total distance)/(total time). You don't have a distance given, but you can make one up. Suppose your destination was $$60$$ miles away. Then it took you $$2$$ hours to get there and $$1$$ to get back. You drove $$120$$ miles in $$3$$ hours so your average speed was $$40$$ miles per hour.

The moral of the story is that you can't naively average averages, and a rate is an average. So be careful when you have to compute an average rate.

In your case your MRT is like the reciprocal of the speed, whose units are hours/mile. In my example those are $$2$$ hours per $$60$$ miles for the slow trip and $$1$$ hour per $$60$$ miles for the fast return. You can average those to get the average number of hours per mile. The average is $$1.5$$ hours per $$60$$ miles. The reciprocal is $$60$$ miles per $$1.5$$ hours, or $$40$$ miles per hour.

So this is right:

take the average of the MRTs and then take the inverse for calculating the gastric passage rate (first way)

Edit in light of many comments and clarifications.

The important question is "what is the right way to average the MRT values?", not "why do these two methods differ?" or even "which of these two is right?"

The answer depends on what MRT actually measures. If material moves through the gut at a constant rate then your first method is correct, as discussed above. But if material leaves the gut at a rate proportional to the amount present - that is, a fraction of the amount leaves per hour - then the process is like exponential decay. I don't know a right way to compute the average rate in that case. If you have very few values to average and they are not very different then you may be able to argue that whatever results you get are essentially independent of the way you average the rates.

• Thank you for your edit! But why is MRT the reciprocal of the speed? The MRT is expressed in hours. It is just the retention time in the stomach and the gastric passage rate (GPR) is the inverse of that, so 1/MRT is the fraction of nutrients that is leaving the stomach (/h). I understand that you cannot average averages, but the passage rate is just the inverse of the MRT, so they are related, it is not an average number or am I wrong? – Nena Feb 10 at 23:08
• Your comment led me reread the question and then @j-g 's answer. I think that's the right one. My answer is based on the assumption that 1/MRT is a rate with units stuff per hour. But more likely it's the rate constant in an exponential decay model and it's a fraction per hour. – Ethan Bolker Feb 11 at 0:12
• "You drove 120 miles in 3 hours so your average speed was 40 miles per hour." Couldn't it also be correct to say that your speed averaged over time was 40 mph but your speed averaged over distance was 45 mph? – LarsH Feb 11 at 2:43
• @LarsH You could say that, but I can't think of a context in which that would be a useful number to know. – Ethan Bolker Feb 11 at 3:00
• @Yakk Of course you can compute the average over space. Can you think of a context in which it would be useful? The ones I can imagine are pretty contrived. – Ethan Bolker Feb 11 at 16:02

You've encountered a phenomenon called the AM-HM inequality, $$\frac{1}{n}\sum_{i=1}^n x_i\ge\frac{n}{\sum_{i=1}^n\frac{1}{x_i}}$$ for $$x_i>0$$, with equality iff all $$x_i$$ are equal. In general, functions don't commute with taking expectations; this is the example with the function $$1/x$$.

What you do with your data depends on what form you assume the distribution of retention times has. For example, suppose you think it has an Exponential distribution, with rate parameter $$\lambda$$. The fact that $$1/\lambda$$ is the MRT is then $$1/\lambda=\int_0^\infty\lambda x\exp (-\lambda x)\mathrm{d}x$$. I don't advise trying to estimate $$\lambda$$ from averaged reciprocals, since $$\int_0^\infty\frac{\lambda}{x}\exp (-\lambda x)\mathrm{d}x$$ is infinite.

Let's suppose for the sake of argument that we estimate $$1/\lambda$$ as the dataset's mean retention time. This is an example of the method of moments. It can be shown maximum likelihood estimation would recommend the same estimator. Pages 3 and 4 here discuss what happens with Bayesian estimation, and it comes to much the same thing for a large sample size. So if I were you, I'd estimate $$1/\lambda$$ as the mean GPR.

• Unfortunately, I am a student with basic math skills and I do not understand the last part of your answer, but the relationship you describe above (this > that) is actually the other way around for my dataset (this < that). Could you try to explain it a bit more easily for me? Maybe a bit more explanation helps. The MRT is estimated based on the T50 (50% of recovery) of a marker following the digesta in the gut. The graph of "%recovery (cumulative) x time" follows a sigmoid function. So the T50 is assumed to be equal to the MRT and mean is assumed to be equal to the median. – Nena Feb 11 at 1:48
• @Nena Long story short, parameter estimation is an in general complicated subject that gives fairly simple advice when the distribution is exponential. Since it's sigmoid, I'll have to reconsider. Your data doesn't contradict my inequality because you actually compared 1/AM to 1/HM. – J.G. Feb 11 at 6:06
• @Nena Sorry, I just realised: the distribution of retention time can't be logistic, because that has support $\Bbb R$ instead of $[0,\,\infty)$. Please edit your question to make explicit the conjectured probability distribution of retention time; I'll then add a revised discussion of its parameter estimation. – J.G. Feb 11 at 6:50
• Thank you J.G.! Let me rethink.. The "cumulative %recovery of marker x time" will give a logistic function, and at 50% it will give the T50 which equals MRT. However, the "%recovery of marker found in digesta x time" will give a parabolic function, of which the peak of the parabola is the MRT, if I am right.. Does that make sense? – Nena Feb 11 at 13:30
• @Nena Not really, no, sorry. However, I suspect whatever distribution you intend would mandate parameter estimation along the lines of what I described in my answer. – J.G. Feb 11 at 13:41

One way to handle questions like this is to reduce it to the simplest possible version of the question and then examine that problem. In this case,

 Why is the inverse of the average of x and y not equal to
the average of the inverses of x and y?


So you are asking "Why isn't this true?" $$\dfrac{1}{\left( \dfrac{x+y}{2} \right)} = \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2}$$

Personally, I would be suprised if the two sides turned out to be equal. But we can just solve the equation and see what happens.

\begin{align} \dfrac{1}{\left( \dfrac{x+y}{2} \right)} &= \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2} \\ \dfrac{1}{\left( \dfrac{x+y}{2} \right)} \cdot \dfrac 22 &= \dfrac{\left( \dfrac 1x + \dfrac 1y \right)}{2} \cdot \dfrac{xy}{xy} \\ \dfrac{2}{x+y} &= \dfrac{x+y}{2xy} \\ (x+y)^2 &= 4xy \\ x^2 - 2xy + y^2 &= 0 \\ (x-y)^2 &= 0 \\ x-y &= 0 \\ x &= y \end{align}

The two sides are equal when $$x = y$$. Otherwise they are not.

If the question won't work, in general, for two variables, then it probably won't work, in general, for more than two variables.

• So only when all values equal the average? Interesting... – Weckar E. Feb 11 at 8:06
• AM-HM inequality as in J.G.'s answer – qwr Feb 11 at 22:04

You should also consider, in determining an appropriate solution method, that 'average' is a lay/common term used to describe the arithmetic mean. There are many other choices of averaging function that you could select for this data. As a first suggestion, try the geometric mean: $$G(\mathbb{x}) = \sqrt[\leftroot{-3}\uproot{3}n]{x_1 \cdot x_2 \cdots x_n}$$ You should notice that if $$\mathbb{y}=(\frac{1}{x_1},\frac{1}{x_2},\ldots,\frac{1}{x_n})$$ then $$\frac{1}{G(\mathbb{y})} = G(\mathbb{x}).$$

New contributor
Timkin is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

The short answer is that taking inverses is not a linear operation. This is almost tautological, in so far that a linear operation is one that "behaves well" with respect to linear combinations, in the sense that the operation applied to a linear combination of values gives the same result as taking the same linear combination of the outcomes of the operation applied to those values; the average of $$n$$ values is a special case of a linear combination of those values (namely the sum of $$\frac1n$$ times each value).

The only reason this short answer is interesting is that linear operations have been classified, so one can usually tell by inspection whether an operation is linear or not. For operations that produce a single number form a single number, the only linear operations are multiplication by a fixed number (so for instance tripling is a linear operation). Taking the inverse of a number is not of this form, and it is not linear. Nor are taking the square, the square root, or the logarithm; you will find that each of those operations also fail to behave well for (the technical term is "commute with") taking averages in the sense of your question (the square of the average is not the average of the squares, and so forth).

Short answer: The complete units don't match.

You have four retention events of durations $$5$$, $$10$$, $$4$$, and $$2$$ hours.

The average retention duration is $$\frac{1}{4 \,\text{events}}(5 \,\text{h} + 10 \,\text{h} + 4 \,\text{h} + 2 \,\text{h}) = 5.25$$ hours per event. Its reciprocal is $$0.19\dots$$ events per hour.

The retention rates (events per hour) are $$\frac{1}{5}$$, $$\frac{1}{10}$$, $$\frac{1}{4}$$, and $$\frac{1}{2}$$ reciprocal hours. So the average retention rate is $$\frac{1}{4 \,\text{events}}\left( \frac{1}{5} \,\text{h}^{-1} + \frac{1}{10} \,\text{h}^{-1} + \frac{1}{4} \,\text{h}^{-1} + \frac{1}{2} \,\text{h}^{-1} \right) = 0.2625$$ reciprocal hours per event.

Why would you expect the number of events per hour to be the same as the number of reciprocal hours per event?

The average gastric passage rate should have units of events per hour, so you want to use the first method, yielding $$0.19\dots$$ events per hour.

Contributors have made many useful comments on this, but unless I missed it, no-one has mentioned the other kind of mean that is involved here - viz the harmonic mean, which is the reciprocal of the arithmetic mean of the reciprocals.

The example of the miles/hour is a helpful everyday one; another common motoring one is miles per gallon, which if averaged yields an incorrect result. This is because miles per gallon is a measure not of consumption but of economy. In the metric world there is a true measure of consumption - litres per 100km, which CAN be averaged.

Another one is in the investment world, and is often called pound-cost averaging.

Suppose you invest £100 a month in a share that is volatile , i.e. that varies in price. You get more when the share is cheaper and less when it is more expensive. So the average per-unit price paid is less than the average price. Exactly the same mistake as if you try to average mph or mpg. To calculate the true average price you need the harmonic mean, the reciprocal of the arithmetic mean of the reciprocals. So far as I know, no-one else has associated the term "harmonic mean" with pound-cost averaging, and I'm pleased to offer it here for consideration by others.

In this case, the mean gastric passage rate is the harmonic mean of the individual GPRs - but since you have the reciprocals already given, in the MRTs, it's simpler to take the arithmetic mean of the MRTs, and then finally to determine the reciprocal. i.e. the first method is correct.

New contributor
Dr John Wilson is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Given some positive values $$x_1$$, ..., $$x_n$$, their average is $$\frac{x_1+\cdots+x_n}{n}=\frac{1}{n}\sum_{i=1}^nx_i,$$ and its inverse is $$\frac{1}{\frac{1}{n}\sum_{i=1}^nx_i}=\frac{n}{\sum_{i=1}^nx_i}.\tag{1}$$ On the other hand, the average of the inverses is $$\frac{\frac{1}{x_1}+\cdots+\frac{1}{x_n}}{n}=\frac{1}{n}\sum_{i=1}^n\frac{1}{x_i}\tag{2}.$$ In general, these two expressions are not the same, as your calculations also show.

I wrote an incorrect and confusing bit here, after reading the question properly (and giving it some thought) I fully support @Ethan Bolkers answer.

• Thank you for your comment! If I divide the sum of all gastric passage rates by the total number of hours, it even gives a third different solution.. So I am actually still not sure what is the right thing to do. The unit of MRT is h and the unit of passage rate is /h (just inverse of MRT). So if I sum all the passage rate and divide it by total hours, then I divide (/h) by (h), which does not make sense for me. – Nena Feb 10 at 18:21
• Ah good point! I was a bit unclear on this part; you divide by the total number things you are taking the average of. It just so happens that you have one measurement per hour (it seems?), so this is the same as the total number of hours. But you are dividing by a unitless number; the number of data points. I have edited to avoid confusion. – Servaes Feb 10 at 19:16
• It's just that several studies found a MRT, like Study A found a MRT of 5 h, Study B found a MRT of 10 h, Study C found a MRT of 4 h, etc. Then I want to calculate the average passage rate (which is 1/MRT) of all these values. So I don't understand what you mean with 'one measurement per hour'.. Also you say second calculation and Ethan says first one, so now I am even more confused XD – Nena Feb 10 at 22:54
• Yes I know that is what you meant :) But I do not understand why. And again: someone else is saying the opposite, so how do I know what is right.. – Nena Feb 10 at 23:04
• I have read your question again, and took the time to understand it properly this time. Ethan Bolkers answer is correct, and I certainly could not phrase it any better than he already has. – Servaes Feb 10 at 23:09

You've stumbled upon one version of a more general phenomenon, the root of which is that averages (expectations) are a linear operation but inverses are non-linear and our linear intuition falls short.

One version of generalizing what you observed here is Jensen's inequality, which states that, for a convex function ("curved upwards", like $$\frac1x$$ is), the value of applying the function to the average will be at most the value of applying an average to the function, or in symbols:

$$f(\mathbb{E}[X]) \leq \mathbb{E}[f(X)]$$

There is a nice graphical proof (see the Wikipedia article), but getting it might require some baseline intuition for probabilities & expectations.

Just to answer the question "which way is right":

If you have the MRTs for some patients, and you want the average gastric passage rate, the right thing to do is convert all the numbers to gastric passage rates by taking the reciprocal, and then take the average. In other words, the Second Way is right.

As for the reason the two numbers are different, a lot of the other explanations just repeat using formulas what you saw for yourself with example numbers. I would say this: taking the inverse squeezes big numbers closer together, and makes small numbers farther apart. If, instead of taking the inverse, you were multiplying each number by 5, say, then the spacing between the numbers would be modified in a uniform way, and then your two methods actually would be the same.

You already got many answers why it doesn't work for a "normal" arithmetic average.

In fact there exists a type of average for which this is true.

It would be the same if you were using a geometric mean instead of an arithmetic mean.

In that case, the algebra becomes:

$$\sqrt[N]{\prod_1^N a_i} = \sqrt[N]{a_1\cdots a_N} = a_1^{1/N}\cdots {a_N}^{1/N} = \\\frac{1}{{a_1}^{-1/N}\cdots {a_N}^{-1/N}} = \frac{1}{\displaystyle\sqrt[N]{\prod_1^N {a_i}^{-1}}} = \frac{1}{\displaystyle\sqrt[N]{\prod_1^N \frac 1{a_i}}}$$