5H

Continuity and piecewise-defined functions

What it means for a function to be continuous at a point, how to sketch piecewise-defined functions, and how to test whether the pieces join up.

Calculus only works on curves without breaks, so we need a clear test for where a graph is broken. Piecewise functions, defined by different rules on different parts of the domain, are where breaks most often hide. Phone plans, tax brackets and postage costs are all piecewise.

Continuity at a point

  • $y = x^2$ is continuous everywhere.
  • $y = \dfrac{1}{x - 2}$ has a discontinuity at $x = 2$, where it isn't even defined.
  • $y = \dfrac{1}{x^2 - 9}$ has discontinuities at $x = 3$ and $x = -3$.
  • A function is never continuous at an endpoint of its domain, because you can't approach from both sides. $y = \sqrt x$ is continuous for $x \gt 0$ but not at $x = 0$.

We assume that the functions in this course are continuous at every point of their domain unless there's an obvious problem, such as a zero denominator or a change of rule.

Piecewise-defined functions

A piecewise function uses different formulas on different parts of the domain. For example

$$f(x) = \begin{cases} 9 - x^2, & x \le 1 \\ 5 + 3x, & x \gt 1 \end{cases}$$

To sketch it, draw each piece only on its own part of the domain. At the boundary, use a closed circle for the piece that includes $x = 1$ and an open circle for the piece that doesn't.

Example 1●

Test the function $f$ above for continuity at $x = 1$, and state its range.

$f(1) = 9 - 1 = 8$
x = 1 belongs to the top line, because of the ≤.
Left: $9 - 1^2 = 8$. Right: $5 + 3(1) = 8$.
Both formulas at x = 1.
Continuous at $x = 1$.
All three agree, so the parabola and the line meet.
Range: all real $y$.
The left piece reaches its top at (0, 9) and runs down forever. The right piece rises from 8 forever. Together they cover every y.
Example 2: a jump●●

$g(x) = \begin{cases} 2^x, & x \lt 1 \\ 3, & x = 1 \\ x + 2, & x \gt 1 \end{cases}$. Is $g$ continuous at $x = 1$?

$g(1) = 3$
The middle line gives the actual value.
Left: $2^1 = 2$. Right: $1 + 2 = 3$.
The left formula at x = 1.
Not continuous. The left piece ends with an open circle at $(1, 2)$, and the point $(1, 3)$ is filled in where the right piece begins.
The left value doesn't agree.

Making the pieces join

Example 3●●

Find $k$ so that $f(x) = \begin{cases} x^2 + k, & x \le 2 \\ 3x - 1, & x \gt 2 \end{cases}$ is continuous.

Left at $2$: $4 + k$. Right at $2$: $5$.
Each piece is continuous on its own, so only the join at x = 2 matters.
$4 + k = 5$, so $k = 1$
Do the pieces join up?

Left of x = 1: y = x². From x = 1 on: y = mx + c.

Try this
  • With $m = -2$, work out the $c$ that removes the jump, then set it and check.
  • Find a different pair $m$, $c$ that also joins up. What do all the joining pairs have in common?

Your turn

Find $a$ if $f(x) = \begin{cases} ax + 1, & x \lt 2 \\ x^2 - a, & x \ge 2 \end{cases}$ is continuous.

Show the working

$f(2) = 4 - a$ from the bottom line, and the left formula gives $2a + 1$ at $x = 2$. Setting them equal: $2a + 1 = 4 - a$, so $3a = 3$ and $a = 1$.

Flashcards
Test for continuity where the rule changes at $x = a$
$f(a)$, the left formula at $a$ and the right formula at $a$ must all exist and agree.
Continuous at an endpoint of the domain?
Never.
Practice
  1. Where is $y = \dfrac{1}{x^2 - 9}$ discontinuous?

  2. $f(x) = 9 - x^2$ for $x \le 1$ and $f(x) = 5 + 3x$ for $x \gt 1$. Find $f(1)$.

  3. For the same function, find $f(3)$.

  4. Is that function continuous at $x = 1$?

  5. $f(x) = x^2 + k$ for $x \le 2$ and $f(x) = 3x - 1$ for $x \gt 2$. Find $k$ so that $f$ is continuous.

  6. $g(x) = 2^x$ for $x \lt 1$, $g(1) = 3$, and $g(x) = x + 2$ for $x \gt 1$. Find $g(1)$.

  7. On the graph of that function $g$, at $x = 1$ there is:

  8. Is $y = \sqrt x$ continuous at $x = 0$?

  9. Exam style: $f(x) = a - x$ for $x \lt 2$ and $f(x) = x^2 + 2a$ for $x \ge 2$. Find $a$ so that $f$ is continuous.

  10. Exam style: $f(x) = x^2 - 4x$ for $x \lt 3$ and $f(x) = ax + b$ for $x \ge 3$. $f$ is continuous and passes through $(5, 7)$. Find $a$.

Formula sheet