← All courses  ›  Calculus Refresher  ›  Limits  ›  Introduction (Pretest)  ›  Q9

Q9 · One-sided limit of a piecewise function

Pick the right piece, then plug in. That's the whole game.

Pretest Q9: piecewise f(x) = x-8 for x<1, 2x-4 for x≥1; evaluate lim x→1⁻ f(x)
Answer: −7

1. Intuition — what is $\lim_{x \to 1^-} f(x)$ asking?

The minus sign in the superscript $1^-$ is the whole question. It says: as $x$ gets close to 1, but only from the left side (values less than 1), what value is $f(x)$ approaching?

Picture yourself walking along the $x$-axis from the left, getting closer and closer to $x=1$ without ever stepping on it. What $y$-value are you seeing? That's the left-hand limit.

The piecewise definition tells you: when you're on the left side of 1, you're in the "$x-8$" region. So we use that piece. The right-hand piece "$2x-4$" is irrelevant for a left-hand limit — it's the answer to a different question.

🌉 Where this fits in the pretest arc

Q5 introduced one-sided limits with a piecewise graph. Q9 is the same idea, but the function is given as a formula, not a picture. Same concept, different representation. If you can read a piecewise function and pick the right piece, you can answer this in one line.

Pattern across the pretest: Q4 (continuity definition) → Q5 (one-sided limits, picture) → Q8 (removable discontinuity) → Q9 (one-sided limits, formula). The tools repeat with new packaging.

2. The piecewise function — read it carefully

$f(x) = $

$x - 8$ when $x < 1$
$2x - 4$ when $x \geq 1$

The two pieces "stitch together" at $x=1$. On the left of 1, the function is the line $y = x-8$. On the right (and at 1 itself), it's the line $y = 2x-4$. The left piece is undefined for $x \geq 1$, the right piece is undefined for $x < 1$ — they live in different "rooms."

3. The rule — pick the right piece first

For a left-hand limit $\lim_{x \to a^-}$, you only care about the piece whose domain includes values arbitrarily close to $a$ from the left. In our case:

So we work with $f(x) = x - 8$. Now it's just a polynomial — plug in.

4. Worked solution — plug in $x = 1$

For a left-hand limit, once you've picked the right piece, the function is continuous in a neighborhood of $a$ (from that side), so the limit is just plug in the value:

$$\lim_{x \to 1^-} f(x) = \lim_{x \to 1^-} (x - 8) = 1 - 8 = \boxed{-7}$$

Three steps, all of them obvious once you've picked the right piece:

  1. Identify the side: $x \to 1^-$ means $x < 1$ neighborhood.
  2. Pick the matching piece: $f(x) = x - 8$.
  3. Plug in $x = 1$: $1 - 8 = -7$.

5. What about the right-hand limit?

Left-hand limit

$\lim_{x \to 1^-} f(x) = 1 - 8 = \mathbf{-7}$

Uses the "$x-8$" piece.

Right-hand limit

$\lim_{x \to 1^+} f(x) = 2(1) - 4 = \mathbf{-2}$

Uses the "$2x-4$" piece.

The two one-sided limits disagree ($-7 \neq -2$), so the full two-sided limit $\lim_{x \to 1} f(x)$ does not exist. (That's a Q5-style jump discontinuity, by the way — same idea, different shape.)

Notice the actual value of the function at $x=1$: it's defined by the second piece, so $f(1) = 2(1) - 4 = -2$. The function is continuous from the right (and at the point itself), but discontinuous from the left.

6. The trap — what students get wrong

Trap 1: Forgetting the one-sided notation. If you just compute $\lim_{x \to 1} f(x)$ (no superscript), you have to check both sides agree. They don't, so the two-sided limit doesn't exist. The question asks for a one-sided limit, which always exists for piecewise functions defined in neighborhoods of the boundary point.
Trap 2: Picking the wrong piece. If you accidentally use $2x-4$ for a left-hand limit, you get $2(1) - 4 = -2$ — which is the answer to a different question. Always check which room the limit is approaching.
Trap 3: Including the boundary. "$x \geq 1$" includes $x = 1$ itself. So when computing a left-hand limit (which approaches but never reaches 1), we strictly use $x < 1$, not $x \geq 1$. The boundary value is irrelevant for the limit.

7. Visualizing the jump

Plot the two pieces in your head:

The two lines come from the left and right, and at $x = 1$ they jump from $y = -7$ (left side limit) to $y = -2$ (right side value, and right side limit). A 5-unit gap. The graph of $f$ literally has a "step" at $x = 1$.

Why this matters in data science: piecewise functions are everywhere in ML. ReLU is piecewise ($\max(0, x)$). Step functions (decision tree splits) are piecewise. Activation functions in neural networks are piecewise (sigmoid, tanh, GeLU are all smooth, but ReLU and its cousins are literally piecewise linear). Loss functions often have piecewise behavior (Hinge loss, $\epsilon$-insensitive loss in SVMs). And activation thresholds for "is this customer likely to churn?" are piecewise.

When you compute a gradient through a ReLU network, you hit exactly the kind of piecewise structure in Q9 — and you need to know which piece you're in to take the derivative (or the subgradient, in the non-differentiable case). This is the same logic as Q9: pick the right piece, then proceed.

8. Check your understanding

Mini-question. If $g(x) = \begin{cases} 3x + 1, & x \leq 2 \\ x^2, & x > 2 \end{cases}$, find $\lim_{x \to 2^+} g(x)$.

Show answer

$x \to 2^+$ means $x > 2$ neighborhood. Pick the "$x^2$" piece. Plug in: $2^2 = 4$.

Note the inequality flip: "$x \leq 2$" includes 2 itself, but the right-hand limit uses $x > 2$, so we use the second piece. Boundary value (at $x=2$) is $3(2)+1 = 7$ — different from the right-hand limit, different from the left-hand limit. Full two-sided limit at $x=2$ doesn't exist.

9. Practice problems

  1. If $h(x) = \begin{cases} 5 - x, & x < 0 \\ x^2, & x \geq 0 \end{cases}$, find $\lim_{x \to 0^-} h(x)$.
    Show answer Left-hand limit. Use "$5-x$" piece. Plug in $x=0$: $5-0 = 5$. So $\lim_{x\to 0^-} h(x) = 5$.
  2. Two-sided. For the same $h(x)$, does $\lim_{x \to 0} h(x)$ exist? Why or why not?
    Show answer Right-hand limit: $x^2$ at $x=0$ is $0$. Left-hand limit (from #1) is $5$. They disagree, so the two-sided limit does not exist. Discontinuous at $x=0$.
  3. Real-world. A phone plan charges $\$30$ for the first 100 minutes, then $\$0.10$/minute beyond. Write a piecewise function $C(t)$ for cost in dollars as a function of $t$ minutes, and find $\lim_{t \to 100} C(t)$. Does the limit exist?
    Show answer $C(t) = \begin{cases} 30, & 0 \leq t \leq 100 \\ 30 + 0.10(t-100), & t > 100 \end{cases}$.

    Left limit at $t=100$: $C(100^-) = 30$. Right limit at $t=100$: $30 + 0.10(0) = 30$. Both equal $30$, so the two-sided limit exists and equals $30$.

    Notice: $C(100) = 30$ (the first piece defines it at the boundary). So the function is continuous at $t=100$ — no jump. The plan "transitions smoothly" from a flat rate to a per-minute rate.

10. Takeaways

© Data Science Tutor · datascience.aidalee.com