Answer
$a=\displaystyle \frac{5}{2},\quad b=-\frac{1}{2}$
Work Step by Step
The piecewise defined functions are continuous on their intervals$ .$
For f to be continuous at $x=-1$ and at $x=1$, the one sided limits at these values of x should be equal.
At $x=-1,$
$\displaystyle \lim_{x\rightarrow-1^{-}} f(x)=\displaystyle \lim_{x\rightarrow-1^{-}}(-2)=-2$
$\displaystyle \lim_{x\rightarrow-1^{+}} f(x)=\displaystyle \lim_{x\rightarrow-1^{+}}(ax-b)=-a-b$
For the limit to exist, we must have $\fbox{$-a-b=-2$}$
At $x=1,$
$\displaystyle \lim_{x\rightarrow 1^{-}} f(x)=\displaystyle \lim_{x\rightarrow 1^{-}}(ax-b)=a-b$
$\displaystyle \lim_{x\rightarrow 1^{+}} f(x)=\displaystyle \lim_{x\rightarrow 1^{+}}(3)=3$
For the limit to exist, we must have $\fbox{$a-b=3$}$
Adding the two equations we obtained,
$-2b=1\displaystyle \Rightarrow b=-\frac{1}{2}$
Back-substituting,
$a-(-\displaystyle \frac{1}{2})=3\Rightarrow a=\frac{5}{2}$