TITLE: Nice expression for minimum of three variables?
QUESTION [65 upvotes]: As we saw here, the minimum of two quantities can be written using elementary functions and the absolute value function.
$\min(a,b)=\frac{a+b}{2} - \frac{|a-b|}{2}$
There's even a nice intuitive explanation to go along with this: If we go to the point half way between two numbers, then going down by half their difference will take us to the smaller one. So my question is: "Is there a similar formula for three numbers?"
Obviously $\min(a,\min(b,c))$ will work, but this gives us the expression:
$$\frac{a+\left(\frac{b+c}{2} - \frac{|b-c|}{2}\right)}{2} - \frac{\left|a-\left(\frac{b+c}{2} - \frac{|b-c|}{2}\right)\right|}{2},$$
which isn't intuitively the minimum of three numbers, and isn't even symmetrical in the variables, even though its output is. Is there some nicer way of expressing this function?

REPLY [5 votes]: Based on Christian Blatter's answer and the trigonometric solution of the cubic equation, we can derive the following unusual solution.
Let $a$, $b$ and $c$ be real numbers. Then they are the roots of the equation
$$(x-a)(x-b)(x-c)=0$$
which can also be written as
$$x^3-(a+b+c)x^2+(ab+bc+ca)x-abc=0.$$
The trigonometric formula gives the solutions of a cubic equation in terms of its coefficients. If we substitute in the above coefficients and simplify we get an expression for the three roots, but now their size order is clear. Let $M$ be the average of $a$, $b$ and $c$, and let $P$ and $Q$ be the quadratic and geometric means of the quantities $a+b-2c$, $a-2b+c$ and $-2a+b+c$. That is:
$$M=\frac{a+b+c}3,$$
$$P=\sqrt{\frac{(a+b-2c)^2+(a-2b+c)^2+(-2a+b+c)^2}3},$$
$$Q=\sqrt[3]{(a+b-2c)(a-2b+c)(-2a+b+c)}.$$
Then we have
$$\max(a,b,c)=\frac{\sqrt 2}3P\cos\left(\frac 13\arccos\left(\sqrt 2\left(\frac QP\right)^3\right)\right)+M,$$
$$\mathrm{median}(a,b,c)=\frac{\sqrt 2}3P\cos\left(\frac 13\arccos\left(\sqrt 2\left(\frac QP\right)^3\right)+\frac{2\pi}3\right)+M,$$
$$\min(a,b,c)=\frac{\sqrt 2}3P\cos\left(\frac 13\arccos\left(\sqrt 2\left(\frac QP\right)^3\right)+\frac{4\pi}3\right)+M.$$