Continuity

For what value(s) of a and b, $f\left(x\right)= \begin{cases} \dfrac{x+2}{\left|x+2\right|}+a, & x<-2 \\ & \\ a+b, & x=-2 \\ & \\ \dfrac{x+2}{\left|x+2\right|}+b, & x>-2 \end{cases}$
is continuous at $x=-2$


$f\left(-2\right)=a+b$ $\cdots$ (1)

When $x<-2, \; \left|x+2\right|=-\left(x+2\right)$

When $x>-2, \; \left|x+2\right|=\left(x+2\right)$

$\begin{aligned} \therefore \lim\limits_{x \to -2^-} f\left(x\right) & =\lim\limits_{x\to -2^-} \; \dfrac{x+2}{\left|x+2\right|}+a \\ & \\ & = \lim\limits_{x \to -2} \; \dfrac{x+2}{-\left(x+2\right)}+a \\ & \\ & = -1+a \;\;\; \cdots (2) \end{aligned}$

$\begin{aligned} \lim\limits_{x \to -2^+} f\left(x\right) & =\lim\limits_{x\to -2^+} \; \dfrac{x+2}{\left|x+2\right|}+b \\ & \\ & = \lim\limits_{x \to -2} \; \dfrac{x+2}{\left(x+2\right)}+b \\ & \\ & = 1+b \;\;\; \cdots (3) \end{aligned}$

Since the function is continuous at $x=-2$,

$\lim\limits_{x \to -2^-}f\left(x\right)=f\left(-2\right)=\lim\limits_{x \to -2^+}f\left(x\right)$

i.e. $-1+a=a+b$ $\implies$ $b=-1$ [from equations (1) and (2)]

and $1+b=a+b$ $\implies$ $a=1$ [from equations (1) and (3)]