0

Consider $n$ real numbers $a_1, \ldots, a_n$. Let $x_p = argmin_{x} \sum_{i=1}^n |a_i-x|^p$.

I know $x_2$ is the average. $n$ is odd, $x_1$ is the median. How about other $p$'s. Are there simple analytic forms or one has to use optimization algorithms?

Chao Xu
  • 5,768

1 Answers1

1

Basically $x=\arg\min_x\|a-xe\|_p^p$ where $a=[a_1\cdots a_n]^T,\ e=[1\ 1\cdots\ 1]^T$. This paper has talked about a generalization of this problem but they have used Optimization methods to deal with it.

We can make a few observations. First, if $p$ is an even positive integer then $x_p$ is a solution to the equation $$\sum_{i=1}^n (x-a_i)^{p-1}=0\\ nx^{p-1}-\binom{p-1}{1}x^{p-2}\sum _{i=1}^n a_i+\binom{p-1}{2}x^{p-3}\sum_{i=1}^n a_i^2-\cdots+(-1)^{p-1}\sum_{i=1}^na_i^{p-1}=0 $$ with the additional condition that $$\sum_{i=1}^n(x-a_i)^{p-2}>0$$ which is automatically true for real $x$. If $p$ is an odd positive integer then a little thought reflects that $x$ must be in the interval $[\min_i a_i,\max_i a_i]$ and solves the equation $$\sum_{i\in Low}(x-a_i)^{p-1}=\sum_{i\in High}(x-a_i)^{p-1}$$ where $Low$ is the set of $i$'s such that $a_i\le x$ and $High$ is the set $i$'s such that $a_i\ge x$.