# Maximization of a function defined with $\max$

Define the function $$f(a,b,c,\alpha,\beta,\gamma,x) = \max\!\bigg(0 , \, \max\!\big( \left(a+x\right)\alpha,\left(b+x\right)\beta \big) - \left(c+x\right)\gamma\bigg),$$ where $$a,b,c,\alpha, \beta, \gamma, x \in \left[0, M \right].$$

Is it true that for any $$\xi = \left( a,b,c,\alpha, \beta, \gamma \right),$$ the maximum of $f(\xi,\cdot)$ occurs either when $x=0$ or $x=M$?

I think the answer is yes, but I have trouble prooving it.
My argument is as follows:
Given any $\xi$, $f(\xi,c)$ will be $$f(\xi,x) = \begin{cases} 0 & \text{case A} \\ (a+x)\alpha - (c+x)\gamma & \text{case B}\\ (b+x)\beta - (c+x)\gamma & \text{case C}\\ \end{cases}$$ Hence, $f(\xi,x)$ is a linear function of $x$ in all three cases, and the result follows.
I think this argument works only if each case is independent of $x$, but this is not the case.
As, when $\xi$ is given, judiciously choosing $x$ may put $f$ in another case.

What would be a right way to prove this result?

-

## migrated from mathoverflow.netFeb 4 '14 at 18:30

This question came from our site for professional mathematicians.

It appears that $f$ is a concatenation of convex functions (namely "max" and linear operations), and therefore $f$ is convex. It follows that one of the end points will always be maximal.