# Characterising a function involving the max and min of other functions

Given $n$ smooth real functions $f_1, f_2, \dots, f_n$, define a composite function like this:

$$f(x) = \max(f_1(x), f_2(x), \dots, f_n(x)) - \min(f_1(x), f_2(x), \dots, f_n(x))$$

Is it possible to say anything useful in general about the shape of this function?

Intuitively, it seems like $f$ will be at least $C^0$ continuous but $f^\prime$ may have arbitrarily many discontinuities. How much would we have to know about the individual $f_k$ to be more specific?

For example, if we know that each $f_k$ has $m_k$ extrema, it seems like we should be able to place bounds on both the number of extrema in $f$ and number of discontinuities in $f^\prime$, but I'm having trouble visualising all the possible interactions as $n$ increases.

(I've tried to put this in general terms, but for context my particular interest is somewhat related to my earlier optics question. A different but similar imaging process produces something like the above function with constituent $f_k$ of this form:

$$f_k(x) = \sum_i e_i \sin(x_i + \frac{2k\pi}{n}) P(x - x_i)$$

Once again, simulations suggest that this process can noticeably improve lateral resolution because of the corners introduced between maxima, but it would be nice to have a more formal characterisation.)

-
If I understand correctly, this is the range (in the statistical sense, the length of the smallest interval which contains all the data) of the set $\{f_1(x), f_2(x), \ldots, f_n(x)\}$, yes? – Rahul Oct 13 '10 at 14:25
Yes, that's exactly it. There's some physical rationale for that choice, but it's fairly dubious. – walkytalky Oct 13 '10 at 14:40

Everything you need to know can be deduced from the identity $\text{max}(a, b) = \frac{a+b}{2} + \frac{|a-b|}{2}$ and similarly for $\text{min}$.
Edit: Okay, maybe this is less useful than I thought. You want to know about the extrema of $f$ and the discontinuities of $f'$. If each $f_k$ has finitely many extrema, it may still be the case that $f$ has infinitely many discontinuities; consider two functions which are increasing in a "race" in which the victor changes infinitely often. As a deleted answer says, you want in addition that $f_i - f_j$ has finitely many extrema for every pair $i, j$. Then outside a bounded range of values of $x$ the relative order of the $f_i$ won't change and everything will be hunky-dorky.
Am I being thick or does this identity render the associativity of $\max$ far from obvious? I can't see how to generalize it to $n$ arguments. – Rahul Oct 13 '10 at 14:23
Wouldn't that falsely predict a discontinuity when $a = b < c$? It could get you a useful upper bound though. P.S. Very nice observation in the edit. – Rahul Oct 13 '10 at 14:56