Q:

Extremum of $f(x)=\begin{cases}|x|\;;\quad0<|x|\leq2\\1\;;\quad x=0\end{cases}$

Let $f(x)=\begin{cases}|x|\;;\quad0<|x|\leq2\\1\;;\quad x=0\end{cases}$ then show that $x=0$ has _________________
(a) a local maximum
(b) no local maximum
(c) local minimum
(d) no extremum

My reference says that there "no extremum" at $x=0$.
$|x|$ is not differentiable at $x=0$ so I think we can look for maxima or minima at $x=0$.
What is wrong with local maxima at $x=0$ for the above function ?

A:

Let $f:[2,0)\cup(0,2]$ be defined by $f(x)=|x|$. Then $f$ is differentiable with $f'(x)=-1$ for $x<0$ and $f'(x)=1$ for $x>0$. Therefore $f$ is decreasing on $[-2,0)$ and so attains a maximum value of $2$ at $x=-2$. Similarly, $f$ is increasing on $(0,2]$ and so attains a maximum value of $2$ at $x=2$. 
Let $g(x)=1$ for $x=0$ and let $F(x) = f(x)+g(x)$. Then there exists the neighborhood $(-1/2,1/2)$ of $0$ on which $F(x)<F(0)=1$, so $F$ attains a local maximum at $x=0$.
Since $F(x)\leqslant 2$ for all $x\in[-2,2]$, it follows that $F$ attains its global maximum of $2$ at both $x=-2$ and $x=2$.

