TITLE: $\max(a,b)=\frac{a+b+|a-b|}{2}$ generalization
QUESTION [15 upvotes]: I am aware of an occasionally handy identity: $$\max(a,b)=\frac{a+b+|a-b|}{2}$$
However, I have found I'm unable to come up with a nice similar form for $\max(a,b,c)$. Of course I could always use the fact that $\max(a,b,c)=\max(\max(a,b),c)$ to write
$$\begin{align}\max(a,b,c)&=\frac{\frac{a+b+|a-b|}{2}+c+\left|\frac{a+b+|a-b|}{2}-c\right|}{2}
\\&=\frac{a+b+2c+|a-b|+|a+b-2c+|a-b||}{4}\end{align}$$
but this lacks elegance and in particular it is not clear to me just from the formula that if I permute the variables I get the same result. 
The following doesn't work, but it would be nice if I could write $\max(a,b,c)$ in some form like
$$\frac{a+b+c+|a-b|+|a-c|+|b-c|}{3}$$

Is there a good generalization of this to $n$ variables? That is given $x_1,x_2,\dots,x_n\in\mathbb{R}$, is there a way to write $\max(x_1,x_2,\dots,x_n)$ in a clearly symmetric form using addition, subtraction, division, and the absolute value function?

REPLY [5 votes]: Symmetrizing in the obvious way:
$$\frac{a+b+c}3+\frac{|a-b|+|b-c|+|a-c|}{12}+\\\frac{|a+b-2c+|a-b||+|a+c-2b+|a-c||+|b+c-2a+|b-c||}{12}$$
For four variables, I found:
$$\tfrac14\left(a+b+c+d+|a-b|+|c-d|+|a+b-c-d+|a-b|-|c-d||\right)$$
Of course you don't have to use absolute value signs: $$\lim_{m\to\infty}\sqrt[m]{a^m+b^m+c^m}$$