I'm a student who is studying math and I am looking over some old exam questions. I posted a problem earlier in the day from the the same list as the question below. It involves a piecewise function and its limit as $x \rightarrow 2$. The funtion is...
$$f(x)= \begin{cases} \frac{x^2-4}{x-2} & \text{if }x > 2 \\ 4 & \text{if }x \leq 2 \\ \end{cases} $$
I was under the impression, from what I read, that the lower condtion relating to the constant 4 is to be ignored in favour of the upper condtion, the equation with the actual variable in it. So if we simplify the upper condition.
$$\frac{x^2-4}{x-2} = \frac{(x+2)(x-2)}{x-2}= x+2$$
Can we say?
$$\lim_{x\to2}f(x) = 4$$
I'm quite intrigued by the strange non-intuitiveness of these piece-wise functions and their limits, does a discontinuity occur and there is no limit? If anyone has an answer I'd love to know!
A function $f:D \to \mathbb{R}$, where $D \subset \mathbb{R}$ is continuous at $x_0 \in D$ iff:
$$\lim_{x \to x_0} f(x) = f(x_0)$$
In the case of the given piece-wise function, you are correct in saying that $\lim_{x \to 2} f(x) = 4$. Since $f(2) = 4$ by definition of the function, it follows that the function is continuous at $x = 2$.
Now, the thing that you might not be fully correct about is the way in which the limit is calculated. When $x > 2$, we have:
$$f(x) = \frac{x^2-4}{x-2}$$
Now, we can say that the left-hand limit is given by:
$$\lim_{x \to 2^+} \frac{x^2-4}{x-2} = 4$$
That's because $f$ is defined in that particular way in an interval $(2,2+h)$, where $h > 0$. That would be the way you would find the right-hand limit.
On the other hand, the left-hand limit is calculated by letting $f(x) = 4$ since that is exactly how $f$ is defined in an interval $(2-h,2)$, where $h>0$. So, we would say that:
$$\lim_{x \to 2^-} 4 = 4$$
Both the left-hand limit and the right-hand limit at $x = 2$ exist and are equal, so we can say that the limit at $x = 2$ exists and is equal to 4. In this case, $f(2) = 4$ happens to be the way in which the function has been defined so it is continuous at that point.
You are absolutely justified in feeling that piece-wise functions are non-intuitive at first. From grade school till high school, we are normally told that functions are just formulas of some kind and we're given geometric ways to determine if some curve in the Cartesian Plane is a function or not. That is a rather primitive view of such objects and the modern view certainly lends itself to more weird things like piece-wise functions.
The silver lining is that once you divorce yourself from those basic ideas, you will learn to appreciate functions in their full generality. Then, piece-wise functions won't appear to be so bad.