If $f(x)=x^2-2|x|$, then we have to test the differentiability of $g(x)$ in the interval $[-2,3] $,where$$g(x) = \begin{cases} \min\{f(t); -2≤t≤x\}&: x \in [-2,0)\\ \max\{f(t);0≤t≤x\},&: x \in [0,3] \end{cases} $$
My solution
We can write $f(x) $ as $x^2+2x$ when $-2≤x≤0$ and $f(x)=x^2-2x$ for $ 0<x≤3$. Now by drawing graph of $f(x)$ we see that it is decreasing in $[-2,-1]$ and $[0,1]$ and is increasing in $[-1,0]$ and $[1,3]$, so
$$g(x) =
\begin{cases}
x^2+2x,&:x \in [-2,-1]\\
-1,&:x \in (-1,0]\\
0,&:x \in (0,1]\\
x^2-2x,&:x \in (1,3]
\end{cases}
$$
We now draw the graph of obtained $g(x)$ and find the points off discontinuity and indifferentiability as $0,1$ and $0,1$, respectively.
But the answer on back of book says the $g(x)$ is discontinuous at $x=0$ only and is indifferentiable at $x=0,2$.
I explained my approach to the problem and its solution as best I could. Can anyone tell where I'm wrong? I know the mistake is somewhere in deciding the function $g(x)$ in the interval $(0,1]$, but I'm not able to figure that out .
Please help.
I got what you did between $-2$ and $0$. However $f(x)=x^2-2x$ for $x \ge 0$ has its minimum at $1$, but on that part $g$ is defined as the maximum. Over $[0,3]$ the graph of $f$ goes from $0$ down to $-1$ on $[0,1]$, then goes back up from $-1$ to $0$ on $[1,2]$. So on the interval $[0,2]$ the max is $0$, and on $[2,3]$ the max is at the right endpoint so that $g(x)=x^2-2x$ on $[2,3]$. The only continuity jump occurs at $0$ where $g$ jumps from $-1$ to $0$. It also looks like $g$ is differentiable everywhere except $0$, by comparing (values and) derivatives of the pieces at juncture points $-1,0,2.$
EDIT: Oops, at $x=2$ the derivatives don't match, since $f'(x)=2x-2$ on one side, giving $f'(2)=2\cdot 2-2=2$ which doesn't match the zero derivative of the constant to the left of 2.