How do I maximize the sum of three absolute value functions? Given the three absolute value functions:
f1 (x) = − |x − 1|, 
f2 (x) = − |x − 2|, 
f3 (x) = |x − 3|
How do I maximize the sum of these three functions?
 A: Direct method


*

*$x<1\implies \sum f=-(1-x)-(2-x)+(3-x)=x$

*$1\le x<2\implies \sum f=-(x-1)-(2-x)+(3-x)=-x+2$

*$2\le x<3\implies \sum f=-(x-1)-(x-2)+(3-x)=-3x+6$

*$x\ge3\implies \sum f=-(x-1)-(x-2)+(x-3)=-x$


Plot of -|x-1|-|x-2|+|x-3|
A: First, let's look at $f_2 + f_3$.

Clearly, the contributions of $f_2$ and $f_3$ cannot cause a maximum or minimum to be distinguishable on $(-\infty, 2]$ or on $[3,\infty]$.  Since the maximum of $f_1$ occurs at $1$, and this is in the interval for the maximum of $f_2 + f_3$, themaximum is at $x = 1$.

How else could we get this?


*

*The slope of $f_1$ is $1$ on $(-\infty,1)$ and $-1$ on $(1,\infty)$.

*The slope of $f_2$ is $1$ on $(-\infty,2)$ and $-1$ on $(2,\infty)$.

*The slope of $f_3$ is $-1$ on $(-\infty,3)$ and $1$ on $(3,\infty)$.


Consequently, the total slope is $1$ on $(-\infty,1)$, $-1$ on $(1,2)$, $-3$ on $(2,3)$, and $-1$ on $(3, \infty)$.  The only transition from rising to falling slopes is at $1$, so the objective function has a local maximum at $x=1$.  Since the value of the objective function only increases as $x$ increases to $1$ (from the left) and only decreases as $x$ increases from $1$ (to the right), $x = 1$ is the location of the global maximum.
