# Geometric Mean

Geometric Mean is another way of finding the average of a sample. While the Arithmetic Mean takes the sum of the sample divided by the sample size, the geometric mean takes the $n^{th}$ root of the sample items product. In Mathematical Notation this is written as:

$$Geometric\ Mean\ (g\mu)\ \stackrel{\text{def}}{=}\ \left.\sqrt[n]{\prod_{i=1}^{n}x_i}\right|\ x\ \in\ S\ \land\ n\ =\ \left|S\right|,\ where\ S\ is\ the\ sample$$

Note: The Geometric Mean symbol used in the expression above, $g\mu$, and in the articles on this blog, is not an official notation. It is used by the author to distinguish between the different formulæ in view that $\mu$ is the standard symbol for all type of averages.

The mathematical formula above with the sample examples can be found implemented in 5 different programming languages in our Github repository.

Note: The code in Github uses the exponential expression notation for $n^{th}$ roots.$$\sqrt[n]{x} \equiv x^{\frac{1}{n}}$$

## Examples

### Example 1:

Consider the following simple set $S = {1, 2, 3, 4, 5, 6, 7, 8, 9}$. Using the formula above, as shown below in 3 simple steps we find the Geometric mean.

1. Multiply the values in the set$$1 \times 2 \times 3 \times 4 \times 5 \times 6 \times 7 \times 8 \times 9 = 362880$$
2. Find the sample size$$n = 9$$
3. Find the geometric mean$$g\mu = \sqrt[9]{362880} = 4.1472$$

### Example 2:

$S = \left\{\begin{matrix}0.4963474212, 0.1976482578, 0.9688106204,\\ 0.6871861999, 0.0291216746, 0.9002658844,\\0.5500229849, 0.7883546496, 0.9563570268,\\0.5221225236\end{matrix}\right\}$

Workings:

1. Multiply the values in the set$$\begin{matrix} \ \ \ 0.4963474212 \times 0.1976482578\\\times 0.9688106204 \times 0.6871861999\\\times 0.0291216746 \times 0.9002658844\\\times 0.5500229849 \times 0.7883546496\\\times 0.9563570268 \times 0.5221225236\end{matrix} = 0.0003707$$
2. Find the sample size$$n = 10$$
3. Find the arithmetic mean$$g\mu = \sqrt[10]{0.0003707} = 0.4538449$$

### Example 3:

$S = \left\{\begin{matrix}2434328.636, 2165063.314, 672636.861, 1577901.667, 1036641.384,\\1308041.737, 1394538.174, 1156174.874, 2070147.199, 2325744.443,\\2418455.663, 1837957.274, 435248.174, 1190710.265, 1723196.454,\\192363.666, 2611679.169, 2401823.254, 300617.99, 1492514.693,\\1782919.758, 824565.687, 1271028.593, 2015003.283, 1813062.483\end{matrix}\right\}$

Workings:

1. Add the values in the set$$\begin{matrix}\ \ \ 2434328.636 \times 2165063.314 \times \ \ 672636.861\\\times 1577901.667\times 1036641.384 \times 1308041.737\\\times 1394538.174 \times 1156174.874 \times 2070147.199\\\times 2325744.443 \times 2418455.663 \times 1837957.274\\\times \ \ 435248.174 \times 1190710.265 \times 1723196.454\\ \times \ \ 192363.666 \times 2611679.169 \times 2401823.254\\ \times \ \ 300617.990 \times 1492514.693 \times 1782919.758\\ \times \ \ 824565.687 \times 1271028.593 \times 2015003.283\\ \times 1813062.483\hspace{13em}\end{matrix} = 8.63868 \times 10^{152}$$
2. Find the sample size$$n = 25$$
3. Find the arithmetic mean$$g\mu = \sqrt[25]{8.63868 \times 10^{152}} = 1310562.9914397$$

### Example 4

$S = \left\{\begin{matrix}51,97,43,20,48,48,96,63,10,35,16,\\4,42,80,18,1,67,75,46,92,38,44,\\87,69,54,91,6,8,60,64,53,23,86\end{matrix}\right\}$

Workings:

1. Add the values in the set$$\begin{matrix} \ \ \ 51 \times 97 \times 43 \times 20 \times 48 \times 48 \times 96 \times 63 \times 10 \times 35\\\times 16 \times \ \ 4\times 42\times 80 \times 18 \times \ \ 1\times 67\times 75\times 46\times 92\\\times 38 \times 44 \times 87 \times 69 \times 54 \times 91 \times \ \ 6 \times \ \ 8 \times 60 \times 64\\\times 53 \times 23 \times 86\hspace{15.5em}\end{matrix} = 1.6277606 \times 10^{51}$$
2. Find the sample size$$n = 33$$
3. Find the arithmetic mean$$g\mu = \sqrt[33]{1.6277606 \times 10^{51}} = 35.6341480$$