Answer
The function $g$ is differentiable for all values of $x$ except $x=2$
$g'(x) = 2~~~$ if $x \leq 0$
$g'(x) = 2-2x~~~$ if $0 \lt x \lt 2$
$g'(x) = -1~~~$ if $x \gt 2$
We can see a sketch of $g$ and $g'$ below.
Work Step by Step
$g(x) = 2x~~~$ if $x \leq 0$
$g(x) = 2x-x^2~~~$ if $0 \lt x \lt 2$
$g(x) = 2-x~~~$ if $x \geq 2$
$g(0) = 0$
As $x \to 0^-$, then $~~g(x)=2x$ approaches 0
As $x \to 0^+$, then $~~g(x)= 2x-x^2$ approaches 0
As $x \to 0^-$, then $~~g'(x) = 2~~$
As $x \to 0^+$, then $~~g'(x) = 2-2x~~$ and $g'(x)$ approaches the value of 2
Therefore, $g$ is differentiable at 0
$g(2) = 0$
As $x \to 2^-$, then $~~g(x)=2x-x^2$ approaches 0
As $x \to 2^+$, then $~~g(x)= 2-x$ approaches 0
As $x \to 2^-$, then $~~g'(x) = 2-2x~~$ approaches -2
As $x \to 2^+$, then $~~g'(x) = -1$
Since the derivatives are not equal from the left and the right, $g$ is not differentiable at $2$
The function $g$ is differentiable for all values of $x$ except $x=2$
We can find a formula for $g'$:
$g'(x) = 2~~~$ if $x \leq 0$
$g'(x) = 2-2x~~~$ if $0 \lt x \lt 2$
$g'(x) = -1~~~$ if $x \gt 2$
We can see a sketch of $g$ and $g'$ below.