# Proving a function has a discontinuity at 0 but continuous elsewhere

Let $$f(x) = \left\{\begin{array}{ll} x + 2 & -3 < x < -2 \\ -x -2 & -2 \leq x < 0 \\ x + 2 & 0 \leq x < 1 \end{array}\right.$$

I want to show that $$f$$ has a discontinuity at $$x=0$$ but is continuous at all other points in $$(-3,1)$$

Attempt: If $$f$$ was continuous at $$0$$ then $$\lim_{x \to 0}f(x) = f(0)$$. Now $$f(0) = 2$$. Not sure how to then proceed. Do I just then say $$\lim_{x \to 0}f(x) = x+2$$ (since x = 0?)

Hence it is discontinuous at $$x = 0$$

For continuity at all other points: let $$\epsilon > 0$$ be given. Then there exists $$\delta > 0$$ such that $$|x - y| < \delta \Rightarrow |(x+2) - (y+2)| = |x - y| < \epsilon$$ (let $$\delta = \epsilon$$).

Also there exists $$\delta > 0$$ such that $$|x - y| < \delta \Rightarrow |-x -2 - (-y -2)| = |y - x| = |x - y| < \epsilon$$.

Hence $$f$$ is continuous at all other points in $$(-3,1)$$.

• Writing, e.g, $\lim_{x\to 0}f(x)=x+2$. makes no sense. The left hand is not a function of $x$.
– lulu
Sep 20 '21 at 14:38
• As a suggestion: consider the two one-sided limits. In order for $f(x)$ to be continuous at $0$, both of those limits must exist and they must coincide.
– lulu
Sep 20 '21 at 14:39

For $$x<0$$, $$f(x)=-x-2$$ and $$l_{x<0}=\lim_{x\rightarrow0}f(x)=-2$$
For $$x\geq0$$, $$f(x)=x+2$$ and $$l_{x\geq0}\lim_{x\rightarrow0}f(x)=2\rightarrow$$
$$l_{x<0}\neq l_{x\geq0}$$
hence, the function has a discontinuity at$$0$$.
Since $$f(x)=-x-2$$ when $$x\in[-2,0)$$, you have$$\lim_{x\to0^-}f(x)=-2\ne f(0),$$and therefore $$f$$ is discontinuous at $$0$$.
The only other point of $$(-3,1)$$ at which $$f$$ could be discontinuous is $$-2$$. But it is continuous at $$-2$$ since$$\lim_{x\to-2^-}f(x)=\lim_{x\to-2^+}f(x)=0=f(-2).$$