A function
\(f\) is differentiable at
\(a\) if the function is continuous, i.e.,
\(f(a^-) = f(a^+) = f(a)\)
At \(x=0\)
\begin{equation*}
\lim_{x \to 0} g(x) = g(0) = 0.
\end{equation*}
\begin{equation*}
also, \, \lim_{x \to 0^-} g(x) = \lim_{x \to 0^-} 2x = 0.
\end{equation*}
\begin{equation*}
and, \, \lim_{x \to 0^+} g(x) = \lim_{x \to 0^+} 2x-x^2 = 2\cdot 0 -0^2 =0.
\end{equation*}
Hence, the function is continuous at \(x=0.\)
At \(x=2\)
\begin{equation*}
\lim_{x \to 2} g(x) = \lim_{x \to 2} (2-x) = 2-2 =0.
\end{equation*}
\begin{equation*}
also, \, \lim_{x \to 2^-} g(x) = \lim_{x \to 2^-} (2x-x^2) = 2\cdot 2-2^2= 0.
\end{equation*}
\begin{equation*}
and, \, \lim_{x \to 2^+} g(x) = \lim_{x \to 2^+} (2-x) = 2-2 =0.
\end{equation*}
Hence, the function is continuous at \(x=2.\) Polynomials are differentiable everywhere, but need to check differentiabilty at the given point.
Now Left hand derivative at \(x=0.\)
\begin{equation*}
g(x) = 2x \, \Rightarrow g'(x)= 2 \, \Rightarrow g'(0)= 2.
\end{equation*}
again, Right hand derivative at \(x=0.\)
\begin{equation*}
g(x) = 2x-x^2 \, \Rightarrow g'(x)= 2-2x \, \Rightarrow g'(0)= 2.
\end{equation*}
Hence, the function is continuous and left derivative = right derivative = 2.
Now check differentiabilty at \(x=2.\)
\begin{equation*}
LHD\vert_{x=2}, \, g(x) = 2x-x^2 \, \Rightarrow g'(x)= 2-2x \, \Rightarrow g'(2^-)= 2-2\cdot 2= -2.
\end{equation*}
\begin{equation*}
RHD\vert_{x=2}, \, g(x) = 2-x \, \Rightarrow g'(x)= -1 \, \Rightarrow g'(2^+)= -1.
\end{equation*}
That is,
\begin{equation*}
g'(2^+) \neq g'(2^-)
\end{equation*}
Hence, the function is not differentiable at \(x=2, \) however, it is continous at \(x=2.\)