Putnam 1999, Problem A-1

Find polynomials \(f(x),g(x)\), and \(h(x)\), if they exist, such that for all \(x\),
\[
|f(x)| - |g(x)| + h(x) = \begin{cases} 
-1 & \text{if } x < -1 \\
3x + 2 & \text{if } -1 \leq x \leq 0 \\
-2x + 2 & \text{if } x > 0.
\end{cases}
\]

Solution:
Note that if $r(x)$ and $s(x)$ are any two functions, then
$$\max(r,s) = (r+s+|r-s|)/2.$$
Therefore, if $F(x)$ is the given function, we have
$$F(x) = \max\{-3x-3,0\} - \max\{5x,0\} + 3x + 2$$
$$= (-3x-3+|3x+3|)/2 - (5x+|5x|)/2 + 3x + 2$$
$$= |(3x+3)/2| - |5x/2| - x + \frac{1}{2},$$
so we may set $f(x) = (3x+3)/2$, $g(x) = 5x/2$, and $h(x) = -x + \frac{1}{2}$.