TITLE: Find polynomials f(x),g(x) and h(x),if they exist,such that for all x... Putnam Problem
QUESTION [6 upvotes]: Find polynomials $f(x), g(x)$, and $h(x)$, if they exist, such that for all $x$,
$\mid f(x)\mid-\mid g(x) \mid+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}$  
This is a problem from Putnam Competition 1999, and I could not even approach the problem. I have seen one solution, where they say, it seems that $-1,0$ are crucial points, so one can assume $F(x)=a|x+1|+b|x|+cx+d$ , now, there are quite a few things I do not understand here, why should the sum need to be linear, second, why should we consider this?.
Another version of solution uses this: if $r(x)$ and $s(x)$ are any two functions, then $\max\{r,s\}=\dfrac{r+s+|r-s|}{2}$. Though this seems to be correct for a few case tests, how can I prove this to be true, if not proof then at least understand the intuition behind it.
Please help, but please do not bombard a solution with so advanced theories that I cannot grasp the concept. Thank you.

REPLY [2 votes]: Proof of 
$$\max\{r,s\} = \tfrac{1}{2}(r+s+|r-s|)......(1)$$
We can assume that $r\ge s$. 
If $0 \le s \le r$, then $(r+s+|r-s|)=r+s+r-s=2r$ and $\max\{r,s\}=r$, so (1) is satisfied.
If $s \le r \le 0$, then  $(r+s+|r-s|)=r+s-s+r=2r$ and $\max\{r,s\}=r$, so (1) is satisfied.
If $s \le 0 \le r$, then $(r+s+|r-s|)=r+s+r-s=2r$ and $\max\{r,s\}=r$, so (1) is satisfied.
EDIT: now we deal with the first part.
Define $F(x):=∣f(x)∣−∣g(x)∣+h(x)$.
Since 
$$\frac{d F(x)}{dx}=  
\begin{cases}  
0, & \text{if}~x<-1 \\  
3, & \text{if}~-1\leq x\leq 0 \\  
-2, & \text{if}~x>0\\
\end{cases}$$
We can use linear function to model $f(x), g(x),h(x)$.
Let $f(x)=a(x+1), g(x)=bx, h(x)=cx+d, a\ge 0, b \ge 0$. So
$$F(x)=a|x+1|-b|x|+cx+d$$
And we obtain:
$$\begin{cases}  
(1)......a(-x-1)-b(-x)cx+d=-1, & \text{if}~x<-1 \\  
(2)......a(1+x)-b(-x)+cx+d=3x+2, & \text{if}~-1\leq x\leq 0 \\  
(3)......a(1+x)-bx+cx+d=-2x+2, & \text{if}~x>0\\
\end{cases}$$ 
Setting coefficients of $x^0$ and $x^1$ in (1),(2),(3) to be zeros, we end up with 6 equations for 4 parameters $a,b,c,d$.  Fortunately we have a solution:
$$a=\frac{3}{2},b=\frac{5}{2},c=-1,d=\frac{1}{2}$$