How does one systematically find the minimum of
$$f(x)= \sum_{i=0}^{n} (-1)^{i} |x+i|$$
where $x \in \mathbf{R}$? Experimentation on Wolfram Alpha shows a specific pattern, but I'm thinking about using bounding arguments. If $f(x)= \sum_{i=0}^{n} |x+i|$, then repeated uses of the triangle inequality works, but I can't seem to use the triangle inequality to bound $\sum_{i=0}^{n}(-1)^{i} |x+i|$.
Let $n=2m-1$ be odd. The simple function $$\phi(x):=|x|-|x+1|=\left\{\eqalign{&\ \quad1\qquad\quad(x\leq-1) \cr &-2x-1\quad(-1\leq x\leq0)\cr&\quad-1\qquad\ \ (x\geq0)\cr}\right.$$ is $\equiv1$ for $x\leq-1$, then has a ramp of slope $-2$ in the interval $[{-1},0]$, and is $\equiv-1$ for all $x\geq0$.
Since $$f_{2m-1}(x)=\sum_{j=0}^{m-1} \phi(x+2j)$$ the function $f_{2m-1}$ is a sum of $m$ copies of $\phi$ translated to the left by amounts $2j\geq0$ $(0\leq j\leq m-1)$. It therefore has $m$ such descending ramps, the leftmost beginning at $-1-2(m-1)=-(2m-1)$. It follows that $f_{2m-1}$ is monotonically decreasing and takes its minimum $-m$ in all points $x\geq0$.
Now $$f_{2m}(x)=f_{2m-1}(x)+|x+2m|\ .$$ Here the term $|x+2m|$ is decreasing with slope $-1$ for $x\leq-2m$ and increasing with slope $1$ for $x\geq2m$. In the interval $[{-2m},0]$ this steady increase of $x\mapsto |x+2m|$ interferes with the cascade of ramps of $f_{2m-1}$, resulting in a horizontal zigzag of period $2$ and amplitude $1$. At $x=0$ we are at the lower end of the last ramp, and from then on $f_{2m}$ will definitely increase with slope $1$. The minimum of $f_{2m}$ can therefore be found by computing $f_{2m}(0)$, and is found to be $$f_{2m}(0)=f_{2m-1}(0)+|0+2m|=-m+2m=m\ .$$