Generalized mean



In mathematics, generalized means (or power mean or Hölder mean from Otto Hölder) are a family of functions for aggregating sets of numbers. These include as special cases the Pythagorean means (arithmetic, geometric, and harmonic means).

Definition
If $p$ is a non-zero real number, and $$x_1, \dots, x_n$$ are positive real numbers, then the generalized mean or power mean with exponent $p$ of these positive real numbers is

$$M_p(x_1,\dots,x_n) = \left( \frac{1}{n} \sum_{i=1}^n x_i^p \right)^{{1}/{p}} .$$

(See $p$-norm). For $p = 0$ we set it equal to the geometric mean (which is the limit of means with exponents approaching zero, as proved below):

$$M_0(x_1, \dots, x_n) = \left(\prod_{i=1}^n x_i\right)^{1/n} .$$

Furthermore, for a sequence of positive weights $w_{i}$ we define the weighted power mean as $$M_p(x_1,\dots,x_n) = \left(\frac{\sum_{i=1}^n w_i x_i^p}{\sum_{i=1}^n w_i} \right)^{{1}/{p}}$$ and when $p = 0$, it is equal to the weighted geometric mean:

$$M_0(x_1,\dots,x_n) = \left(\prod_{i=1}^n x_i^{w_i}\right)^{1 / \sum_{i=1}^n w_i} .$$

The unweighted means correspond to setting all $w_{i} = 1/n$.

Special cases
A few particular values of $p$ yield special cases with their own names:
 * minimum :$$M_{-\infty}(x_1,\dots,x_n) = \lim_{p\to-\infty} M_p(x_1,\dots,x_n) = \min \{x_1,\dots,x_n\}$$
 * [[Image:MathematicalMeans.svg|thumb|A visual depiction of some of the specified cases for $n = 2$ with $a = x1 = M∞$ and $b = x2 = M−∞$: {{legend|magenta|harmonic mean, $H = M−1(a, b)$,}} {{legend|blue|geometric mean, $G = M0(a, b)$}} {{legend|red|arithmetic mean, $A = M1(a, b)$}} {{legend|lime|quadratic mean, $Q = M2(a, b)$}}]]harmonic mean :$$M_{-1}(x_1,\dots,x_n) = \frac{n}{\frac{1}{x_1}+\dots+\frac{1}{x_n}}$$
 * geometric mean $$M_0(x_1,\dots,x_n) = \lim_{p\to0} M_p(x_1,\dots,x_n) = \sqrt[n]{x_1\cdot\dots\cdot x_n}$$
 * arithmetic mean :$$M_1(x_1,\dots,x_n) = \frac{x_1 + \dots + x_n}{n}$$
 * root mean square or quadratic mean :$$M_2(x_1,\dots,x_n) = \sqrt{\frac{x_1^2 + \dots + x_n^2}{n}}$$
 * cubic mean :$$M_3(x_1,\dots,x_n) = \sqrt[3]{\frac{x_1^3 + \dots + x_n^3}{n}}$$
 * maximum :$$M_{+\infty}(x_1,\dots,x_n) = \lim_{p\to\infty} M_p(x_1,\dots,x_n) = \max \{x_1,\dots,x_n\}$$

$$

Properties
Let $$x_1, \dots, x_n$$ be a sequence of positive real numbers, then the following properties hold:


 * 1) $$\min(x_1, \dots, x_n) \le M_p(x_1, \dots, x_n) \le \max(x_1, \dots, x_n)$$.
 * 2) $$M_p(x_1, \dots, x_n) = M_p(P(x_1, \dots, x_n))$$, where $$P$$ is a permutation operator.
 * 3) $$M_p(b x_1, \dots, b x_n) = b \cdot M_p(x_1, \dots, x_n)$$.
 * 4) $$M_p(x_1, \dots, x_{n \cdot k}) = M_p\left[M_p(x_1, \dots, x_{k}), M_p(x_{k + 1}, \dots, x_{2 \cdot k}), \dots, M_p(x_{(n - 1) \cdot k + 1}, \dots, x_{n \cdot k})\right]$$.

Generalized mean inequality
In general, if $p → 0$, then $$M_p(x_1, \dots, x_n) \le M_q(x_1, \dots, x_n)$$ and the two means are equal if and only if $p ≠ 0$.

The inequality is true for real values of $x$ and $b$, as well as positive and negative infinity values.

It follows from the fact that, for all real $p$, $$\frac{\partial}{\partial p}M_p(x_1, \dots, x_n) \geq 0$$ which can be proved using Jensen's inequality.

In particular, for $b$ in $x_{1}, ..., x_{n}$, the generalized mean inequality implies the Pythagorean means inequality as well as the inequality of arithmetic and geometric means.

Proof of the weighted inequality
We will prove the weighted power mean inequality. For the purpose of the proof we will assume the following without loss of generality: $$\begin{align} w_i \in [0, 1] \\ \sum_{i=1}^nw_i = 1 \end{align}$$

The proof for unweighted power means can be easily obtained by substituting $x_{1}, ..., x_{n}$.

Equivalence of inequalities between means of opposite signs
Suppose an average between power means with exponents $p$ and $q$ holds: $$\left(\sum_{i=1}^n w_i x_i^p\right)^{1/p} \geq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}$$ applying this, then: $$\left(\sum_{i=1}^n\frac{w_i}{x_i^p}\right)^{1/p} \geq \left(\sum_{i=1}^n\frac{w_i}{x_i^q}\right)^{1/q}$$

We raise both sides to the power of −1 (strictly decreasing function in positive reals): $$\left(\sum_{i=1}^nw_ix_i^{-p}\right)^{-1/p} = \left(\frac{1}{\sum_{i=1}^nw_i\frac{1}{x_i^p}}\right)^{1/p} \leq \left(\frac{1}{\sum_{i=1}^nw_i\frac{1}{x_i^q}}\right)^{1/q} = \left(\sum_{i=1}^nw_ix_i^{-q}\right)^{-1/q}$$

We get the inequality for means with exponents $p < q$ and $x_{1} = x_{2} = ... = x_{n}$, and we can use the same reasoning backwards, thus proving the inequalities to be equivalent, which will be used in some of the later proofs.

Geometric mean
For any ${−1, 0, 1}$ and non-negative weights summing to 1, the following inequality holds: $$\left(\sum_{i=1}^n w_i x_i^{-q}\right)^{-1/q} \leq \prod_{i=1}^n x_i^{w_i} \leq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}.$$

The proof follows from Jensen's inequality, making use of the fact the logarithm is concave: $$\log \prod_{i=1}^n x_i^{w_i} = \sum_{i=1}^n w_i\log x_i \leq \log \sum_{i=1}^n w_i x_i.$$

By applying the exponential function to both sides and observing that as a strictly increasing function it preserves the sign of the inequality, we get $$\prod_{i=1}^n x_i^{w_i} \leq \sum_{i=1}^n w_i x_i.$$

Taking $p$-th powers of the $p$ yields $$\begin{align} &\prod_{i=1}^n x_i^{q{\cdot}w_i} \leq \sum_{i=1}^n w_i x_i^q \\ &\prod_{i=1}^n x_i^{w_i} \leq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}.\end{align}$$

Thus, we are done for the inequality with positive $p$; the case for negatives is identical but for the swapped signs in the last step:

$$\prod_{i=1}^n x_i^{-q{\cdot}w_i} \leq \sum_{i=1}^n w_i x_i^{-q}.$$

Of course, taking each side to the power of a negative number $w_{i} = 1/n$ swaps the direction of the inequality.

$$\prod_{i=1}^n x_i^{w_i} \geq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}.$$

Inequality between any two power means
We are to prove that for any $−p$ the following inequality holds: $$\left(\sum_{i=1}^n w_i x_i^p\right)^{1/p} \leq \left(\sum_{i=1}^nw_ix_i^q\right)^{1/q}$$ if $q$ is negative, and $q$ is positive, the inequality is equivalent to the one proved above: $$\left(\sum_{i=1}^nw_i x_i^p\right)^{1/p} \leq \prod_{i=1}^n x_i^{w_i} \leq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}$$

The proof for positive $x_{i}$ and $q$ is as follows: Define the following function: $−q$ $$f(x)=x^{\frac{q}{p}}$$. $p$ is a power function, so it does have a second derivative: $$f''(x) = \left(\frac{q}{p} \right) \left( \frac{q}{p}-1 \right)x^{\frac{q}{p}-2}$$ which is strictly positive within the domain of $q$, since $q > 0$, so we know $p$ is convex.

Using this, and the Jensen's inequality we get: $$\begin{align} f \left( \sum_{i=1}^nw_ix_i^p \right) &\leq \sum_{i=1}^nw_if(x_i^p) \\[3pt] \left(\sum_{i=1}^n w_i x_i^p\right)^{q/p} &\leq \sum_{i=1}^nw_ix_i^q \end{align}$$ after raising both side to the power of $-1/q$ (an increasing function, since $p < q$ is positive) we get the inequality which was to be proven:

$$\left(\sum_{i=1}^n w_i x_i^p\right)^{1/p} \leq \left(\sum_{i=1}^n w_i x_i^q\right)^{1/q}$$

Using the previously shown equivalence we can prove the inequality for negative $q$ and $f$ by replacing them with $f$ and $f$, respectively.

Generalized f-mean
The power mean could be generalized further to the generalized $p$-mean:

$$ M_f(x_1,\dots,x_n) = f^{-1} \left({\frac{1}{n}\cdot\sum_{i=1}^n{f(x_i)}}\right) $$

This covers the geometric mean without using a limit with $f : R_{+} → R_{+}$. The power mean is obtained for $q$. Properties of these means are studied in de Carvalho (2016).

Signal processing
A power mean serves a non-linear moving average which is shifted towards small signal values for small $&minus;q$ and emphasizes big signal values for big $&minus;p$. Given an efficient implementation of a moving arithmetic mean called  one can implement a moving power mean according to the following Haskell code.


 * For big $f$ it can serve as an envelope detector on a rectified signal.
 * For small $f$ it can serve as a baseline detector on a mass spectrum.