The function is defined on
(−∞,−1]∪(−1,1]∪(1,∞)=R
For x<−1,
f(x)=−2
which is a constant function and hence continuous.
For −1<x<1,
f(x)=2x
which is a polynomial function and hence continuous.
For x>1,
f(x)=2
which is a constant function and hence continuous.
Thus, f(x) is continuous on
R−{−1,1}
Continuity at x=−1
Left hand limit:
x→−1−limf(x)=x→−1−lim(−2)=−2
Right hand limit:
x→−1+limf(x)=x→−1+lim(2x)=2(−1)=−2
Also,
f(−1)=−2
∴x→−1limf(x)=f(−1)
Hence, f(x) is continuous at x=−1.
Continuity at x=1
Left hand limit:
x→1−limf(x)=x→1−lim(2x)=2
Right hand limit:
x→1+limf(x)=x→1+lim(2)=2
Also,
f(1)=2(1)=2
∴x→1limf(x)=f(1)
Hence, f(x) is continuous at x=1.
The function is continuous for all x∈R