A function $f$ is defined by $$ \begin{equation} f(x)= \begin{cases} -2x^3-3 \text{ for } x < -1 \\ ax+b \text{ for } -1 \leq x < 1 \\ 2x^2+1 \text{ for } 1 \leq x\\ \end{cases} \end{equation} $$
where $a$ and $b$ are constants. The function $f$ is continuous. Find $a$ and $b$
Compute $−2x^3−3$ at $x=−1$ which must be equal to $ax+b$ at $x=−1$.
Similarly, compute $2x^2+1$ which must coincide with $ax+b$ at $x=1$.
From 1 and 2 cases we get $a-b=1$
From 2 and 3 cases we get $a+b=3$
Thus $2a=4$, hence $a=2$, therefore $b=1$