# Geometric mean

In mathematics, the geometric mean is a mean or average which indicates a central tendency of a finite collection of positive real numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum). The geometric mean of ⁠$n$⁠ numbers is the nth root of their product, i.e., for a collection of numbers a$_1$, a$_2$, ..., a$_n$, the geometric mean is defined as
    ${\sqrt[{n}]{a_{1}a_{2}\cdots a_{n}{\vphantom {t}}}}.$
When the collection of numbers and their geometric mean are plotted in logarithmic scale, the geometric mean is transformed into an arithmetic mean, so the geometric mean can equivalently be calculated by taking the natural logarithm ⁠$\ln$⁠ of each number, finding the arithmetic mean of the logarithms, and then returning the result to linear scale using the exponential function ⁠$\exp$⁠,
    ${\sqrt[{n}]{a_{1}a_{2}\cdots a_{n}{\vphantom {t}}}}=\exp \left({\frac {\ln a_{1}+\ln a_{2}+\cdots +\ln a_{n}}{n}}\right).$
The geometric mean of two numbers is the square root of their product, for example with numbers ⁠$2$⁠ and ⁠$8$⁠ the geometric mean is $\textstyle {\sqrt {2\cdot 8}}=$$\textstyle {\sqrt {16}}=4$. The geometric mean of the three numbers is the cube root of their product, for example with numbers ⁠$1$⁠, ⁠$12$⁠, and ⁠$18$⁠, the geometric mean is $\textstyle {\sqrt[{3}]{1\cdot 12\cdot 18}}=$$\textstyle {\sqrt[{3}]{216}}=6$.
The geometric mean is useful whenever the quantities to be averaged combine multiplicatively, such as population growth rates or interest rates of a financial investment. Suppose for example a person invests $1000 and achieves annual returns of +10%, −12%, +90%, −30% and +25%, giving a final value of $1609. The average percentage growth is the geometric mean of the annual growth ratios (1.10, 0.88, 1.90, 0.70, 1.25), namely 1.0998, an annual average growth of 9.98%. The arithmetic mean of these annual returns is 16.6% per annum, which is not a meaningful average because growth rates do not combine additively.
The geometric mean can be understood in terms of geometry. The geometric mean of two numbers, $a$ and $b$, is the length of one side of a square whose area is equal to the area of a rectangle with sides of lengths $a$ and $b$. Similarly, the geometric mean of three numbers, $a$, $b$, and $c$, is the length of one edge of a cube whose volume is the same as that of a cuboid with sides whose lengths are equal to the three given numbers.
The geometric mean is one of the three classical Pythagorean means, together with the arithmetic mean and the harmonic mean. For all positive data sets containing at least one pair of unequal values, the harmonic mean is always the least of the three means, while the arithmetic mean is always the greatest of the three and the geometric mean is always in between (see Inequality of arithmetic and geometric means.)

## Formulation

The geometric mean of a data set {a$_1$, a$_2$, …, a$_n$}{\textstyle \left\{a_{1}, a_{2}, \, \ldots , \, a_{n}\right\}} is given by:
    ${\biggl\prod _{i=1}^{n}a_{i}{\biggr )}^{\frac {1}{n}}={\sqrt[{n}]{a_{1}a_{2}\cdots a_{n}{\vphantom {t}}}}.$
That is, the nth root of the product of the elements. For example, for 1, 2, 3, 4{\textstyle 1, 2, 3, 4}, the product 1⋅2⋅3⋅4{\textstyle 1\cdot 2\cdot 3\cdot 4} is 24{\textstyle 24}, and the geometric mean is the fourth root of 24, approximately 2.213.

### Formulation using logarithms

The geometric mean can also be expressed as the exponential of the arithmetic mean of logarithms. By using logarithmic identities to transform the formula, the multiplications can be expressed as a sum and the power as a multiplication:
When $a_{1},a_{2},\dots ,a_{n}>0$
    ${\biggl\prod _{i=1}^{n}a_{i}{\biggr )}^{\frac {1}{n}}=\exp {\biggl{\frac {1}{n}}\sum _{i=1}^{n}\ln a_{i}{\biggr )},$
since $\textstyle {\vphantom {\Big |}}\ln {\sqrt[{n}]{a_{1}a_{2}\cdots a_{n}{\vphantom {t}}}}={\frac {1}{n}}\ln(a_{1}a_{2}\cdots a_{n})={\frac {1}{n}}(\ln a_{1}+\ln a_{2}+\cdots +\ln a_{n}).$
This is sometimes called the log-average (not to be confused with the logarithmic average). It is simply the arithmetic mean of the logarithm-transformed values of $a_{i}$ (i.e., the arithmetic mean on the log scale), using the exponentiation to return to the original scale, i.e., it is the generalized f-mean with $f(x)=\log x$. A logarithm of any base can be used in place of the natural logarithm. For example, the geometric mean of ⁠$1$⁠, ⁠$2$⁠, ⁠$8$⁠, and ⁠$16$⁠ can be calculated using logarithms base 2:
    ${\sqrt[{4}]{1\cdot 2\cdot 8\cdot 16}}=2^{(\log _{2}\!1\,+\,\log _{2}\!2\,+\,\log _{2}\!8\,+\,\log _{2}\!16)/4}=2^{(0\,+\,1\,+\,3\,+\,4)/4}=2^{2}=4.$
Related to the above, it can be seen that for a given sample of points $a_{1},\ldots ,a_{n}$, the geometric mean is the minimizer of
    $f(a)=\sum _{i=1}^{n}(\log a_{i}-\log a)^{2}=\sum _{i=1}^{n}\left(\log {\frac {a_{i}}{a}}\right)^{2}$,
whereas the arithmetic mean is the minimizer of
    $f(a)=\sum _{i=1}^{n}(a_{i}-a)^{2}$.
Thus, the geometric mean provides a summary of the samples whose exponent best matches the exponents of the samples (in the least squares sense).
In computer implementations, naïvely multiplying many numbers together can cause arithmetic overflow or underflow. Calculating the geometric mean using logarithms is one way to avoid this problem.

## Related concepts
### Iterative means

The geometric mean of a data set is less than the data set's arithmetic mean unless all members of the data set are equal, in which case the geometric and arithmetic means are equal. This allows the definition of the arithmetic-geometric mean, an intersection of the two which always lies in between.
The geometric mean is also the arithmetic-harmonic mean in the sense that if two sequences (a$_n${\textstyle a_{n}}) and (h$_n${\textstyle h_{n}}) are defined:
    $a_{n+1}={\frac {a_{n}+h_{n}}{2}},\quad a_{0}=x$
and
    $h_{n+1}={\frac {2{a_{n}}{h_{n}}}{a_{n}+h_{n}}},\quad h_{0}=y$
where h$_{n+1}${\textstyle h_{n+1}} is the harmonic mean of the previous values of the two sequences, then a$_n${\textstyle a_{n}} and h$_n${\textstyle h_{n}} will converge to the geometric mean of x{\textstyle x} and y{\textstyle y}. The sequences converge to a common limit, and the geometric mean is preserved:
    ${\sqrt {a_{i+1}h_{i+1}}}={\sqrt {{\frac {a_{i}+h_{i}}{2}}{\frac {2{a_{i}}{h_{i}}}{a_{i}+h_{i}}}}}={\sqrt {{a_{i}}{h_{i}}}}$
Replacing the arithmetic and harmonic mean by a pair of generalized means of opposite, finite exponents yields the same result.

### Comparison to arithmetic mean

The geometric mean of a non-empty data set of positive numbers is always at most their arithmetic mean. Equality is only obtained when all numbers in the data set are equal; otherwise, the geometric mean is smaller. For example, the geometric mean of 2 and 3 is 2.45, while their arithmetic mean is 2.5. In particular, this means that when a set of non-identical numbers is subjected to a mean-preserving spread — that is, the elements of the set are "spread apart" more from each other while leaving the arithmetic mean unchanged — their geometric mean decreases.

### Geometric mean of a continuous function

If $f:[a,b]\to (0,\infty )$ is a positive continuous real-valued function, its geometric mean over this interval is
    ${\text{GM}}[f]=\exp \left({\frac {1}{b-a}}\int _{a}^{b}\ln f(x)dx\right)$
For instance, taking the identity function $f(x)=x$ over the unit interval shows that the geometric mean of the positive numbers between 0 and 1 is equal to ${\frac {1}{e}}$.

## Applications
### Average proportional growth rate

The geometric mean is more appropriate than the arithmetic mean for describing proportional growth, both exponential growth (constant proportional growth) and varying growth; in business the geometric mean of growth rates is known as the compound annual growth rate (CAGR). The geometric mean of growth over periods yields the equivalent constant growth rate that would yield the same final amount.
As an example, suppose an orange tree yields 100 oranges one year and then 180, 210 and 300 the following years, for growth rates of 80%, 16.7% and 42.9% respectively. Using the arithmetic mean calculates a (linear) average growth of 46.5% (calculated by $(80\%+16.7\%+42.9\%)\div 3$). However, when applied to the 100 orange starting yield, 46.5% annual growth results in 314 oranges after three years of growth, rather than the observed 300. The linear average overstates the rate of growth.
Instead, using the geometric mean, the average yearly growth is approximately 44.2% (calculated by ${\sqrt[{3}]{1.80\times 1.167\times 1.429}}$). Starting from a 100 orange yield with annual growth of 44.2% gives the expected 300 orange yield after three years.
In order to determine the average growth rate, it is not necessary to take the product of the measured growth rates at every step. Let the quantity be given as the sequence $a_{0},a_{1},...,a_{n}$, where $n$ is the number of steps from the initial to final state. The growth rate between successive measurements $a_{k}$ and $a_{k+1}$ is $a_{k+1}/a_{k}$. The geometric mean of these growth rates is then just:
    $\left({\frac {a_{1}}{a_{0}}}{\frac {a_{2}}{a_{1}}}\cdots {\frac {a_{n}}{a_{n-1}}}\right)^{\frac {1}{n}}=\left({\frac {a_{n}}{a_{0}}}\right)^{\frac {1}{n}}.$

### Normalized values

The fundamental property of the geometric mean, which does not hold for any other mean, is that for two sequences $X$ and $Y$ of equal length,
    $\operatorname {GM} \left({\frac {X_{i}}{Y_{i}}}\right)={\frac {\operatorname {GM} (X_{i})}{\operatorname {GM} (Y_{i})}}$.
This makes the geometric mean the only correct mean when averaging normalized results; that is, results that are presented as ratios to reference values. This is the case when presenting computer performance with respect to a reference computer, or when computing a single average index from several heterogeneous sources (for example, life expectancy, education years, and infant mortality). In this scenario, using the arithmetic or harmonic mean would change the ranking of the results depending on what is used as a reference. For example, take the following comparison of execution time of computer programs:
Table 1
| | Computer A | Computer B | Computer C |
| Program 1 | 1 | 10 | 20 |
| Program 2 | 1000 | 100 | 20 |
| Arithmetic mean | 500.5 | 55 | 20 |
| Geometric mean | 31.622 . . . | 31.622 . . . | 20 |
| Harmonic mean | 1.998 . . . | 18.182 . . . | 20 |
The arithmetic and geometric means "agree" that computer C is the fastest. However, by presenting appropriately normalized values and using the arithmetic mean, we can show either of the other two computers to be the fastest. Normalizing by A's result gives A as the fastest computer according to the arithmetic mean:
Table 2
| | Computer A | Computer B | Computer C |
| Program 1 | 1 | 10 | 20 |
| Program 2 | 1 | 0.1 | 0.02 |
| Arithmetic mean | 1 | 5.05 | 10.01 |
| Geometric mean | 1 | 1 | 0.632 . . . |
| Harmonic mean | 1 | 0.198 . . . | 0.039 . . . |
while normalizing by B's result gives B as the fastest computer according to the arithmetic mean but A as the fastest according to the harmonic mean:
Table 3
| | Computer A | Computer B | Computer C |
| Program 1 | 0.1 | 1 | 2 |
| Program 2 | 10 | 1 | 0.2 |
| Arithmetic mean | 5.05 | 1 | 1.1 |
| Geometric mean | 1 | 1 | 0.632 |
| Harmonic mean | 0.198 . . . | 1 | 0.363 . . . |
and normalizing by C's result gives C as the fastest computer according to the arithmetic mean but A as the fastest according to the harmonic mean:
Table 4
| | Computer A | Computer B | Computer C |
| Program 1 | 0.05 | 0.5 | 1 |
| Program 2 | 50 | 5 | 1 |
| Arithmetic mean | 25.025 | 2.75 | 1 |
| Geometric mean | 1.581 . . . | 1.581 . . . | 1 |
| Harmonic mean | 0.099 . . . | 0.909 . . . | 1 |
In all cases, the ranking given by the geometric mean stays the same as the one obtained with unnormalized values.
However, this reasoning has been questioned. Giving consistent results is not always equal to giving the correct results. In general, it is more rigorous to assign weights to each of the programs, calculate the average weighted execution time (using the arithmetic mean), and then normalize that result to one of the computers. The three tables above just give a different weight to each of the programs, explaining the inconsistent results of the arithmetic and harmonic means (Table 4 gives equal weight to both programs, the Table 2 gives a weight of 1/1000 to the second program, and the Table 3 gives a weight of 1/100 to the second program and 1/10 to the first one). The use of the geometric mean for aggregating performance numbers should be avoided if possible, because multiplying execution times has no physical meaning, in contrast to adding times as in the arithmetic mean. Metrics that are inversely proportional to time (speedup, IPC) should be averaged using the harmonic mean.
The geometric mean can be derived from the generalized mean as its limit as $p$ goes to zero. Similarly, this is possible for the weighted geometric mean.

### Financial

The geometric mean has from time to time been used to calculate financial indices (the averaging is over the components of the index). For example, in the past the FT 30 index used a geometric mean. It is also used in the CPI calculation and recently introduced "RPIJ" measure of inflation in the United Kingdom and in the European Union.
This has the effect of understating movements in the index compared to using the arithmetic mean.

### Applications in the social sciences

Although the geometric mean has been relatively rare in computing social statistics, starting from 2010 the United Nations Human Development Index did switch to this mode of calculation, on the grounds that it better reflected the non-substitutable nature of the statistics being compiled and compared:
    The geometric mean decreases the level of substitutability between dimensions [being compared] and at the same time ensures that a 1 percent decline in say life expectancy at birth has the same impact on the HDI as a 1 percent decline in education or income. Thus, as a basis for comparisons of achievements, this method is also more respectful of the intrinsic differences across the dimensions than a simple average.
Not all values used to compute the HDI (Human Development Index) are normalized; some of them instead have the form $\left(X-X_{\text{min}}\right)/\left(X_{\text{norm}}-X_{\text{min}}\right)$. This makes the choice of the geometric mean less obvious than one would expect from the "Properties" section above.
The equally distributed welfare equivalent income associated with an Atkinson Index with an inequality aversion parameter of 1.0 is simply the geometric mean of incomes. For values other than one, the equivalent value is an Lp norm divided by the number of elements, with p equal to one minus the inequality aversion parameter.

### Geometry

In the case of a right triangle, its altitude is the length of a line extending perpendicularly from the hypotenuse to its 90° vertex. Imagining that this line splits the hypotenuse into two segments, the geometric mean of these segment lengths is the length of the altitude. This property is known as the geometric mean theorem.
In an ellipse, the semi-minor axis is the geometric mean of the maximum and minimum distances of the ellipse from a focus; it is also the geometric mean of the semi-major axis and the semi-latus rectum. The semi-major axis of an ellipse is the geometric mean of the distance from the center to either focus and the distance from the center to either directrix.
Another way to think about it is as follows:
Consider a circle with radius $r$. Now take two diametrically opposite points on the circle and apply pressure from both ends to deform it into an ellipse with semi-major and semi-minor axes of lengths $a$ and $b$.
Since the area of the circle and the ellipse stays the same, we have:
    ${\begin{aligned}\pi r^{2}&=\pi ab\\r^{2}&=ab\\r&={\sqrt {ab}}\end{aligned}}$
The radius of the circle is the geometric mean of the semi-major and the semi-minor axes of the ellipse formed by deforming the circle.
Distance to the horizon of a sphere (ignoring the effect of atmospheric refraction when atmosphere is present) is equal to the geometric mean of the distance to the closest point of the sphere and the distance to the farthest point of the sphere.
The geometric mean is used in both in the approximation of squaring the circle by S.A. Ramanujan and in the construction of the heptadecagon with "mean proportionals".

### Aspect ratios

The geometric mean has been used in choosing a compromise aspect ratio in film and video: given two aspect ratios, the geometric mean of them provides a compromise between them, distorting or cropping both in some sense equally. Concretely, two equal area rectangles (with the same center and parallel sides) of different aspect ratios intersect in a rectangle whose aspect ratio is the geometric mean, and their hull (smallest rectangle which contains both of them) likewise has the aspect ratio of their geometric mean.
In the choice of 16:9 aspect ratio by the SMPTE, balancing 2.35 and 4:3, the geometric mean is √(2.35× 4/3)≈1.7701{\textstyle {\sqrt {2.35\times {\frac {4}{3}}}}\approx 1.7701}, and thus 16:9=1.777$^¯${\textstyle 16:9=1.77{\overline {7}}}... was chosen. This was discovered empirically by Kerns Powers, who cut out rectangles with equal areas and shaped them to match each of the popular aspect ratios. When overlapped with their center points aligned, he found that all of those aspect ratio rectangles fit within an outer rectangle with an aspect ratio of 1.77:1 and all of them also covered a smaller common inner rectangle with the same aspect ratio 1.77:1. The value found by Powers is exactly the geometric mean of the extreme aspect ratios, 4:3 (1.33:1) and CinemaScope (2.35:1), which is coincidentally close to 16:9{\textstyle 16:9} (1.777$^¯$:1{\textstyle 1.77{\overline {7}}:1}). The intermediate ratios have no effect on the result, only the two extreme ratios.
Applying the same geometric mean technique to 16:9 and 4:3 approximately yields the 14:9 (1.555$^¯${\textstyle 1.55{\overline {5}}}...) aspect ratio, which is likewise used as a compromise between these ratios. In this case 14:9 is exactly the arithmetic mean of 16:9{\textstyle 16:9} and 4:3=12:9{\textstyle 4:3=12:9}, since 14 is the average of 16 and 12, while the precise geometric mean is √(16/9 × 4/3)≈1.5396≈13.8:9, {\textstyle {\sqrt {{\frac {16}{9}}\times {\frac {4}{3}}}}\approx 1.5396\approx 13.8:9, } but the two different means, arithmetic and geometric, are approximately equal because both numbers are sufficiently close to each other (a difference of less than 2%).

### Paper formats

The geometric mean is also used to calculate B and C series paper formats. The $B_{n}$ format has an area which is the geometric mean of the areas of $A_{n}$ and $A_{n-1}$. For example, the area of a B1 paper is √2/2 m$^2${\textstyle {\frac {\sqrt {2}}{2}}\mathrm {m} ^{2}}, because it is the geometric mean of the areas of an A0 (1m$^2${\textstyle 1\mathrm {m} ^{2}}) and an A1 (1/2 m$^2${\textstyle {\frac {1}{2}}\mathrm {m} ^{2}}) paper (√(1m$^2$⋅ 1/2 m$^2$)=√(1/2 m$^4$)={\textstyle {\sqrt {1\mathrm {m} ^{2}\cdot {\frac {1}{2}}\mathrm {m} ^{2}}}={\sqrt {{\frac {1}{2}}\mathrm {m} ^{4}}}=}​ 1/√2 m$^2$=√2/2 m$^2${\textstyle {\frac {1}{\sqrt {2}}}\mathrm {m} ^{2}={\frac {\sqrt {2}}{2}}\mathrm {m} ^{2}}).
The same principle applies with the C series, whose area is the geometric mean of the A and B series. For example, the C4 format has an area which is the geometric mean of the areas of A4 and B4.
An advantage that comes from this relationship is that an A4 paper fits inside a C4 envelope, and both fit inside a B4 envelope.

### Other applications

* Spectral flatness: in signal processing, spectral flatness, a measure of how flat or spiky a spectrum is, is defined as the ratio of the geometric mean of the power spectrum to its arithmetic mean.
* Anti-reflective coatings: In optical coatings, where reflection needs to be minimized between two media of refractive indices n$_0$ and n$_2$, the optimum refractive index n$_1$ of the anti-reflective coating is given by the geometric mean: $n_{1}={\sqrt {n_{0}n_{2}}}$.
* Subtractive color mixing: The spectral reflectance curve for paint mixtures (of equal tinting strength, opacity and dilution) is approximately the geometric mean of the paints' individual reflectance curves computed at each wavelength of their spectra.
* Image processing: The geometric mean filter is used as a noise filter in image processing.
* Labor compensation: The geometric mean of a subsistence wage and market value of the labor using capital of employer was suggested as the natural wage by Johann von Thünen in 1875.