First, note that $g'(x)=1$ for $x>1$.
On the interior of each of the intervals $(-\infty,-1)$, $[-1,1]$, and $(1,\infty)$ $g$ is differentiable since each component function is. The only question is what happens at the endpoints of these intervals.
At $x=-1$, the value of both component functions is $1$ and the derivative of both component functions is $2$. This means we get
$$
\lim_{h\to0^-}\frac{g(-1+h)-g(-1)}{h}=-2\tag{1}
$$
Because $x^2=-1-2x$ at $x=-1$, we can use $g(x)=-1-2x$ for the computation of $(1)$.
Furthermore, we get
$$
\lim_{h\to0^+}\frac{g(-1+h)-g(-1)}{h}=-2\tag{2}
$$
using $g(x)=x^2$ for the computation of $(2)$.
Since the derivatives computed in $(1)$ and $(2)$ are the same, we get that $g(x)$ is differentiable at $x=-1$.
At $x=1$, the value of both component functions is $1$, however, the derivative of $x^2$ is $2$ and the derivative of $x$ is $1$. This means that
$$
\lim_{h\to0^-}\frac{g(1+h)-g(1)}{h}=2\tag{3}
$$
using $g(x)=x^2$ for the computation of $(3)$.
However, we get
$$
\lim_{h\to0^+}\frac{g(1+h)-g(1)}{h}=1\tag{4}
$$
Because $x=x^2$ at $x=1$, we can use $g(x)=x$ for the computation of $(4)$.
Since the derivatives computed in $(3)$ and $(4)$ are different, $\lim\limits_{h\to0}\frac{g(1+h)-g(1)}{h}$ does not exist, and therefore $g(x)$ is not differentiable at $x=1$.
Ur argument is true, but also note that for the functions derivative to be continuous the function must be continuous itself. Therefore u get another condition for a and b. Using the second equation i. e. ax+b=bx^2-3ax+4
At x=-1 we get(u can verify this urself) a=-1. Therefore condition for b is also attained using the first(the one u framed/ eq for continuous derivative ) equation.
Best Answer
$f$ has to satisfy $$ \lim_{x\to 2+}f(x)=f(2),\quad \lim_{x\to 2- }=\frac{f(x)-f(2)}{x-2}=\lim_{x\to 2+ }=\frac{f(x)-f(2)}{x-2}, $$ i.e. $$ 2m+b=4,\quad m=4 \Rightarrow m=4,b=-4. $$